bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: nohup breaks logname and tty commands


From: Eric Blake
Subject: Re: nohup breaks logname and tty commands
Date: Fri, 22 Feb 2008 09:24:50 -0700
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.9) Gecko/20071031 Thunderbird/2.0.0.9 Mnenhy/0.7.5.666

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

According to ROTH, MATTHEW G (ATTSI) on 2/22/2008 9:06 AM:
| As we are moving from RHEL 4.x to 5.x I noticed that some scripts
| started failing.

You may want to consider further upgrades - the latest stable version of
coreutils is 6.10.

| In RHEL 5 with coreutils 5.97 the following does not work:
|
|       $ /usr/bin/nohup /usr/bin/logname
|       /usr/bin/nohup: appending output to `nohup.out'
|
|       $ cat nohup.out
|       /usr/bin/logname: no login name

I'm not sure why that is failing for you.  It worked just fine for me:
$ logname
eblake
$ nohup logname
nohup: ignoring input and appending output to `nohup.out'
$ cat nohup.out
eblake
$ nohup --version | head -n1
nohup (GNU coreutils) 6.10
$ logname --version | head -n1
logname (GNU coreutils) 6.10

Perhaps an strace would shed some light?

| I also checked the nohup in the coreutils 6.9 and it has the same
| behavior.  The tty command has similar issue, not sure if other commands
| are effected as well.

Well, the tty command is SUPPOSED to be affected.  POSIX allows nohup to
redirect stdin so as not to hold a tty open indefinitely (the idea of
nohup is to isolate a long-running background process from SIGHUP, and
interactive input doesn't make sense to such a long-running process).  So
newer coreutils does just that, meaning 'nohup tty' is testing whether
/dev/null is a tty (it isn't), while older coreutils held the input tty
open and was able to return true.

|
| We are able to work around the issues but it creates more
| incompatibilities between Linux and the other Unix flavors.

You already have to work around the incompatibilities of stdin being
redirected, since POSIX allows, but does not require, that.  In other
words, relying on a tty input to survive nohup is inherently non-portable.

- --
Don't work too hard, make some time for fun as well!

Eric Blake             address@hidden
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD4DBQFHvvdS84KuGfSFAYARAvTqAJkBBrft/wm1VWYibggIn/DSL51odQCYghUf
740QQWhyiw27yrMKCOHr1w==
=009F
-----END PGP SIGNATURE-----




reply via email to

[Prev in Thread] Current Thread [Next in Thread]