From 2eb74053e9ec5e5e4865f38e32b7b7d6c1350638 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A1draig=20Brady?=
Date: Thu, 3 Aug 2017 21:20:08 -0700 Subject: [PATCH 1/3] tests: avoid false failures on AIX * tests/ln/sf-1.sh: Limit the symlink size to 1MiB to avoid memory exhaustion seen on NFS on AIX, giving: + printf '%0*d' 4294967296 0 + ./tests/ln/sf-1.sh: line 38: printf: warning: 0: Result too large * tests/id/setgid.sh: Skip the test when the adjusted gid would equal 4294967295, as that's reserved on AIX. Reported by Michael Felt. --- tests/id/setgid.sh | 5 +++++ tests/ln/sf-1.sh | 7 ++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/tests/id/setgid.sh b/tests/id/setgid.sh index 61a1d99..09f9eb0 100755 --- a/tests/id/setgid.sh +++ b/tests/id/setgid.sh @@ -20,11 +20,16 @@ print_ver_ id require_root_ +getlimits_ + # Construct a different group number gp1=$NON_ROOT_GID gp1=$(expr $gp1 + 1) || skip_ "failed to adjust GID $NON_ROOT_GID" +test "$gp1" -lt $GID_T_MAX || + skip_ "GID $gp1 is reserved on some systems" + echo $gp1 > exp || framework_failure_ # With coreutils-8.16 and earlier, id -G would print both: diff --git a/tests/ln/sf-1.sh b/tests/ln/sf-1.sh index 149b275..492fce9 100755 --- a/tests/ln/sf-1.sh +++ b/tests/ln/sf-1.sh @@ -33,9 +33,14 @@ esac # Ensure we replace symlinks that don't or can't link to an existing target. # coreutils-8.22 would fail to replace {ENOTDIR,ELOOP,ENAMETOOLONG}_link below. -name_max_plus1=$(expr $(stat -f -c %l .) + 1) +name_max=$(stat -f -c %l .) || skip_ 'Error determining NAME_MAX' +# Apply a limit since AIX returns 2^32-1 which would trigger resource issues. +name_limit=$((1024*1024)) +test "$name_max" -lt "$name_limit" || name_max="$name_limit" +name_max_plus1=$(expr $name_max + 1) test $name_max_plus1 -gt 1 || skip_ 'Error determining NAME_MAX' long_name=$(printf '%0*d' $name_max_plus1 0) + for f in '' f; do ln -s$f missing ENOENT_link || fail=1 ln -s$f a/b ENOTDIR_link || fail=1 -- 2.9.3 From 12e74aa7fd295fe8c658c36f8521502893a0029e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A1draig=20Brady?= Date: Thu, 3 Aug 2017 23:39:26 -0700 Subject: [PATCH 2/3] build: use the appropriate single file include option with xlc * configure.ac: Set USE_XLC_INCLUDE when __xlc__ is defined. * src/local.mk: Use it to select the appropriate include option. Reported by Michael Felt. --- configure.ac | 12 ++++++++++++ src/local.mk | 10 ++++++++-- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 7c7c8c2..d2459ce 100644 --- a/configure.ac +++ b/configure.ac @@ -496,6 +496,18 @@ fi CFLAGS=$ac_save_CFLAGS LDFLAGS=$ac_save_LDFLAGS +# Detect when using xlc to determine whether to use -qinclude= +AC_CACHE_CHECK([whether the system supports xlc include], [utils_cv_xlc], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([[ + #ifndef __xlc__ + #error "not xlc" + #endif + ]])], + [utils_cv_xlc=yes], + [utils_cv_xlc=no])]) +AM_CONDITIONAL([USE_XLC_INCLUDE], [test "$utils_cv_xlc" = yes]) + ############################################################################ dnl Autogenerated by the 'gen-lists-of-programs.sh' auxiliary script. diff --git a/src/local.mk b/src/local.mk index 9b2b172..1cb6859 100644 --- a/src/local.mk +++ b/src/local.mk @@ -397,8 +397,14 @@ src_sha384sum_SOURCES = src/md5sum.c src_sha384sum_CPPFLAGS = -DHASH_ALGO_SHA384=1 $(AM_CPPFLAGS) src_sha512sum_SOURCES = src/md5sum.c src_sha512sum_CPPFLAGS = -DHASH_ALGO_SHA512=1 $(AM_CPPFLAGS) -src_b2sum_CPPFLAGS = -include config.h -DHASH_ALGO_BLAKE2=1 \ - $(AM_CPPFLAGS) +# Include the file on the command line to avoid modifying +# the blake2 upstream source +if USE_XLC_INCLUDE +src_b2sum_CPPFLAGS = -qinclude=config.h +else +src_b2sum_CPPFLAGS = -include config.h +endif +src_b2sum_CPPFLAGS += -DHASH_ALGO_BLAKE2=1 $(AM_CPPFLAGS) src_b2sum_SOURCES = src/md5sum.c \ src/blake2/blake2.h src/blake2/blake2-impl.h \ src/blake2/blake2b-ref.c \ -- 2.9.3 From bfe8dc187c30c01c2b5a965ef5abea1ac304b486 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A1draig=20Brady?= Date: Sun, 23 Jul 2017 03:25:32 -0700 Subject: [PATCH 3/3] kill: fix signal number to name lookup on AIX * src/operand2sig.c (operand2sig): AIX uses a different bit pattern in the returned status from the wait() functions and from shells. Therefore hardcode the selection of the lower bits of the number. * NEWS: Mention the fix. --- NEWS | 4 ++++ src/operand2sig.c | 11 +++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index eb0c0dc..6b6cafd 100644 --- a/NEWS +++ b/NEWS @@ -41,6 +41,10 @@ GNU coreutils NEWS -*- outline -*- Now, it prints a diagnostic or a line to stdout for each argument. [bug introduced in the bourne-shell-to-C rewrite for coreutils-6.11] + kill now converts from number to signal name correctly on AIX. + Previously it would have always returned the 'EXIT' name. + [bug introduced in fileutils-4.1.9] + split no longer exits when invocations of a --filter return EPIPE. [bug introduced in coreutils-8.26] diff --git a/src/operand2sig.c b/src/operand2sig.c index d59ccb9..db5ceea 100644 --- a/src/operand2sig.c +++ b/src/operand2sig.c @@ -53,8 +53,15 @@ operand2sig (char const *operand, char *signame) char *endp; long int l = (errno = 0, strtol (operand, &endp, 10)); int i = l; - signum = (operand == endp || *endp || errno || i != l ? -1 - : WIFSIGNALED (i) ? WTERMSIG (i) : i); + signum = (operand == endp || *endp || errno || i != l ? -1 : i); + + if (signum != -1) + { + /* Note AIX uses a different bit pattern for status returned + from shell and wait(), so we can't use WTERMSIG etc. here. + Also ksh returns 0xFF + signal number. */ + signum &= signum >= 0xFF ? 0xFF : 0x7F; + } } else { -- 2.9.3