[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#11150: getlogin test failure
From: |
Jim Meyering |
Subject: |
bug#11150: getlogin test failure |
Date: |
Mon, 13 Aug 2012 16:02:22 +0200 |
Andrew Warshall wrote:
> I'm seeing the same issue with 8.18. Apparently xterm doesn't write
> to /var/run/utmp by default, so getlogin () fails with errno ==
> ENOENT. However, isatty (0) still succeeds. The attached patch
> (based on, though not interchangeable with, the sed command at
>
> http://www.linuxfromscratch.org/lfs/view/development/chapter06/coreutils.html)
> skips the test under those conditions (at least it works on my
> machine). Of course, you could alternatively take the position that
> reliance on /var/run/utmp is a bug in getlogin () in gnulib; but
> then I don't know how to fix it.
Thanks for the report and patch.
I'm forwarding this to the bug-gnulib list
since that is where this test is maintained.
> --- gnulib-tests/test-getlogin.c.orig 2012-08-12 10:38:28.000000000 -0400
> +++ gnulib-tests/test-getlogin.c 2012-08-12 10:39:06.000000000 -0400
> @@ -42,9 +42,10 @@
> /* getlogin() fails when stdin is not connected to a tty. */
> ASSERT (errno == ENOTTY
> || errno == EINVAL /* seen on Linux/SPARC */
> + || errno == ENOENT
> );
> #if !defined __hpux /* On HP-UX 11.11 it fails anyway. */
> - ASSERT (! isatty (0));
> + ASSERT (errno == ENOENT || ! isatty (0));
> #endif
> fprintf (stderr, "Skipping test: stdin is not a tty.\n");
> return 77;