Subject: [alpine-aports] [PATCH] syslog-ng release 3.14.1 with patches from issues list

From: Jens Vehlhaber <[email-masked]>
Date: Tue, 10 Apr 2018 08:30:31 +0200

---
 main/syslog-ng/APKBUILD                  | 53 ++++++++++++++++++++------------
 main/syslog-ng/issue1901.patch           | 10 ++++++
 main/syslog-ng/pagesize.patch            | 13 ++++++++
 main/syslog-ng/syslog-ng-destination.std | 12 ++++----
 main/syslog-ng/syslog-ng-options.std     |  5 +++
 main/syslog-ng/syslog-ng-plugins.std     |  3 +-
 main/syslog-ng/syslog-ng-source.std      |  2 --
 main/syslog-ng/syslog-ng.initd           | 11 +++++--
 main/syslog-ng/syslog-ng.pre-upgrade     |  4 +++
 9 files changed, 81 insertions(+), 32 deletions(-)
 create mode 100644 main/syslog-ng/issue1901.patch
 create mode 100644 main/syslog-ng/pagesize.patch
 create mode 100644 main/syslog-ng/syslog-ng.pre-upgrade

diff --git a/main/syslog-ng/APKBUILD b/main/syslog-ng/APKBUILD
index 9f1068840f..f1b9ad3b2d 100644
--- a/main/syslog-ng/APKBUILD
+++ b/main/syslog-ng/APKBUILD
@@ -2,19 +2,21 @@
 # Contributor: Adrian Guenter <[email-masked]>
 # Maintainer: jv <[email-masked]>
 pkgname=syslog-ng
-pkgver=3.13.2
-pkgrel=1
+pkgver=3.14.1
+pkgrel=0
 pkgdesc="Next generation logging daemon"
 url="http://www.balabit.com"
 arch="all !aarch64"
 license="GPL-2.0"
-depends=""
+depends="tzdata"
 depends_dev="glib-dev eventlog-dev pcre-dev libressl-dev python2-dev hiredis-dev json-c-dev file"
 makedepends="$depends_dev"
-install="$pkgname.post-install"
-subpackages="$pkgname-json"
+install="$pkgname.post-install $pkgname.pre-upgrade"
+subpackages="$pkgname-dev $pkgname-json"
 
 source="https://github.com/balabit/syslog-ng/releases/download/syslog-ng-${pkgver}/syslog-ng-${pkgver}.tar.gz
+    pagesize.patch
+    issue1901.patch
     syslog-ng.logrotate
     syslog-ng.initd
     syslog-ng-destination.std
@@ -27,37 +29,46 @@ source="https://github.com/balabit/syslog-ng/releases/download/syslog-ng-${pkgve
 
 _builddir="$srcdir/${pkgname}-$pkgver"
 
