From 996f18d0e84291a625486079c8e29f59f021a72a Mon Sep 17 00:00:00 2001 From: slin14 Date: Fri, 28 Sep 2018 08:03:00 +0800 Subject: [PATCH] de-fuzz logrotate patches When do Centos 7.5 upgraded, some patches didn't resolve and cause the fuzzy in the line numbers of the patches. And it may cause .orig file is created when do patch. And this .orig file will lead to rpm packaging failure due to the unexpected and unpackaged .orig file. Please visit below link to get more detail info: https://bugs.launchpad.net/starlingx/+bug/1794611 Solution: Safest solution is to de-fuzz our patches. Story: 2003389 Task: 26755 Change-Id: I5a0d830d8bc8ec5c85959bb1b4c243e8c56764c1 Signed-off-by: slin14 --- .../meta_patches/0002-crond-adjustment.patch | 16 +++++++-------- .../0003-Add-upstream-patches.patch | 20 +++++++++---------- .../meta_patches/0004-Add-su-patch.patch | 12 +++++------ ...File-eliminate-stat-open-TOCTOU-race.patch | 12 +++++------ 4 files changed, 30 insertions(+), 30 deletions(-) diff --git a/logging/logrotate/centos/meta_patches/0002-crond-adjustment.patch b/logging/logrotate/centos/meta_patches/0002-crond-adjustment.patch index 1ebed13df..258867267 100644 --- a/logging/logrotate/centos/meta_patches/0002-crond-adjustment.patch +++ b/logging/logrotate/centos/meta_patches/0002-crond-adjustment.patch @@ -1,25 +1,25 @@ -From ecd78bb1b347dfe3da380e100ce1f566418279a1 Mon Sep 17 00:00:00 2001 +From 29fcff1071739e05f6623ffb7f5af828e2261e87 Mon Sep 17 00:00:00 2001 From: Scott Little Date: Mon, 2 Oct 2017 16:22:44 -0400 -Subject: [PATCH 1/2] WRS: crond-adjustment.patch +Subject: WRS: crond-adjustment.patch --- SPECS/logrotate.spec | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/SPECS/logrotate.spec b/SPECS/logrotate.spec -index c66cf89..1b4e4e3 100644 +index 0dbde7d..0eac8bf 100644 --- a/SPECS/logrotate.spec +++ b/SPECS/logrotate.spec @@ -7,6 +7,7 @@ Group: System Environment/Base - Url: https://fedorahosted.org/logrotate/ + URL: https://github.com/logrotate/logrotate Source: https://fedorahosted.org/releases/l/o/logrotate/logrotate-%{version}.tar.gz Source1: rwtab +Source2: logrotate-cron.d Patch0: logrotate-3.8.6-force.patch Patch1: logrotate-3.8.6-r465.patch Patch2: logrotate-3.8.6-sortglob.patch -@@ -89,6 +90,10 @@ install -p -m 755 examples/logrotate.cron $RPM_BUILD_ROOT/%{_sysconfdir}/cron.da +@@ -105,6 +106,10 @@ install -p -m 755 examples/logrotate.cron $RPM_BUILD_ROOT/%{_sysconfdir}/cron.da mkdir -p $RPM_BUILD_ROOT/%{_sysconfdir}/rwtab.d install -m644 %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/rwtab.d/logrotate @@ -30,7 +30,7 @@ index c66cf89..1b4e4e3 100644 %pre # If /var/lib/logrotate/logrotate.status does not exist, create it and copy # the /var/lib/logrotate.status in it (if it exists). We have to do that in pre -@@ -108,12 +113,13 @@ rm -rf $RPM_BUILD_ROOT +@@ -124,12 +129,13 @@ rm -rf $RPM_BUILD_ROOT %attr(0755, root, root) %{_sbindir}/logrotate %attr(0644, root, root) %{_mandir}/man8/logrotate.8* %attr(0644, root, root) %{_mandir}/man5/logrotate.conf.5* @@ -44,7 +44,7 @@ index c66cf89..1b4e4e3 100644 +%attr(0700, root, root) %{_sysconfdir}/logrotate.cron %changelog - * Tue Jan 24 2017 Kamil Dudka - 3.8.6-14 + * Mon Sep 25 2017 Kamil Dudka - 3.8.6-15 -- -1.9.1 +2.7.4 diff --git a/logging/logrotate/centos/meta_patches/0003-Add-upstream-patches.patch b/logging/logrotate/centos/meta_patches/0003-Add-upstream-patches.patch index e0fc5e3f9..33f78a294 100644 --- a/logging/logrotate/centos/meta_patches/0003-Add-upstream-patches.patch +++ b/logging/logrotate/centos/meta_patches/0003-Add-upstream-patches.patch @@ -1,19 +1,19 @@ -From a4c9be7a2b9c9216b87930436d815f0d765a2ba4 Mon Sep 17 00:00:00 2001 +From dfd8e1c325e43cc8a5eb5ba939e355f89515a1d3 Mon Sep 17 00:00:00 2001 From: Don Penney Date: Fri, 19 Jan 2018 23:04:46 -0500 -Subject: [PATCH] Add upstream patches +Subject: Add upstream patches --- SPECS/logrotate.spec | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/SPECS/logrotate.spec b/SPECS/logrotate.spec -index 46e17e8..d67e4bb 100644 +index 0eac8bf..99a22ac 100644 --- a/SPECS/logrotate.spec +++ b/SPECS/logrotate.spec -@@ -37,6 +37,9 @@ Patch13: logrotate-3.8.6-selinux.patch - # fix #1387533 - make 'su' directive accept usernames starting with digits - Patch14: logrotate-3.8.6-su-username.patch +@@ -49,6 +49,9 @@ Patch17: logrotate-3.8.6-config-mode-err.patch + # fix #1483800 - update references to project page + Patch18: logrotate-3.8.6-upstream-url.patch +Patch10001: 0001-createOutputFile-rename-already-existing-file.patch +Patch10002: 0002-createOutputFile-eliminate-stat-open-TOCTOU-race.patch @@ -21,9 +21,9 @@ index 46e17e8..d67e4bb 100644 Requires: coreutils >= 5.92 popt BuildRequires: libselinux-devel popt-devel libacl-devel acl BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) -@@ -70,6 +73,9 @@ log files on your system. - %patch13 -p1 - %patch14 -p1 +@@ -86,6 +89,9 @@ log files on your system. + %patch17 -p1 + %patch18 -p1 +%patch10001 -p1 +%patch10002 -p1 @@ -32,5 +32,5 @@ index 46e17e8..d67e4bb 100644 make %{?_smp_mflags} RPM_OPT_FLAGS="$RPM_OPT_FLAGS" WITH_SELINUX=yes WITH_ACL=yes -- -1.8.3.1 +2.7.4 diff --git a/logging/logrotate/centos/meta_patches/0004-Add-su-patch.patch b/logging/logrotate/centos/meta_patches/0004-Add-su-patch.patch index 9780ded7d..deddb5134 100644 --- a/logging/logrotate/centos/meta_patches/0004-Add-su-patch.patch +++ b/logging/logrotate/centos/meta_patches/0004-Add-su-patch.patch @@ -1,17 +1,17 @@ -From e07398bb49873b2a273cb1c7b3dc5b781e3f634b Mon Sep 17 00:00:00 2001 +From 6944018ddd79b3b131b91eb1b5e569db5d73e952 Mon Sep 17 00:00:00 2001 From: Don Penney Date: Fri, 19 Jan 2018 23:38:21 -0500 -Subject: [PATCH] Add su patch +Subject: Add su patch --- SPECS/logrotate.spec | 2 ++ 1 file changed, 2 insertions(+) diff --git a/SPECS/logrotate.spec b/SPECS/logrotate.spec -index d67e4bb..84977f6 100644 +index 99a22ac..ba5fa45 100644 --- a/SPECS/logrotate.spec +++ b/SPECS/logrotate.spec -@@ -39,6 +39,7 @@ Patch14: logrotate-3.8.6-su-username.patch +@@ -51,6 +51,7 @@ Patch18: logrotate-3.8.6-upstream-url.patch Patch10001: 0001-createOutputFile-rename-already-existing-file.patch Patch10002: 0002-createOutputFile-eliminate-stat-open-TOCTOU-race.patch @@ -19,7 +19,7 @@ index d67e4bb..84977f6 100644 Requires: coreutils >= 5.92 popt BuildRequires: libselinux-devel popt-devel libacl-devel acl -@@ -75,6 +76,7 @@ log files on your system. +@@ -91,6 +92,7 @@ log files on your system. %patch10001 -p1 %patch10002 -p1 @@ -28,5 +28,5 @@ index d67e4bb..84977f6 100644 %build make %{?_smp_mflags} RPM_OPT_FLAGS="$RPM_OPT_FLAGS" WITH_SELINUX=yes WITH_ACL=yes -- -1.8.3.1 +2.7.4 diff --git a/logging/logrotate/centos/patches/0002-createOutputFile-eliminate-stat-open-TOCTOU-race.patch b/logging/logrotate/centos/patches/0002-createOutputFile-eliminate-stat-open-TOCTOU-race.patch index 2adefcae6..d9e652c8b 100644 --- a/logging/logrotate/centos/patches/0002-createOutputFile-eliminate-stat-open-TOCTOU-race.patch +++ b/logging/logrotate/centos/patches/0002-createOutputFile-eliminate-stat-open-TOCTOU-race.patch @@ -1,17 +1,17 @@ -From aff4a30807218a52b6b5f200c5aa0eea335547ba Mon Sep 17 00:00:00 2001 +From 92b0959366a4677d8ac916cd9246a80853ae4765 Mon Sep 17 00:00:00 2001 From: Kamil Dudka Date: Mon, 17 Oct 2016 17:59:31 +0200 -Subject: [PATCH] createOutputFile: eliminate stat/open TOCTOU race +Subject: createOutputFile: eliminate stat/open TOCTOU race --- logrotate.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/logrotate.c b/logrotate.c -index 10f4b52..79f4755 100644 +index e415164..c4b8e0c 100644 --- a/logrotate.c +++ b/logrotate.c -@@ -366,11 +366,18 @@ static int runScript(struct logInfo *log, char *logfn, char *script) +@@ -394,11 +394,18 @@ static int runScript(struct logInfo *log, char *logfn, char *script) int createOutputFile(char *fileName, int flags, struct stat *sb, acl_type acl, int force_mode) { @@ -32,7 +32,7 @@ index 10f4b52..79f4755 100644 /* the destination file already exists, while it should not */ struct tm now = *localtime(&nowSecs); size_t fileName_size = strlen(fileName); -@@ -384,11 +391,9 @@ int createOutputFile(char *fileName, int flags, struct stat *sb, acl_type acl, i +@@ -412,11 +419,9 @@ int createOutputFile(char *fileName, int flags, struct stat *sb, acl_type acl, i fileName, backupName, strerror(errno)); return -1; } @@ -46,5 +46,5 @@ index 10f4b52..79f4755 100644 message(MESS_ERROR, "error creating output file %s: %s\n", fileName, strerror(errno)); -- -1.8.3.1 +2.7.4