Skip to content
This repository has been archived by the owner on Oct 11, 2021. It is now read-only.

Commit

Permalink
Add coreutils with patch.
Browse files Browse the repository at this point in the history
  • Loading branch information
jedavies-dev committed Mar 13, 2020
1 parent 63c26cc commit 9a7272f
Show file tree
Hide file tree
Showing 5 changed files with 100 additions and 0 deletions.
11 changes: 11 additions & 0 deletions community/coreutils/build
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/sh -e

patch -p0 < ls.patch

export CFLAGS="$CFLAGS -static"

./configure \
--prefix=/usr

make
make DESTDIR="$1" install
2 changes: 2 additions & 0 deletions community/coreutils/checksums
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
4458d8de7849df44ccab15e16b1548b285224dbba5f08fac070c1c0e0bcc4cfa coreutils-8.32.tar.xz
b333ebef4bce552c6666c88e2a7507ce73d2cef24b7583625db7c933a4e3556e ls.patch
84 changes: 84 additions & 0 deletions community/coreutils/patches/ls.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
diff --git src/ls.c src/ls.c
index 24b983287..4acf5f44d 100644
--- src/ls.c
+++ src/ls.c
@@ -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 @@ print_dir (char const *name, char const *realname, bool command_line_arg)
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 @@ print_dir (char const *name, char const *realname, bool command_line_arg)
next = readdir (dirp);
if (next)
{
- found_any_entries = true;
if (! file_ignored (next->d_name))
{
enum filetype type = unknown;
@@ -3018,22 +3012,6 @@ print_dir (char const *name, char const *realname, bool command_line_arg)
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 --git tests/ls/removed-directory.sh tests/ls/removed-directory.sh
index e8c835dab..fe8f929a1 100755
--- tests/ls/removed-directory.sh
+++ tests/ls/removed-directory.sh
@@ -26,20 +26,14 @@ case $host_triplet in
*) 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_

-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
--
2.24.0.375.geb5ae68d41

2 changes: 2 additions & 0 deletions community/coreutils/sources
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
https://ftp.gnu.org/gnu/coreutils/coreutils-8.32.tar.xz
patches/ls.patch
1 change: 1 addition & 0 deletions community/coreutils/version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
8.32 1

0 comments on commit 9a7272f

Please sign in to comment.