bug-coreutils
[Top][All Lists]
Advanced

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

patched nohup in response to today's Austin Group minutes


From: Paul Eggert
Subject: patched nohup in response to today's Austin Group minutes
Date: Fri, 15 Jul 2005 14:57:08 -0700
User-agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux)

I installed this:

        * doc/coreutils.texi (nohup invocation): POSIXLY_CORRECT no longer
        affects nohup's behavior.  Input is redirected from /dev/null.
        * src/nohup.c (main): Don't worry about POSIXLY_CORRECT.  Today's
        Austin Group Minutes says that the GNU behavior will be put
        forward as proposed text for a future revision.

Index: NEWS
===================================================================
RCS file: /fetish/cu/NEWS,v
retrieving revision 1.301
diff -p -u -r1.301 NEWS
--- NEWS        11 Jul 2005 18:20:05 -0000      1.301
+++ NEWS        15 Jul 2005 21:53:01 -0000
@@ -186,9 +186,8 @@ GNU coreutils NEWS                      
   ls no longer outputs an extra space between the mode and the link count
   when none of the listed files has an ACL.
 
-  If stdin is a terminal, nohup now closes it and then reopens it with an
-  unreadable file descriptor.  (This step is skipped if POSIXLY_CORRECT is 
set.)
-  This prevents the command from tying up an OpenSSH session after you logout.
+  If stdin is a terminal, nohup now redirects it from /dev/null to
+  prevent the command from tying up an OpenSSH session after you logout.
 
   stat -f -c %S outputs the fundamental block size (used for block counts).
   stat -f's default output format has been changed to output this size as well.
Index: doc/coreutils.texi
===================================================================
RCS file: /fetish/cu/doc/coreutils.texi,v
retrieving revision 1.271
diff -p -u -r1.271 coreutils.texi
--- doc/coreutils.texi  11 Jul 2005 18:20:34 -0000      1.271
+++ doc/coreutils.texi  15 Jul 2005 21:53:02 -0000
@@ -12615,6 +12615,13 @@ out.  Synopsis:
 nohup @var{command} address@hidden@dots{}
 @end example
 
+If standard input is a terminal, it is redirected from
address@hidden/dev/null} so that terminal sessions do not mistakenly consider
+the terminal to be used by the command.  This is a @acronym{GNU}
+extension; programs intended to be portable to address@hidden hosts
+should use @samp{nohup @var{command} address@hidden@dots{} </dev/null}
+instead.
+
 @flindex nohup.out
 If standard output is a terminal, the command's standard output is appended
 to the file @file{nohup.out}; if that cannot be written to, it is appended
@@ -12627,14 +12634,6 @@ regardless of the current umask settings
 If standard error is a terminal, it is redirected to the same file
 descriptor as the (possibly-redirected) standard output.
 
address@hidden POSIXLY_CORRECT
-If standard input is a terminal, it is closed so that terminal
-sessions do not mistakenly consider the terminal to be used by the
-command.  To avoid glitches in poorly-written programs standard input
-is then reopened with an innocuous file descriptor that cannot be read
-from.  However, these steps are skipped if @env{POSIXLY_CORRECT} is
-set since @acronym{POSIX} requires standard input to be left alone.
-
 @command{nohup} does not automatically put the command it runs in the
 background; you must do that explicitly, by ending the command line
 with an @samp{&}.  Also, @command{nohup} does not change the
Index: src/nohup.c
===================================================================
RCS file: /fetish/cu/src/nohup.c,v
retrieving revision 1.31
diff -p -u -r1.31 nohup.c
--- src/nohup.c 3 Jul 2005 07:18:48 -0000       1.31
+++ src/nohup.c 15 Jul 2005 21:53:02 -0000
@@ -97,12 +97,8 @@ main (int argc, char **argv)
       usage (NOHUP_FAILURE);
     }
 
-  /* If standard input is a tty, replace it with a file descriptor
-     that exists but gives you an error if you try to read it.  POSIX
-     requires nohup to leave standard input alone, but that's less
-     useful in practice as it causes a "nohup foo & exit" session to
-     hang with OpenSSH.  */
-  if (!getenv ("POSIXLY_CORRECT") && isatty (STDIN_FILENO))
+  /* If standard input is a tty, replace it with /dev/null.  */
+  if (isatty (STDIN_FILENO))
     fd_reopen (STDIN_FILENO, "/dev/null", O_WRONLY, 0);
 
   /* If standard output is a tty, redirect it (appending) to a file.




reply via email to

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