From 399a65a837fe4023e5fbd3221456dbdc72f76a58 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Mon, 4 Apr 2022 11:52:16 -0700 Subject: [PATCH 3/3] maint: update from Gnulib * bootstrap, tests/init.sh: Copy manually from current Gnulib. * lib/.gitignore, m4/.gitignore: Update as per current Gnulib. --- bootstrap | 25 +++++++++++++++++++++---- lib/.gitignore | 4 ++-- m4/.gitignore | 1 - tests/init.sh | 43 ++++++++++++++++++++++++------------------- 4 files changed, 47 insertions(+), 26 deletions(-) diff --git a/bootstrap b/bootstrap index 9658861..9c14d24 100755 --- a/bootstrap +++ b/bootstrap @@ -1,6 +1,6 @@ #! /bin/sh # Print a version string. -scriptversion=2021-04-11.09; # UTC +scriptversion=2022-03-21.01; # UTC # Bootstrap this package from checked-out sources. @@ -763,9 +763,26 @@ if $use_gnulib; then shallow= if test -z "$GNULIB_REVISION"; then git clone -h 2>&1 | grep -- --depth > /dev/null && shallow='--depth 2' + git clone $shallow ${GNULIB_URL:-$default_gnulib_url} "$gnulib_path" \ + || cleanup_gnulib + else + git fetch -h 2>&1 | grep -- --depth > /dev/null && shallow='--depth 2' + mkdir -p "$gnulib_path" + # Only want a shallow checkout of $GNULIB_REVISION, but git does not + # support cloning by commit hash. So attempt a shallow fetch by commit + # hash to minimize the amount of data downloaded and changes needed to + # be processed, which can drastically reduce download and processing + # time for checkout. If the fetch by commit fails, a shallow fetch can + # not be performed because we do not know what the depth of the commit + # is without fetching all commits. So fallback to fetching all commits. + git -C "$gnulib_path" init + git -C "$gnulib_path" remote add origin \ + ${GNULIB_URL:-$default_gnulib_url} + git -C "$gnulib_path" fetch $shallow origin "$GNULIB_REVISION" \ + || git -C "$gnulib_path" fetch origin \ + || cleanup_gnulib + git -C "$gnulib_path" reset --hard FETCH_HEAD fi - git clone $shallow ${GNULIB_URL:-$default_gnulib_url} "$gnulib_path" \ - || cleanup_gnulib trap - 1 2 13 15 fi @@ -1093,7 +1110,7 @@ bootstrap_epilogue echo "$0: done. Now you can run './configure'." -# Local variables: +# Local Variables: # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" diff --git a/lib/.gitignore b/lib/.gitignore index 293641f..151d30f 100644 --- a/lib/.gitignore +++ b/lib/.gitignore @@ -75,7 +75,6 @@ /fseterr.c /fseterr.h /fstat.c -/fstatat.c /fsync.c /ftell.c /ftello.c @@ -181,7 +180,6 @@ /stat-w32.c /stat-w32.h /stat.c -/statat.c /stdalign.in.h /stdbool.h /stdbool.in.h @@ -190,6 +188,8 @@ /stdint.h /stdint.in.h /stdio-impl.h +/stdio-read.c +/stdio-write.c /stdio.h /stdio.in.h /stdlib.h diff --git a/m4/.gitignore b/m4/.gitignore index 644d6c9..c87d1ae 100644 --- a/m4/.gitignore +++ b/m4/.gitignore @@ -43,7 +43,6 @@ /fseeko.m4 /fseterr.m4 /fstat.m4 -/fstatat.m4 /fsync.m4 /ftell.m4 /ftello.m4 diff --git a/tests/init.sh b/tests/init.sh index 933fdd4..d5d37c9 100644 --- a/tests/init.sh +++ b/tests/init.sh @@ -271,12 +271,10 @@ test -n "$EXEEXT" && test -n "$BASH_VERSION" && shopt -s expand_aliases # # First, try to use the mktemp program. # Failing that, we'll roll our own mktemp-like function: -# - try to get random bytes from /dev/urandom +# - try to get random bytes from /dev/urandom, mapping them to file-name bytes # - failing that, generate output from a combination of quickly-varying -# sources and gzip. Ignore non-varying gzip header, and extract -# "random" bits from there. -# - given those bits, map to file-name bytes using tr, and try to create -# the desired directory. +# sources and awk. +# - try to create the desired directory. # - make only $MAX_TRIES_ attempts # Helper function. Print $N pseudo-random bytes from a-zA-Z0-9. @@ -296,20 +294,27 @@ rand_bytes_ () return fi - n_plus_50_=`expr $n_ + 50` - cmds_='date; date +%N; free; who -a; w; ps auxww; ps -ef' - data_=` (eval "$cmds_") 2>&1 | gzip ` - - # Ensure that $data_ has length at least 50+$n_ - while :; do - len_=`echo "$data_"|wc -c` - test $n_plus_50_ -le $len_ && break; - data_=` (echo "$data_"; eval "$cmds_") 2>&1 | gzip ` - done - - echo "$data_" \ - | dd bs=1 skip=50 count=$n_ 2>/dev/null \ - | LC_ALL=C tr -c $chars_ 01234567$chars_$chars_$chars_ + # Fall back on quickly-varying sources + awk. + # Limit awk program to 7th Edition Unix so that it works even on Solaris 10. + + (date; date +%N; free; who -a; w; ps auxww; ps -ef) 2>&1 | awk ' + BEGIN { + n = '"$n_"' + for (i = 0; i < 256; i++) + ordinal[sprintf ("%c", i)] = i + } + { + for (i = 1; i <= length; i++) + a[ai++ % n] += ordinal[substr ($0, i, 1)] + } + END { + chars = "'"$chars_"'" + charslen = length (chars) + for (i = 0; i < n; i++) + printf "%s", substr (chars, a[i] % charslen + 1, 1) + printf "\n" + } + ' } mktempd_ () -- 2.32.0