GNU bug report logs - #8846
coreutils-8.12 on HP-UX 11.31: 3 of 365 tests failed

Previous Next

Package: coreutils;

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 #86 received at 8846 <at> debbugs.gnu.org (full text, mbox):

From: Stefano Lattarini <stefano.lattarini <at> gmail.com>
To: Jim Meyering <jim <at> meyering.net>
Cc: Bruno Haible <bruno <at> clisp.org>, bug-autoconf <at> gnu.org, 8846 <at> debbugs.gnu.org,
	Eric Blake <eblake <at> redhat.com>
Subject: Re: bug#8846: coreutils-8.12 on HP-UX 11.31: 3 of 365 tests failed
Date: Mon, 13 Jun 2011 22:32:31 +0200
Hi Jim.  Probably you're totally going to hate me today, but ...

On Monday 13 June 2011, Jim Meyering wrote:
> 
> From d987cf87de5e7e597e295914c536bd332c24cc63 Mon Sep 17 00:00:00 2001
> From: Jim Meyering <meyering <at> redhat.com>
> Date: Mon, 13 Jun 2011 18:54:53 +0200
> Subject: [PATCH] init.sh: redirect FD 9 to stderr again, for Solaris 10 and HP-UX
> 
> * tests/init.sh (setup_): When $stderr_fileno_ is not 2, redirect it.
> Prior to this change, we would redirect before the shell fork-and-exec
> performed via automake's TESTS_ENVIRONMENT, but that redirection was
> ineffective on Solaris 10 and HP-UX 11.31, due to the fact that those
> systems set the CLOEXEC bit on FDs larger than 2.  Thus our redirection
> of FD 9 would not survive the fork-and-exec of running each test script.
> ---
>  tests/init.sh |    5 +++++
>  1 files changed, 5 insertions(+), 0 deletions(-)
> 
> diff --git a/tests/init.sh b/tests/init.sh
> index 60d1bc1..d101643 100644
> --- a/tests/init.sh
> +++ b/tests/init.sh
> @@ -317,6 +317,11 @@ path_prepend_ ()
> 
>  setup_ ()
>  {
> +  # If we're redirecting a file descriptor larger than 2, say via automake's
> +  # TESTS_ENVIRONMENT, that redirected FD is closed-on-exec on some systems
> +  # (at least Solaris 10 and HP-UX 11.x), so redirect it here again.
> +  test $stderr_fileno_ = 2 || eval "exec $stderr_fileno_>&2"
> +
>
... isn't this equivalent to just using ">&2" unconditionally in 'warn_()'?

IMHO, the right fix is to to modify the code in TESTS_ENVIRONMENT to avoid the
definition of $stderr_fileno_ the shell performs closed-on-exec; e.g.,

  TESTS_ENVIRONMENT = ...; \
    if test x"`(exec 9>&1 && sh -c 'echo foo >&9' >/dev/null 2>&1)`" = x'foo'; then
       stderr_fileno_=9; export stderr_fileno_;
    else
       unset stderr_fileno_ || :
    fi

If we know that bash and zsh are well behaved, we can even avoid a couple of
forks (Cygwin users won't hate us too much then):

 TESTS_ENVIRONMENT = ...; \
    if test -n "$${ZSH_VERSION}$${BASH_VERSION}" || \
       test x"`(exec 9>&1 && sh -c 'echo foo >&9' >/dev/null 2>&1)`" = x'foo'
    then
       stderr_fileno_=9; export stderr_fileno_;
    else
       unset stderr_fileno_ || :
    fi

A better fix would be to do the redirect $stderr_fileno_>&2 in tess/init.sh
iff $stderr_fileno_ is closed, but how can that be portably determined
without printing trash on the user screen (and for *each* test)?

>    if test "$VERBOSE" = yes; then
>      # Test whether set -x may cause the selected shell to corrupt an
>      # application's stderr.  Many do, including zsh-4.3.10 and the /bin/sh
> --
> 1.7.6.rc0.293.g40857
> 

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.