On Saturday 15 January 2011, Ralf Wildenhues wrote: > I'm seeing a couple of weird issues on MinGW/MSYS. > First of all, several spurious failures of this kind: > > ./defs: line 33: /bin/sed: Resource temporarily unavailable > > The line in question is: > me=`echo "$argv0" | sed -e 's,.*[\\/],,;s/\.test$//'` > > This is on a loaded system, but I don't remember having seen this before > at all. So I wonder what actually causes this behavior. There is also > a stack dump from some sed invocation, so maybe my installation is > corrupted. > > Anyway, the above causes all kinds of ugly misbehavior, starting with > all tests being run in the same directory '.dir', and several tests > failing because 'make dist' tries to 'mkdir -1', as $(PACKAGE) is > empty. > > I'm merging the following as a stop-gap measure, to at least make the > behavior obvious. And I'm going to review Stefano's pending tests-init > patches next, as they address a number of related issues around this > area. > > Cheers, > Ralf > > tests: avoid spurious failures due to fork failure in test setup > > * tests/defs: Ensure $me is always nonempty, to avoid spurious > failures on MinGW/MSYS in case the preceding sed command could > not be spawned. > > diff --git a/tests/defs b/tests/defs > index 64ed985..0f84d0a 100644 > --- a/tests/defs > +++ b/tests/defs > @@ -1,7 +1,8 @@ > # -*- shell-script -*- > # > # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, > -# 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. > +# 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, > +# Inc. > # > # This program is free software; you can redistribute it and/or modify > # it under the terms of the GNU General Public License as published by > @@ -31,6 +32,7 @@ test -f ./defs-static || { > > # The name of the current test (without the `.test' suffix.) > me=`echo "$argv0" | sed -e 's,.*[\\/],,;s/\.test$//'` > +test -n "$me" || exit 99 > A agree with your change, but I'd definitely add a comment (extracted from your explanations above) and an error message.
Personally, I'd go for something like this: me=`echo "$argv0" | sed -e 's,.*[\\/],,;s/\.test$//'` \ && test -n "$me" \ || { echo "$argv0: failed to define \$me" >&2; exit 99; } Regards, Stefano