GNU bug report logs - #11150
getlogin test failure

Previous Next

Package: coreutils;

Reported by: Matt Burgess <matthew <at> linuxfromscratch.org>

Date: Mon, 2 Apr 2012 00:11:02 UTC

Severity: normal

Merged with 12729

Done: Pádraig Brady <P <at> draigBrady.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 11150 in the body.
You can then email your comments to 11150 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-coreutils <at> gnu.org:
bug#11150; Package coreutils. (Mon, 02 Apr 2012 00:11:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Matt Burgess <matthew <at> linuxfromscratch.org>:
New bug report received and forwarded. Copy sent to bug-coreutils <at> gnu.org. (Mon, 02 Apr 2012 00:11:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Matt Burgess <matthew <at> linuxfromscratch.org>
To: bug-coreutils <at> gnu.org
Cc: bug-gnulib <at> gnu.org, matthew <at> linuxfromscratch.org
Subject: getlogin test failure
Date: Sun, 01 Apr 2012 23:34:51 +0100
Hi,

The coreutils-8.16 release brought in the getlogin gnulib module.

When running through the testsuite, test-getlogin.c fails for me on a
GNU/Linux system.  There are a couple of different failure scenarios:

1) If I 'make' as my normal user account, then run "su nobody
-s /bin/bash -c 'make check'", then the assertion at line 61 (ASSERT
(strcmp (buf, name) == 0);) fails because buf=="mylogin" and
name=="nobody".  If you're wondering why I would do something like that,
it's because it's a slightly simplified form of my usual build method:

sudo su -
FORCE_UNSAFE_CONFIGURE=1 ./configure
make
make check-root
chown -R nobody .
su nobody -s /bin/bash -c 'make check'

2) Under my non-simplified build method, using an automated build tool,
the assertion at line 43 fails.  Debugging this shows that getlogin(3)
returns ENOENT which isn't handled by the assertion.  That behaviour is
documented at http://man7.org/linux/man-pages/man3/getlogin.3.html.

However, the trivial patch to handle that case too just results in the
very next assert failing (line 47: ASSERT (! isatty (0));).

I'm still trying to figure out what's causing isatty(0) to return 0, and
suspect the automated build tool I'm using; so far I've been unable to
reproduce this via manually-invoked builds.  I'll post again if I can
reproduce it.

Thanks,

Matt.





Information forwarded to bug-coreutils <at> gnu.org:
bug#11150; Package coreutils. (Thu, 19 Apr 2012 11:10:01 GMT) Full text and rfc822 format available.

Message #8 received at 11150 <at> debbugs.gnu.org (full text, mbox):

From: g.esp <at> free.fr
To: Matt Burgess <matthew <at> linuxfromscratch.org>
Cc: 11150 <at> debbugs.gnu.org
Subject: Re: bug#11150: getlogin test failure
Date: Thu, 19 Apr 2012 13:09:07 +0200 (CEST)

----- Mail original -----
> De: "Matt Burgess" <matthew <at> linuxfromscratch.org>
> À: 11150 <at> debbugs.gnu.org
> Cc: bug-gnulib <at> gnu.org, matthew <at> linuxfromscratch.org
> Envoyé: Lundi 2 Avril 2012 00:34:51
> Objet: bug#11150: getlogin test failure
> 
> Hi,
> 
> The coreutils-8.16 release brought in the getlogin gnulib module.
> 
> When running through the testsuite, test-getlogin.c fails for me on a
> GNU/Linux system.  There are a couple of different failure scenarios:
> 

I am surprised nobody answered to this test failure that I fixed on my build system using the same sed as LFS book.

Is this not reproductible out of LFS way to build?

I checked gnulib tree to see nothing changed into test-getlogin.c since 2012-01-01.

Gilles




Information forwarded to bug-coreutils <at> gnu.org:
bug#11150; Package coreutils. (Thu, 19 Apr 2012 11:19:01 GMT) Full text and rfc822 format available.

