[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] tests/test-xalloc-die.sh: Use $EXEEXT.

From: Jim Meyering
Subject: Re: [PATCH] tests/test-xalloc-die.sh: Use $EXEEXT.
Date: Thu, 14 Jan 2010 14:46:10 +0100

Eric Blake wrote:
> According to Jim Meyering on 1/14/2010 1:08 AM:
>> Think of a set-up function that (when $EXEEXT is nonempty)
>> iterates through the *.$EXEEXT executables in a specified directory...
>> create_exe_shim_functions ()
>> {
>>   case $EXEEXT in
>>     '') return 0 ;;
>>     .exe) ;;
>>     *) echo "$0: unexpected value of $EXEEXT" 1>&2; return 1 ;;
>>   esac
> So we still have to pass EXEEXT through TESTS_ENVIRONMENT in
> modules/*-tests for any test that uses a .sh file.  But other than that,
> all of our tests-*.sh no longer need to worry about EXEEXT, once they've
> been converted to use init.sh.  I like it.
> Or go one step further, do the search for *.exe without regards to
> $EXEEXT, skipping this case block, and simplifying modules/*-tests.

I like the idea of not having to modify all modules/*-tests, but have
two reservations:
  - I like having no shim-eval overhead when $EXEEXT is empty.
  - What if a script were to run something named foo.exe _in unix land_?
    Then if there is also a "foo" executable in that directory, it would
    mistakenly run "foo" via our shim that creates a foo.exe *function*.

An alternative would be to make gnulib-tool always add EXEEXT.

>>     # Remove the .$EXEEXT suffix.
>>     base=${file%.$EXEEXT}
> This is not portable to Solaris /bin/sh.  Unless we take the same measures
> as coreutils to ensure a (mostly) POSIX-compliant shell, I think we are
> better off using only features supported by common /bin/sh.

Good point.  Not worth it.

  base=$(echo "$file" | sed "s/$EXEEXT//")

reply via email to

[Prev in Thread] Current Thread [Next in Thread]