[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] init.sh: accomodate directory with no .exes
From: |
Jim Meyering |
Subject: |
Re: [PATCH] init.sh: accomodate directory with no .exes |
Date: |
Sat, 18 Sep 2010 09:06:59 +0200 |
Eric Blake wrote:
> Cygwin was failing test-vc-list-files-{cvs,git}.sh, because of
> spurious output on stderr.
>
> ../../tests/test-vc-list-files-cvs.sh (exe_shim): skipping directory:
> /home/eblake/m4-branch/build-aux
>
> All because build-aux was a directory containing just scripts, and
> no .exe extensions. This fixes it.
>
> * tests/init.sh: Accomodate directory containing only scripts.
Thanks.
I've added a comment and a fix for an implausible malfunction.
>From ded759c27923c3173ca8dc8c5390f7246a2cc8ba Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Sat, 18 Sep 2010 08:33:23 +0200
Subject: [PATCH 1/2] init.sh: don't let an ephemeral "*.exe" make us skip all
dir entries
Not that it's likely to happen, but if I were to remove from a PATH
directory a file named "*.exe" (yes, starting with an asterisk),
at just the right moment, it would have made init.sh ignore all
remaining .exe-suffixed names in that directory.
* tests/init.sh (find_exe_basenames_): Don't give up on a directory if
a file named "*.exe" is removed between the glob expansion and the
processing of that oddly named file.
---
ChangeLog | 7 +++++++
tests/init.sh | 8 +++++---
2 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 9f180a0..4caca7c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2010-09-18 Jim Meyering <address@hidden>
+
+ init.sh: don't let an ephemeral "*.exe" make us skip all dir entries
+ * tests/init.sh (find_exe_basenames_): Don't give up on a directory if
+ a file named "*.exe" is removed between the glob expansion and the
+ processing of that oddly named file.
+
2010-09-17 Eric Blake <address@hidden>
mirbsd: add some more support
diff --git a/tests/init.sh b/tests/init.sh
index d655fbb..20357ce 100644
--- a/tests/init.sh
+++ b/tests/init.sh
@@ -240,9 +240,11 @@ find_exe_basenames_()
feb_result_=
feb_sp_=
for feb_file_ in $feb_dir_/*.exe; do
- if test "x$feb_file_" = "x$feb_dir_/*.exe" && test ! -f "$feb_file_"; then
- return 0
- fi
+ # If there was no *.exe file, or there existed a file named "*.exe" that
+ # was deleted between the above glob expansion and the existence test
+ # below, just skip it.
+ test "x$feb_file_" = "x$feb_dir_/*.exe" && test ! -f "$feb_file_" \
+ && continue
case $feb_file_ in
*[!-a-zA-Z/0-9_.+]*) feb_fail_=1; break;;
*) # Remove leading file name components as well as the .exe suffix.
--
1.7.3.rc2.221.gbf93f
>From 441c6ed3f59c562c7ff1bb736345172e2173505e Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Sat, 18 Sep 2010 08:49:55 +0200
Subject: [PATCH 2/2] init.sh: correct an outdated comment
* tests/init.sh (create_exe_shims_): s/function/alias/
---
ChangeLog | 3 +++
tests/init.sh | 2 +-
2 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 4caca7c..86277d6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
2010-09-18 Jim Meyering <address@hidden>
+ init.sh: correct an outdated comment
+ * tests/init.sh (create_exe_shims_): s/function/alias/
+
init.sh: don't let an ephemeral "*.exe" make us skip all dir entries
* tests/init.sh (find_exe_basenames_): Don't give up on a directory if
a file named "*.exe" is removed between the glob expansion and the
diff --git a/tests/init.sh b/tests/init.sh
index 20357ce..a57de77 100644
--- a/tests/init.sh
+++ b/tests/init.sh
@@ -262,7 +262,7 @@ find_exe_basenames_()
# For each file name of the form PROG.exe, create an alias named
# PROG that simply invokes PROG.exe, then return 0. If any selected
# file name or the directory name, $1, contains an unexpected character,
-# define no function and return 1.
+# define no alias and return 1.
create_exe_shims_()
{
case $EXEEXT in
--
1.7.3.rc2.221.gbf93f