OpenCoverageCoreutils

Coreutils patch #12 - Test report of the modifications

Overview

Test Execution StatusStatistics
Passed
  0.000% (0/108)
Failed
  0.000% (0/108)
Requires Manual Checking
  0.000% (0/108)
Unknown
  0.926% (1/108)
All
  0.926% (1/108)
CategoryRemoved LinesInserted LinesTotal
Modified lines executed:
 50.000% (2/4)
 18.182% (4/22)
 23.077% (6/26)
Modified lines not executed:
 25.000% (1/4)
 13.636% (3/22)
 15.385% (4/26)
Source code lines not covered:
 25.000% (1/4)
 68.182% (15/22)
 61.538% (16/26)

List of tests executing the changes

Execution NameState
cpUnknown

Patch File

Showing: 

Modified File: NEWS

LineTestsDifference Output
diff --git a/NEWS b/NEWS
index 8a9e09eb4..5fa69285d 100644
--- a/NEWS
+++ b/NEWS
@@ -16,6 +16,11 @@ GNU coreutils NEWS -*- outline -*-
16 that caused -u to sometimes override -n.
17 [bug introduced with coreutils-7.1]
18
19
-
+ 'cp -a --no-preserve=mode' now sets appropriate default permissions
20
-
+ for non regular files like fifos and character device nodes etc.
21
-
+ Previously it would have set executable bits on created special files.
22
-
+ [bug introduced with coreutils-8.20]
23
-
+
19 ➡ 24
20 ➡ 25 * Noteworthy changes in release 8.29 (2017-12-27) [stable]
21 ➡ 26

Modified File: src/copy.c

LineTestsDifference Output
diff --git a/src/copy.c b/src/copy.c
index e050d4199..4998c83e6 100644
--- a/src/copy.c
+++ b/src/copy.c
@@ -1353,7 +1353,10 @@ preserve_metadata:
1353 bool access_changed = false;
1354
1355 if (!(sb.st_mode & S_IWUSR) && geteuid () != ROOT_UID)
1356
0
- access_changed = fchmod_or_lchmod (dest_desc, dst_name, 0600) == 0;
1356
-
+ {
1357
0
+ access_changed = fchmod_or_lchmod (dest_desc, dst_name,
1358
0
+ S_IRUSR | S_IWUSR) == 0;
1359
0
+ }
1357 ➡ 1360
1358 ➡ 1361 if (!copy_attr (src_name, source_desc, dst_name, dest_desc, x)
1359 ➡ 1362 && x->require_preserve_xattr)
@@ -1378,7 +1381,7 @@ preserve_metadata:
1378 ➡ 1381 }
1379 ➡ 1382 else if (x->explicit_no_preserve_mode)
1380 ➡ 1383 {
1381
1
Executed by:
  • cp
- if (set_acl (dst_name, dest_desc, 0666 & ~cached_umask ()) != 0)
1384
1
Executed by:
  • cp
+ if (set_acl (dst_name, dest_desc, MODE_RW_UGO & ~cached_umask ()) != 0)
1382 ➡ 1385 return_val = false;
1383 ➡ 1386 }
1384 ➡ 1387 else if (omitted_permissions)
@@ -2860,7 +2863,9 @@ copy_internal (char const *src_name, char const *dst_name,
2860 ➡ 2863 }
2861 ➡ 2864 else if (x->explicit_no_preserve_mode)
2862 ➡ 2865 {
2863
1
Executed by:
  • cp
- if (set_acl (dst_name, -1, 0777 & ~cached_umask ()) != 0)
2866
1
Executed by:
  • cp
+ int default_permissions = S_ISDIR (src_mode) || S_ISSOCK (src_mode)
2867
1
Executed by:
  • cp
+ ? S_IRWXUGO : MODE_RW_UGO;
2868
1
Executed by:
  • cp
+ if (set_acl (dst_name, -1, default_permissions & ~cached_umask ()) != 0)
2864 ➡ 2869 return false;
2865 ➡ 2870 }
2866 ➡ 2871 else

Modified File: tests/cp/preserve-mode.sh

LineTestsDifference Output
diff --git a/tests/cp/preserve-mode.sh b/tests/cp/preserve-mode.sh
index 1cd173a6c..3b0aca8e7 100755
--- a/tests/cp/preserve-mode.sh
+++ b/tests/cp/preserve-mode.sh
@@ -19,7 +19,7 @@
19 . "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
20 print_ver_ cp
21
22
-
No equivalent source code line in the reference code can be identified.
-get_mode() { ls -ld "$1" | cut -b-10; }
22
-
+get_mode() { stat -c%f "$1"; }
23
24 rm -f a b c
25 umask 0022
@@ -47,4 +47,12 @@ chmod 600 a
47 cp --no-preserve=mode --preserve=all a b || fail=1
48 test "$(get_mode a)" = "$(get_mode b)" || fail=1
49
50
-
+#fifo test
51
-
+if mkfifo fifo; then
52
-
+ cp -a --no-preserve=mode fifo fifo_copy || fail=1
53
-
+ #ensure default perms set appropriate for non regular files
54
-
+ #which wasn't done between v8.20 and 8.29 inclusive
55
-
+ test "$(get_mode fifo)" = "$(get_mode fifo_copy)" || fail=1
56
-
+fi
57
-
+
50 ➡ 58 Exit $fail

Generated by Squish Coco 4.1.2