+prepare() {
+    local i
+    cd "$_builddir"
+    for i in ${source}; do
+        case ${i} in
+    	    *.patch) msg ${i}; patch -p1 -i "$srcdir"/${i} || return 1;;
+	esac
+    done
+}
+
 build() {
     cd "$_builddir"
     ./configure --prefix=/usr \
     --sysconfdir=/etc/syslog-ng \
     --localstatedir=/run \
-    --enable-extra-warnings \
+    --with-timezone-dir=/usr/share/zoneinfo \
     --with-librabbitmq-client=system \
     --enable-ipv6 \
     --enable-ssl \
     --disable-sql \
     --enable-redis \
     --disable-mongodb \
-    --enable-json
-    make
+    --enable-json \
+    --disable-python \
+    --disable-systemd \
+    || return 1
+    make || return 1
 }
 
 check() {
     cd "$_builddir"
+    # 2 of 64 tests fail
     make check || return 0
 }
 
 package() {
     cd "$_builddir"
     make -j1 DESTDIR=${pkgdir} install
-    rm -rf ${pkgdir}/etc/syslog-ng
+    rm -f  ${pkgdir}/etc/syslog-ng/syslog-ng.conf
     rm -rf ${pkgdir}/run
-    rm -rf ${pkgdir}/usr/include
-    rm -rf ${pkgdir}/usr/lib/pkgconfig
-    rm -rf ${pkgdir}/usr/share
-    rm -f  ${pkgdir}/usr/lib/libsyslog-ng.so
-    rm -rf ${pkgdir}/usr/lib/$pkgname/libtest
     # getent module doesn't build properly as musl doesn't support reentrant
     # getprotoby[number|name] funcs. The provided compat lib only patches 
     # solaris, which does provide reentrant versions under a different sig
@@ -78,12 +89,14 @@ json() {
     mv "$pkgdir"/usr/lib/syslog-ng/libjson*.so "$subpkgdir"/usr/lib/syslog-ng
 }
 
-sha512sums="fd5c6645f1e8e10cba940ea29715f9e7cc286cd49c2f45bde2a447731189d6171ca204aa066ac96dd09246fd7ed1751130d143d807c979518d688e7750490cfe  syslog-ng-3.13.2.tar.gz
+sha512sums="86e5b59f76de3f585781accc9e426b2f74a73a560a6b49364e3f2b71b6fdd382b8473b468ac396e09c1dd0e00aa525a25874af67ce6c81978df2995c9b920aa7  syslog-ng-3.14.1.tar.gz
+61361459a0d2ce3c03ba96c39dae16ff16e9b4f37620fe32639a41ee3e9f0e269151986894d43a1dff4e7275c8846d221ad92db14b029deaf3203b5f3926f8ba  pagesize.patch
+db8c347033f77d6792585c0b146cbb19f7c5886849afea5ae34acbd5701718d3a334cc0c49d010081e807f1b7a9a60b6c026c744c6424e4ef462375cd12dfb27  issue1901.patch
 a062d1601f5215f60e2fc40c6ca498d768aa97af3647a9468731123a28fdd67962421b4412bfbe08a1123141b730cb78f102230ab72befec05ba7f398b39e27a  syslog-ng.logrotate
-84fa9b10268edd8cae2ed1fd4b0d8b7078afab050571e1f05ce45c95f97a650511e8dfe30f5815cf2582446ea9f4a45aafcde3a5ae373716cecb6395bc1dd16b  syslog-ng.initd
-b51d8b3da9584b6cb5b5c023b5ca1085d8e4c2cfa56f6ed12fe6feb0f33a390b43825aaaf4dd74eb6b7765485fe42f7f21c74380b72de9ed2c7775787ab1e720  syslog-ng-destination.std
+9a09c3c1497957d146ac3ed5cf2433dbe0c80b776b0e832d08c577fc8a657f2fe75387ab5ee360203da5bf7a7ae93283e5dd20030d080e9b5a47b72c9300e520  syslog-ng.initd
+f07c1712ada8871d51b4d66e390a83f87a340e126b4fed8e89fe2d51d4007e5d5f7dc77ff7c93e92798b38a90473367f5d82742fc964b168a3f69e39a5f3bede  syslog-ng-destination.std
 e04a70a0b8fc4f40951c9b608b0dede1fa561dd7f58ce8fd8bac70b578b749d15d202973fd9de9fe494656ee138ef5efd32ea6229e6ec0a2f19672dd621acc91  syslog-ng-filter.std
 d7864f6666101e0818dd0178a4d1ada2417280de153ff916fe4879348a37b7bfab5936e86629dc52e4edf82fbd601e04d08ed5a2117bcb0470a3d5884add9f55  syslog-ng-log.std
-9f4224faf45c73daa54549aebf20e2c45d0bf533a20d2ad97d7258490ce793c8b08cc34cac2a89d185e936515096eb93c793018986c8d21861d88c4b0005d16a  syslog-ng-options.std
-6da6629cad9a1d8a54139cda968ca6a4b86536b2c14eb9bc8a3d09c7cbc20cf18fadee0046687de30149ea18da65a7f8ba08c07b35fb46eb42e1fc5faecff3e7  syslog-ng-plugins.std
-b441689ded539a358bf03fc292721a280ea29e1592b2a10ce011b455643dae3949af239a0f2bf84957096757e55a87e844df10c0be016fb7ac969d53def6afc6  syslog-ng-source.std"
+31ab26c6621a7fa8585792700bebb1ccb1a259fd8bac1725b05cf27364f5f7de0c6be178c5f89a7146167d58d96836aa1755b87e47cb55d004c5d1802440aa36  syslog-ng-options.std
+2d572275b723a9a941be7163a22904081a30a07cf0f2fd8bcb97789bf3427d06ec9ae4b4e873f0035724a9af2b40741c49fb5a9bc3bbe2a1f16d91e673e04cc9  syslog-ng-plugins.std
+42cc7728a182fee30675aefee9055eb14bdfbf2006bcf1c731864221ea494ad82d9ae4417190ff18da4a663fa9d5efcd514b6e64a568e228cfed1fb2abd2b10c  syslog-ng-source.std"
diff --git a/main/syslog-ng/issue1901.patch b/main/syslog-ng/issue1901.patch
new file mode 100644
index 0000000000..de3e29b128
--- /dev/null
+++ b/main/syslog-ng/issue1901.patch
@@ -0,0 +1,10 @@
+--- a/syslog-ng-ctl/syslog-ng-ctl.c
++++ b/syslog-ng-ctl/syslog-ng-ctl.c
+@@ -32,7 +32,6 @@
+ #include <string.h>
+ #include <stdlib.h>
+ #include <locale.h>
+-#include <sgtty.h>
+ #include <termios.h>
+ #include <unistd.h>
+ #include <errno.h>
diff --git a/main/syslog-ng/pagesize.patch b/main/syslog-ng/pagesize.patch
new file mode 100644
index 0000000000..276f222c2d
--- /dev/null
+++ b/main/syslog-ng/pagesize.patch
@@ -0,0 +1,13 @@
+--- a/lib/secret-storage/nondumpable-allocator.c
++++ b/lib/secret-storage/nondumpable-allocator.c
+@@ -104,8 +104,8 @@
+ nondumpable_buffer_alloc(gsize len)
+ {
+   gsize minimum_size = len + ALLOCATION_HEADER_SIZE;
+-  gsize PAGESIZE = sysconf(_SC_PAGE_SIZE);
+-  gsize alloc_size = round_to_nearest(minimum_size, PAGESIZE);
++  gsize page_size = sysconf(_SC_PAGE_SIZE);
++  gsize alloc_size = round_to_nearest(minimum_size, page_size);
+ 
+   Allocation *buffer = _mmap(alloc_size);
+   if (!buffer)
diff --git a/main/syslog-ng/syslog-ng-destination.std b/main/syslog-ng/syslog-ng-destination.std
index 93bc3030af..30ce1c90b5 100644
--- a/main/syslog-ng/syslog-ng-destination.std
+++ b/main/syslog-ng/syslog-ng-destination.std
@@ -2,10 +2,10 @@
 # Default syslog-ng standard log files; Do not edit this file!
 # append log file entry with line on a file: syslog-ng-destination.<package>
 # ---------------------------------------------------------------------------------
-  destination df_auth { file("/var/log/auth.log"); };
-  destination df_kern { file("/var/log/kern.log"); };
-  destination df_mail { file("/var/log/mail.log"); };
-  destination df_error { file("/var/log/error.log"); };
+  destination df_auth { file("/var/log/auth.log" _TZ_ ); };
+  destination df_kern { file("/var/log/kern.log" _TZ_ ); };
+  destination df_mail { file("/var/log/mail.log" _TZ_ ); };
+  destination df_error { file("/var/log/error.log" _TZ_ ); };
 # these files are meant for the mail system log files
 # and provide re-usable destinations for {mail,cron,...}.info,
 # {mail,cron,...}.notice, etc.
@@ -15,8 +15,8 @@
   destination df_facility_dot_err { file("/var/log/$FACILITY.err"); };
   destination df_facility_dot_crit { file("/var/log/$FACILITY.crit"); };
 # some more classical and useful files found in standard syslog configurations
-  destination df_debug { file("/var/log/debug"); };
-  destination df_messages { file("/var/log/messages"); };
+  destination df_debug { file("/var/log/debug" _TZ_ ); };
+  destination df_messages { file("/var/log/messages" _TZ_ ); };
 # consoles
 # this will send messages to everyone logged in
   destination du_all { usertty("*"); };
diff --git a/main/syslog-ng/syslog-ng-options.std b/main/syslog-ng/syslog-ng-options.std
index 6e9fe75e56..a66b06fafb 100644
--- a/main/syslog-ng/syslog-ng-options.std
+++ b/main/syslog-ng/syslog-ng-options.std
@@ -9,6 +9,8 @@
   time_reopen(10);
 # the time to wait before an idle destination file is closed (default is 60)
   time_reap(360);
+# Timestamp format: rfc3164|rfc3339|bsd|iso
+  ts_format(rfc3164);
 # the number of lines buffered before written to file you might want to 
 # increase this if your disk isn't catching with all the log messages you get 
 # or if you want less disk activity (say on a laptop) (default is 0)
@@ -35,3 +37,6 @@
 #log_msg_size(2048);
 # Disable statistic log messages.
   stats_freq(0);
+#musl syslog ignored time-zone
+  send-time-zone("UTC");
+  recv-time-zone("UTC");
\ No newline at end of file
diff --git a/main/syslog-ng/syslog-ng-plugins.std b/main/syslog-ng/syslog-ng-plugins.std
index 9e4c952ca8..fc0c775568 100644
--- a/main/syslog-ng/syslog-ng-plugins.std
+++ b/main/syslog-ng/syslog-ng-plugins.std
@@ -3,4 +3,5 @@
 # append source with line on a file: syslog-ng-plugins.<package>
 # ---------------------------------------------------------------------------------
 # version
-@version: 3.13
+@version: 3.14
+@include 'scl.conf'
diff --git a/main/syslog-ng/syslog-ng-source.std b/main/syslog-ng/syslog-ng-source.std
index 33b5d83e68..95832ff6e7 100644
--- a/main/syslog-ng/syslog-ng-source.std
+++ b/main/syslog-ng/syslog-ng-source.std
@@ -2,11 +2,9 @@
 # Default syslog-ng sources; Do not edit this file!
 # append source with line on a file: syslog-ng-source.<package>
 # ---------------------------------------------------------------------------------
-source s_all {
 # message generated by Syslog-NG
   internal();
 # standard Linux log source (this is the default place for the syslog() function to send logs to)
   unix-dgram("/dev/log");
 # messages from the kernel
   file("/proc/kmsg" program_override("kernel"));
-};
diff --git a/main/syslog-ng/syslog-ng.initd b/main/syslog-ng/syslog-ng.initd
index 894081fbfa..a720017425 100755
--- a/main/syslog-ng/syslog-ng.initd
+++ b/main/syslog-ng/syslog-ng.initd
@@ -39,14 +39,17 @@ reload() {
 }
 
 grep_syslog_conf_entries() {
-	local section="$1" FN filelist
-	grep -v '^#' /etc/syslog-ng/syslog-ng-${section}.std
+	local section="$1" FN filelist timezone
 	filelist=$(find /etc/syslog-ng/ -maxdepth 1 -type f -name "syslog-ng-${section}.*" | grep -Ev ".backup|.std|~")
+	timezone=$(find /etc/zoneinfo -type f -print0 | sed "s#/etc/zoneinfo/##g")
+	[ "$timezone" = "UTC" ] && timezone=""
+	[ -n "$timezone" ] && timezone="time_zone(\"$timezone\")"
+	grep -v '^#' /etc/syslog-ng/syslog-ng-${section}.std | sed "s#_TZ_#${timezone}#g"
 	if [ $? -eq 0 ]
 	then
 		for FN in ${filelist}
 		do
-			grep -v '^#' $FN
+        	grep -v '^#' $FN | sed "s#_TZ_#${timezone}#g"
 		done
 	fi
 }
@@ -65,7 +68,9 @@ update() {
 		grep_syslog_conf_entries options
 		echo "};"
 		# create source entries
+		echo "source s_all {"
 		grep_syslog_conf_entries source
+		echo "};"
 		# create destination entries
 		grep_syslog_conf_entries destination
 		# create filter entries
diff --git a/main/syslog-ng/syslog-ng.pre-upgrade b/main/syslog-ng/syslog-ng.pre-upgrade
new file mode 100644
index 0000000000..e96a11a9c2
--- /dev/null
+++ b/main/syslog-ng/syslog-ng.pre-upgrade
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+rm -f /etc/syslog-ng/syslog-ng-*.std
+rm -f /etc/syslog-ng/*.apk*
-- 
2.15.0

---
Unsubscribe:  [email-masked]
Help:         [email-masked]
---

---

From: Leonardo Arena <[email-masked]>
Date: Wed, 30 May 2018 11:28:32 +0200

Hi,

sorry for the late review and thank you for your help. Please see comments
below:

On Tue, Apr 10, 2018 at 8:30 AM, Jens Vehlhaber <[email-masked]> wrote:

>  source="https://github.com/balabit/syslog-ng/releases/
> download/syslog-ng-${pkgver}/syslog-ng-${pkgver}.tar.gz
> +    pagesize.patch
> +    issue1901.patch
>      syslog-ng.logrotate
>      syslog-ng.initd

Can you please rename "_builddir" into "builddir". It's an official abuild
variable.

> +           *.patch) msg ${i}; patch -p1 -i "$srcdir"/${i} || return 1;;

Here you can use "default_prepare" abuild function which does the same
thing.

>      --with-librabbitmq-client=system \

We use "set -e" in abuild, so no need to catch the errors.

>      make check || return 0
Is it possible to either fix the failing tests or patch the sources to do
not run only the failing test?
This essentially is like disabling the tests altogether.

Thanks!

/leo