From 412c65b502605fd4605c28097b2fb9e95a94303f Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering@fb.com>
Date: Tue, 16 Oct 2018 16:20:49 -0700
Subject: [PATCH 1/2] build: update gnulib to latest; also update bootstrap and
 init.sh

---
 bootstrap     | 22 ++++++----------------
 gnulib        |  2 +-
 tests/init.sh | 23 ++++++++++++++++++-----
 3 files changed, 25 insertions(+), 22 deletions(-)

diff --git a/bootstrap b/bootstrap
index fa9d7c9..5264d9f 100755
--- a/bootstrap
+++ b/bootstrap
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Print a version string.
-scriptversion=2018-07-25.07; # UTC
+scriptversion=2018-10-13.05; # UTC

 # Bootstrap this package from checked-out sources.

@@ -162,18 +162,11 @@ bootstrap_post_import_hook() { :; }
 # Override it via your own definition in bootstrap.conf.
 bootstrap_epilogue() { :; }

-# The command to download all .po files for a specified domain into
-# a specified directory.  Fill in the first %s is the domain name, and
-# the second with the destination directory.  Use rsync's -L and -r
-# options because the latest/%s directory and the .po files within are
-# all symlinks.
+# The command to download all .po files for a specified domain into a
+# specified directory.  Fill in the first %s with the destination
+# directory and the second with the domain name.
 po_download_command_format=\
-"rsync --include '*.po' --exclude '*' -Lrtvz \
- 'translationproject.org::tp/latest/%s/' '%s'"
-
-# Fallback for downloading .po files (if rsync fails).
-po_download_command_format2=\
-"wget --mirror -nd -q -np -A.po -P '%s' \
+"wget --mirror --level=1 -nd -q -A.po -P '%s' \
  https://translationproject.org/latest/%s/"

 # Prefer a non-empty tarname (4th argument of AC_INIT if given), else
@@ -741,10 +734,7 @@ download_po_files() {
   subdir=$1
   domain=$2
   echo "$me: getting translations into $subdir for $domain..."
-  cmd=$(printf "$po_download_command_format" "$domain" "$subdir")
-  eval "$cmd" && return
-  # Fallback to HTTPS.
-  cmd=$(printf "$po_download_command_format2" "$subdir" "$domain")
+  cmd=$(printf "$po_download_command_format" "$subdir" "$domain")
   eval "$cmd"
 }

diff --git a/gnulib b/gnulib
index 0782fa4..a79f2a2 160000
--- a/gnulib
+++ b/gnulib
@@ -1 +1 @@
-Subproject commit 0782fa4dc036a709d5501a8712c5331489c28be9
+Subproject commit a79f2a2871a063a35e7865f1269ae15576f23419
diff --git a/tests/init.sh b/tests/init.sh
index d37f157..93d14f5 100644
--- a/tests/init.sh
+++ b/tests/init.sh
@@ -62,6 +62,19 @@

 ME_=`expr "./$0" : '.*/\(.*\)$'`

+# Prepare PATH_SEPARATOR.
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+  # Determine PATH_SEPARATOR by trying to find /bin/sh in a PATH which
+  # contains only /bin. Note that ksh looks also at the FPATH variable,
+  # so we have to set that as well for the test.
+  PATH_SEPARATOR=:
+  (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \
+    && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \
+           || PATH_SEPARATOR=';'
+       }
+fi
+
 # We use a trap below for cleanup.  This requires us to go through
 # hoops to get the right exit status transported through the handler.
 # So use 'Exit STATUS' instead of 'exit STATUS' inside of the tests.
@@ -250,7 +263,7 @@ test -n "$BASH_VERSION" && unalias -a
 # That is part of the shell-selection test above.  Why use aliases rather
 # than functions?  Because support for hyphen-containing aliases is more
 # widespread than that for hyphen-containing function names.
-test -n "$EXEEXT" && shopt -s expand_aliases
+test -n "$EXEEXT" && test -n "$BASH_VERSION" && shopt -s expand_aliases

 # Enable glibc's malloc-perturbing option.
 # This is useful for exposing code that depends on the fact that
@@ -429,13 +442,13 @@ path_prepend_ ()
     path_dir_=$1
     case $path_dir_ in
       '') fail_ "invalid path dir: '$1'";;
-      /*) abs_path_dir_=$path_dir_;;
+      /* | ?:*) abs_path_dir_=$path_dir_;;
       *) abs_path_dir_=$initial_cwd_/$path_dir_;;
     esac
     case $abs_path_dir_ in
-      *:*) fail_ "invalid path dir: '$abs_path_dir_'";;
+      *$PATH_SEPARATOR*) fail_ "invalid path dir: '$abs_path_dir_'";;
     esac
-    PATH="$abs_path_dir_:$PATH"
+    PATH="$abs_path_dir_$PATH_SEPARATOR$PATH"

     # Create an alias, FOO, for each FOO.exe in this directory.
     create_exe_shims_ "$abs_path_dir_" \
@@ -514,7 +527,7 @@ rand_bytes_ ()
   fi

   n_plus_50_=`expr $n_ + 50`
-  cmds_='date; date +%N; free; who -a; w; ps auxww; ps ef; netstat -n'
+  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_
-- 
2.18.0


From 30e666ca22eaa7e69330ca46201e40f1cdb0f41e Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering@fb.com>
Date: Tue, 16 Oct 2018 17:13:04 -0700
Subject: [PATCH 2/2] tests: reduce the sole failing test

* tests/backref-alt: Significantly reduce abort-inducing input.
---
 tests/backref-alt | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/tests/backref-alt b/tests/backref-alt
index c87f29e..91c01b2 100755
--- a/tests/backref-alt
+++ b/tests/backref-alt
@@ -24,9 +24,10 @@ grep -E '0|()0|\1|0' in >out
 status=$?
 test $status -eq 2 || test $status -eq 1 || fail=1

-# This fuzz test comes from Bug#27838.
-printf '\1772{\177)\216\216\n\216\216\t\0372{\177)(\037W3|\244\\\220)\0373|d{\244k\220)\0373|(|2{\177)(\037W3|\244\\\220)\0373|d{\244k\220)\0373|d{\220)(\013\0373|2{\177)\216\255\t\216\216\t\0373|$\\2\n' >pat
-LC_ALL=C grep -E -f pat in >out
+# This test is a reduced version of the one in Bug#27838.
+# It triggers this glibc assertion failure:
+# grep: regexec.c:1342: pop_fail_stack: Assertion `num >= 0' failed.
+LC_ALL=C grep -E '(()x)|\2' in > out
 status=$?
 test $status -eq 2 || test $status -eq 1 || fail=1

-- 
2.18.0

