From 4f395dd42db2c2f6582ac6b1be90c138e090e09f Mon Sep 17 00:00:00 2001 From: ipedrosa Date: Mon, 9 Nov 2020 10:53:20 +0100 Subject: [PATCH] commonio: force lock file sync (#1862056) --- ...-4.8.1-commonio-force-lock-file-sync.patch | 39 +++++++++++++++++++ shadow-utils.spec | 11 +++++- 2 files changed, 48 insertions(+), 2 deletions(-) create mode 100644 shadow-4.8.1-commonio-force-lock-file-sync.patch diff --git a/shadow-4.8.1-commonio-force-lock-file-sync.patch b/shadow-4.8.1-commonio-force-lock-file-sync.patch new file mode 100644 index 0000000..5ca7b53 --- /dev/null +++ b/shadow-4.8.1-commonio-force-lock-file-sync.patch @@ -0,0 +1,39 @@ +From fb0f702cbf958a5ee9097c1611212c9880b347ce Mon Sep 17 00:00:00 2001 +From: ikerexxe +Date: Mon, 2 Nov 2020 17:08:55 +0100 +Subject: [PATCH] commonio: force lock file sync + +lib/commonio.c: after writing to the lock file, force a file sync to +the storage system. + +Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1862056 +--- + lib/commonio.c | 12 +++++++++++- + 1 file changed, 11 insertions(+), 1 deletion(-) + +diff --git a/lib/commonio.c b/lib/commonio.c +index 16fa7e75..c5b3d104 100644 +--- a/lib/commonio.c ++++ b/lib/commonio.c +@@ -157,7 +157,17 @@ static int do_lock_file (const char *file, const char *lock, bool log) + if (write (fd, buf, (size_t) len) != len) { + if (log) { + (void) fprintf (stderr, +- "%s: %s: %s\n", ++ "%s: %s file write error: %s\n", ++ Prog, file, strerror (errno)); ++ } ++ (void) close (fd); ++ unlink (file); ++ return 0; ++ } ++ if (fdatasync (fd) == -1) { ++ if (log) { ++ (void) fprintf (stderr, ++ "%s: %s file sync error: %s\n", + Prog, file, strerror (errno)); + } + (void) close (fd); +-- +2.26.2 + diff --git a/shadow-utils.spec b/shadow-utils.spec index 3367171..9c45824 100644 --- a/shadow-utils.spec +++ b/shadow-utils.spec @@ -1,7 +1,7 @@ Summary: Utilities for managing accounts and shadow password files Name: shadow-utils Version: 4.8.1 -Release: 5%{?dist} +Release: 6%{?dist} Epoch: 2 URL: http://pkg-shadow.alioth.debian.org/ Source0: https://github.com/shadow-maint/shadow/releases/download/%{version}/shadow-%{version}.tar.xz @@ -53,8 +53,11 @@ Patch40: shadow-4.8-ignore-login-prompt.patch Patch42: shadow-4.8-useradd-selinux-mail.patch # Clarify useradd man regarding "-d" parameter - already upstreamed Patch43: shadow-4.8.1-useradd-man-clarification.patch -# Upstreamed +# https://github.com/shadow-maint/shadow/commit/140510de9de4771feb3af1d859c09604043a4c9b +# https://github.com/shadow-maint/shadow/commit/8762f465d487a52bf68f9c0b7c3c1eb3caea7bc9 Patch44: shadow-4.8.1-check-local-groups.patch +# https://github.com/shadow-maint/shadow/commit/599cc003daf833bffdc9cbe0d33dc8b3e7ec74c8 +Patch45: shadow-4.8.1-commonio-force-lock-file-sync.patch License: BSD and GPLv2+ BuildRequires: gcc @@ -106,6 +109,7 @@ are used for managing group accounts. %patch42 -p1 -b .useradd-selinux-mail %patch43 -p1 -b .useradd-man-clarification %patch44 -p1 -b .check-local-groups +%patch45 -p1 -b .commonio-force-lock-file-sync iconv -f ISO88591 -t utf-8 doc/HOWTO > doc/HOWTO.utf8 cp -f doc/HOWTO.utf8 doc/HOWTO @@ -261,6 +265,9 @@ done %{_mandir}/man8/vigr.8* %changelog +* Mon Nov 9 2020 Iker Pedrosa - 2:4.8.1-6 +- commonio: force lock file sync (#1862056) + * Tue Nov 3 2020 Petr Lautrbach - 2:4.8.1-5 - Rebuild with libsemanage.so.2