This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: nohup broken in sh-utils-2.0.15-2


Michael A Richmond wrote:
When I run nohup from sh-utils-2.0.15-2, I get the message

exec: --: not found

The version of nohup in sh-utils-2.0-3 does not produce this error.
The problematic line in nohup is the last one: exec -- "$@"
In sh-utils-2.0 this was: exec "$niceprog" -5 -- "$@"
Given that exec is a shell builtin and nohup is run under /bin/sh which should be ash.

Extract from the ash man page:
exec [ command arg... ]
Unless command is omitted, the shell process is replaced with the
specified program (which must be a real program, not a shell
builtin or function). Any redirections on the exec command are
marked as permanent, so that they are not undone when the exec
command finishes. If the command is not found, the exec command
causes the shell to exit.

So removing the -- command protection as ash's exec doesn't take any options fixes the problem (and keychain works again).

But if bash has been copied to /bin/sh then there will be a problem for commands with a leading dash.

Extract from the bash man page:
exec [-cl] [-a name] [command [arguments]]
...

But testing for this and setting a shellvariable according seems to fix it for both ash and bash.

--- /usr/bin/nohup.orig 2003-01-05 04:15:00.000000000 +0100
+++ /usr/bin/nohup 2003-01-07 02:32:59.000000000 +0100
@@ -76,4 +76,6 @@
exec 2>&1
fi

-exec -- "$@"
+DD=`(exec -l echo "--" 2>/dev/null)`
+
+exec $DD "$@"

--
Med venlig hilsen / Kind regards

Hack Kampbjørn


--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Bug reporting: http://cygwin.com/bugs.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]