Message #11 received at 11150 <at> debbugs.gnu.org (full text, mbox):

From: Jim Meyering <jim <at> meyering.net>
To: g.esp <at> free.fr
Cc: Matt Burgess <matthew <at> linuxfromscratch.org>, 11150 <at> debbugs.gnu.org
Subject: Re: bug#11150: getlogin test failure
Date: Thu, 19 Apr 2012 13:18:17 +0200
g.esp <at> free.fr wrote:

> ----- Mail original -----
>> De: "Matt Burgess" <matthew <at> linuxfromscratch.org>
>> À: 11150 <at> debbugs.gnu.org
>> Cc: bug-gnulib <at> gnu.org, matthew <at> linuxfromscratch.org
>> Envoyé: Lundi 2 Avril 2012 00:34:51
>> Objet: bug#11150: getlogin test failure
>>
>> Hi,
>>
>> The coreutils-8.16 release brought in the getlogin gnulib module.
>>
>> When running through the testsuite, test-getlogin.c fails for me on a
>> GNU/Linux system.  There are a couple of different failure scenarios:
>>
>
> I am surprised nobody answered to this test failure that I fixed on my
> build system using the same sed as LFS book.
>
> Is this not reproductible out of LFS way to build?
>
> I checked gnulib tree to see nothing changed into test-getlogin.c
> since 2012-01-01.

Thanks for the follow-up.

If you run the root-only tests as recommended in README,
does that test still fail?




Information forwarded to bug-coreutils <at> gnu.org:
bug#11150; Package coreutils. (Thu, 19 Apr 2012 12:36:01 GMT) Full text and rfc822 format available.

Message #14 received at 11150 <at> debbugs.gnu.org (full text, mbox):

From: Matthew Burgess <matthew <at> linuxfromscratch.org>
To: Jim Meyering <jim <at> meyering.net>
Cc: g.esp <at> free.fr, 11150 <at> debbugs.gnu.org
Subject: Re: bug#11150: getlogin test failure
Date: Thu, 19 Apr 2012 6:33:46 -0600
On Thu, 19 Apr 2012 13:18:17 +0200, Jim Meyering <jim <at> meyering.net> wrote:
> g.esp <at> free.fr wrote:
> 
>> ----- Mail original -----
>>> De: "Matt Burgess" <matthew <at> linuxfromscratch.org>
>>> À: 11150 <at> debbugs.gnu.org
>>> Cc: bug-gnulib <at> gnu.org, matthew <at> linuxfromscratch.org
>>> Envoyé: Lundi 2 Avril 2012 00:34:51
>>> Objet: bug#11150: getlogin test failure
>>>
>>> Hi,
>>>
>>> The coreutils-8.16 release brought in the getlogin gnulib module.
>>>
>>> When running through the testsuite, test-getlogin.c fails for me on a
>>> GNU/Linux system.  There are a couple of different failure scenarios:
>>>
>>
>> I am surprised nobody answered to this test failure that I fixed on my
>> build system using the same sed as LFS book.
>>

I'm just as guilty of not following up on my own report.

> If you run the root-only tests as recommended in README,
> does that test still fail?

I run the root-only tests as:

make NON_ROOT_USERNAME=nobody check-root

I get no failures during that run.

I run the other tests as:

su nobody -s /bin/bash -c "make RUN_EXPENSIVE_TESTS=yes check"

It's here that the getlogin test fails.  I don't care so much about the
odd(ish) tty issues for now.  However, the assert in getlogin.c:60-61 that
assumes getlogin() and getenv("LOGNAME") always returns the same name fails
when run under 'su' as shown above, and as recommended in README.

Hopefully, that failure is easy enough for anyone to reproduce.  At some
point I hope to get more time to look into the tty issue.

Regards,

Matt.





