aboutsummaryrefslogtreecommitdiffstats
path: root/coreutils-8.32-aarch64_fixes-1.patch
blob: ca50f32eeef24d9c634d27fdd1c8861ae2be4de8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
diff -Naur coreutils-8.32.orig/src/ls.c coreutils-8.32/src/ls.c
--- coreutils-8.32.orig/src/ls.c	2020-03-01 12:30:46.000000000 +0000
+++ coreutils-8.32/src/ls.c	2021-04-18 13:14:13.298181255 +0000
@@ -49,10 +49,6 @@
 # include <sys/ptem.h>
 #endif
 
-#ifdef __linux__
-# include <sys/syscall.h>
-#endif
-
 #include <stdio.h>
 #include <assert.h>
 #include <setjmp.h>
@@ -2896,7 +2892,6 @@
   struct dirent *next;
   uintmax_t total_blocks = 0;
   static bool first = true;
-  bool found_any_entries = false;
 
   errno = 0;
   dirp = opendir (name);
@@ -2972,7 +2967,6 @@
       next = readdir (dirp);
       if (next)
         {
-          found_any_entries = true;
           if (! file_ignored (next->d_name))
             {
               enum filetype type = unknown;
@@ -3018,22 +3012,6 @@
           if (errno != EOVERFLOW)
             break;
         }
-#ifdef __linux__
-      else if (! found_any_entries)
-        {
-          /* If readdir finds no directory entries at all, not even "." or
-             "..", then double check that the directory exists.  */
-          if (syscall (SYS_getdents, dirfd (dirp), NULL, 0) == -1
-              && errno != EINVAL)
-            {
-              /* We exclude EINVAL as that pertains to buffer handling,
-                 and we've passed NULL as the buffer for simplicity.
-                 ENOENT is returned if appropriate before buffer handling.  */
-              file_failure (command_line_arg, _("reading directory %s"), name);
-            }
-          break;
-        }
-#endif
       else
         break;
 
diff -Naur coreutils-8.32.orig/tests/ls/removed-directory.sh coreutils-8.32/tests/ls/removed-directory.sh
--- coreutils-8.32.orig/tests/ls/removed-directory.sh	2020-02-27 13:50:28.000000000 +0000
+++ coreutils-8.32/tests/ls/removed-directory.sh	2021-04-18 13:16:54.181279118 +0000
@@ -1,7 +1,7 @@
 #!/bin/sh
 # If ls is asked to list a removed directory (e.g. the parent process's
-# current working directory that has been removed by another process), it
-# emits an error message.
+# current working directory has been removed by another process), it
+# should not emit an error message merely because the directory is removed.
 
 # Copyright (C) 2020 Free Software Foundation, Inc.
 
@@ -21,25 +21,14 @@
 . "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
 print_ver_ ls
 
-case $host_triplet in
-  *linux*) ;;
-  *) skip_ 'non linux kernel' ;;
-esac
-
-LS_FAILURE=2
-
-cat <<\EOF >exp-err || framework_failure_
-ls: reading directory '.': No such file or directory
-EOF
-
 cwd=$(pwd)
 mkdir d || framework_failure_
 cd d || framework_failure_
-rmdir ../d || framework_failure_
+rmdir ../d || skip_ "can't remove working directory on this platform"
 
-returns_ $LS_FAILURE ls >../out 2>../err || fail=1
+ls >../out 2>../err || fail=1
 cd "$cwd" || framework_failure_
 compare /dev/null out || fail=1
-compare exp-err err || fail=1
+compare /dev/null err || fail=1
 
 Exit $fail