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

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