Information forwarded to bug-coreutils <at> gnu.org:
bug#11150; Package coreutils. (Sun, 12 Aug 2012 17:26:02 GMT) Full text and rfc822 format available.

Message #17 received at 11150 <at> debbugs.gnu.org (full text, mbox):

From: Andrew Warshall <warshall <at> 99main.com>
To: 11150 <at> debbugs.gnu.org
Cc: matthew <at> linuxfromscratch.org
Subject: Re: bug#11150: getlogin test failure
Date: Sun, 12 Aug 2012 12:01:32 -0400
[Message part 1 (text/plain, inline)]
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi-

   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.

      -Andrew Warshall
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)

iQEcBAEBAgAGBQJQJ9NcAAoJEESPRWh79T7t0IYIAIlTPzKhXgRqOgsxKYAEUq4W
YHBn4fw30V5zZJdm63GSvnNjVZiBUpjD39gXVdSlgDu8mGEdCW1R2pP+D/R8C57q
XPkjoWEltHVyN/xPfQZdjbsCglxVZ7wDYkzMsWtoJ/7K8NwPSiymerGwEpdRqUej
TfBl8mimcqnASTyW+e0ScJUP5sMVEmeFI3dPmXD7kS+bvfMuVxT3YhLCtwQOSRuZ
KQgmtrB9hDRQoVRyD4ly1bDneRQprWrg8g4QXS0NSRVLehSKdH/diHHLg+8N6rgY
5pl72bwz66bAcWk6d83ax1+qRG6ibpjPAZV8wteYoClQ0Z8G+WqaF9xNVF5E2PQ=
=bmEv
-----END PGP SIGNATURE-----
[coreutils-8.18-test-getlogin-fix.patch.gz (application/octet-stream, attachment)]

Information forwarded to bug-coreutils <at> gnu.org:
bug#11150; Package coreutils. (Mon, 13 Aug 2012 14:11:02 GMT) Full text and rfc822 format available.

Message #20 received at 11150 <at> debbugs.gnu.org (full text, mbox):

From: Jim Meyering <jim <at> meyering.net>
To: Andrew Warshall <warshall <at> 99main.com>
Cc: bug-gnulib <at> gnu.org, matthew <at> linuxfromscratch.org, 11150 <at> debbugs.gnu.org
Subject: Re: 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;




Information forwarded to bug-coreutils <at> gnu.org:
bug#11150; Package coreutils. (Fri, 09 Nov 2012 15:02:01 GMT) Full text and rfc822 format available.

Message #23 received at 11150 <at> debbugs.gnu.org (full text, mbox):

From: Pádraig Brady <P <at> draigBrady.com>
To: Jim Meyering <jim <at> meyering.net>
Cc: Andrew Warshall <warshall <at> 99main.com>, bug-gnulib <at> gnu.org,
	matthew <at> linuxfromscratch.org, 11150 <at> debbugs.gnu.org
Subject: Re: bug#11150: getlogin test failure
Date: Fri, 09 Nov 2012 15:01:32 +0000
On 08/13/2012 03:02 PM, Jim Meyering wrote:
> 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;
>
>

Fixed with:

http://git.sv.gnu.org/gitweb/?p=gnulib.git;a=commit;h=4f81aa5
http://git.sv.gnu.org/gitweb/?p=gnulib.git;a=commit;h=bfe5b0d

thanks,
Pádraig.




Forcibly Merged 11150 12729. Request was from Pádraig Brady <P <at> draigBrady.com> to control <at> debbugs.gnu.org. (Fri, 09 Nov 2012 15:05:02 GMT) Full text and rfc822 format available.

bug closed, send any further explanations to 11150 <at> debbugs.gnu.org and Matt Burgess <matthew <at> linuxfromscratch.org> Request was from Pádraig Brady <P <at> draigBrady.com> to control <at> debbugs.gnu.org. (Fri, 09 Nov 2012 15:05:03 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sat, 08 Dec 2012 12:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 11 years and 135 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.