Blame SOURCES/coreutils-8.30-fsync-fallback.patch

f5e30c
From 2eabfbee57be82f755c74cbb05755dce1469ea7c Mon Sep 17 00:00:00 2001
f5e30c
From: Paul Eggert <eggert@cs.ucla.edu>
f5e30c
Date: Tue, 6 Nov 2018 10:35:16 -0800
f5e30c
Subject: [PATCH 1/2] sync: fix open fallback bug
f5e30c
f5e30c
Problem caught by Coverity Analysis
f5e30c
and reported by Kamil Dudka (Bug#33287).
f5e30c
* src/sync.c (sync_arg): Fix typo in fallback code.
f5e30c
f5e30c
Upstream-commit: 94d364f157f007f2b23c70863ac8eefe9b21229d
f5e30c
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
f5e30c
---
f5e30c
 src/sync.c | 6 ++++--
f5e30c
 1 file changed, 4 insertions(+), 2 deletions(-)
f5e30c
f5e30c
diff --git a/src/sync.c b/src/sync.c
f5e30c
index bd3671a..607fa8f 100644
f5e30c
--- a/src/sync.c
f5e30c
+++ b/src/sync.c
f5e30c
@@ -111,8 +111,10 @@ sync_arg (enum sync_mode mode, char const *file)
f5e30c
       if (open_flags != (O_WRONLY | O_NONBLOCK))
f5e30c
         fd = open (file, O_WRONLY | O_NONBLOCK);
f5e30c
       if (fd < 0)
f5e30c
-        error (0, rd_errno, _("error opening %s"), quoteaf (file));
f5e30c
-      return false;
f5e30c
+        {
f5e30c
+          error (0, rd_errno, _("error opening %s"), quoteaf (file));
f5e30c
+          return false;
f5e30c
+        }
f5e30c
     }
f5e30c
 
f5e30c
   /* We used O_NONBLOCK above to not hang with fifos,
f5e30c
-- 
f5e30c
2.17.2
f5e30c
f5e30c
f5e30c
From e62ff3068f1f1b1e84d3319f54f1b869bb0bf6cc Mon Sep 17 00:00:00 2001
f5e30c
From: Bernhard Voelker <mail@bernhard-voelker.de>
f5e30c
Date: Wed, 7 Nov 2018 00:26:01 +0100
f5e30c
Subject: [PATCH 2/2] sync: add test for the fix in the previous commit
f5e30c
f5e30c
* tests/misc/sync.sh: Add a test with a write-only file for the fix.
f5e30c
f5e30c
Upstream-commit: 4711c49312d54e84996c13c612f7081c95f821a6
f5e30c
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
f5e30c
---
f5e30c
 tests/misc/sync.sh | 7 ++++++-
f5e30c
 1 file changed, 6 insertions(+), 1 deletion(-)
f5e30c
f5e30c
diff --git a/tests/misc/sync.sh b/tests/misc/sync.sh
f5e30c
index f60d28c..3bb6e17 100755
f5e30c
--- a/tests/misc/sync.sh
f5e30c
+++ b/tests/misc/sync.sh
f5e30c
@@ -19,7 +19,7 @@
f5e30c
 . "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
f5e30c
 print_ver_ sync
f5e30c
 
f5e30c
-touch file
f5e30c
+touch file || framework_failure_
f5e30c
 
f5e30c
 # fdatasync+syncfs is nonsensical
f5e30c
 returns_ 1 sync --data --file-system || fail=1
f5e30c
@@ -30,6 +30,11 @@ returns_ 1 sync -d || fail=1
f5e30c
 # Test syncing of file (fsync) (little side effects)
f5e30c
 sync file || fail=1
f5e30c
 
f5e30c
+# Test syncing of write-only file - which failed since adding argument
f5e30c
+# support to sync in coreutils-8.24.
f5e30c
+chmod 0200 file || framework_failure_
f5e30c
+sync file || fail=1
f5e30c
+
f5e30c
 # Ensure multiple args are processed and diagnosed
f5e30c
 returns_ 1 sync file nofile || fail=1
f5e30c
 
f5e30c
-- 
f5e30c
2.17.2
f5e30c