GNU bug report logs -
#8846
coreutils-8.12 on HP-UX 11.31: 3 of 365 tests failed
Previous Next
Reported by: Bruno Haible <bruno <at> clisp.org>
Date: Mon, 13 Jun 2011 09:17:01 UTC
Severity: normal
Tags: moreinfo
Done: Jim Meyering <jim <at> meyering.net>
Bug is archived. No further changes may be made.
Full log
Message #107 received at 8846 <at> debbugs.gnu.org (full text, mbox):
On Tuesday 14 June 2011, Eric Blake wrote:
> On 06/13/2011 03:39 PM, Stefano Lattarini wrote:
> >
> > [3] The $(SHELL), which here we assume is ksh with close-on-exec, does a
> > fork+exec to execute the test script; thus, when that script begins
> > its execution, it has the fd 9 closed (d'oh!, but expected now);
>
> Oddly enough, it looks like it is _only_ 'exec 9>&2' that suffers from
> close-on-exec semantics; using '(blah) 9>&2' leaves fd 9 inheritable.
>
> So maybe the real fix is to do the redirection to a subshell or grouping
> {} rather than via exec, at which point even ksh and HP-UX sh will allow
> the original stderr to be inherited as fd 9 to the child script process:
>
> $ printf '#!/bin/sh\nexec >&9\n' > k
> $ sh k
> k[2]: 9: Generated or received a file descriptor number that is not valid.
> $ sh k 9>&2
> $ sh -c 'exec 9>&2; /bin/sh k'
> k[2]: 9: Generated or received a file descriptor number that is not valid.
> $ sh -c 'sh k 9>&2'
>
If this work, then using a bare `>&2' *at the end of TESTS_ENVIRONMENT* and
*without a following semicolon* might give a portable workaround, as if I'm
not mistaken POSIX mandates that redirections can be specified anywere on
the command line, and are to be evaluated from left to right.
UPDATE: Yes, it seems to work. I'll add a testcase to the 'maint' branch in
case you and Jim decide to go with this solution (and you can confirm that it
really works).
> $ sh -c '(sh k) 9>&2'
> $ sh -c '{ sh k;} 9>&2'
> $
>
> but I don't know if that will require some changes in automake's
> parallel-test driver setup code.
>
> And Autoconf should probably document that the close-on-exec semantics
> of some shells applies only to the exec builtin, since they do not
> happen to other redirections.
>
Regards,
Stefano
This bug report was last modified 13 years and 347 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.