Re: [SUGGESTION] nohup_${PID}.out

2018-02-18 Thread Boruch Baum
On 2018-02-19 00:14, Bernhard Voelker wrote:
> Have a nice day,
> Berny

Thank you for the kind wishes. I hope the list will continue to consider
the entirety of the suggestions in my post.

-- 
hkp://keys.gnupg.net
CA45 09B5 5351 7C11 A9D1  7286 0036 9E45 1595 8BC0



Re: [SUGGESTION] nohup_${PID}.out

2018-02-18 Thread Bernhard Voelker

On 02/18/2018 12:26 PM, Boruch Baum wrote:

1] Wouldn't it be useful for nohup to indicate the PID of the process it
spawns?


nohup(1) does *not* create a new process.  Instead, it invokes execve to replace
its own image with that of the new one (in the same process), i.e., there is no
new PID.  You can check via strace(1) to see what happens.

P.S. Often one sends such a process to the background - as you said with '&':

  $ nohup sleep 1000 &

This is a shell feature, and you can use $! to get the PID for further
tracking etc., e.g.:

  $ kill $!

Have a nice day,
Berny



bug#29617: `seq 1 --help' doesn't give help

2018-02-18 Thread chadweisman

> On 12/08/2017 11:38 AM, Eric B wrote:
> > Hello,
> > 
> > I am using coreutils version 8.27 on Fedora, and I don't see this fixed in 
> > 8.28's NEWS.
> > 
> > $ seq 1 --help
> > seq: invalid floating point argument: ‘--help’
> > Try 'seq --help' for more information.

> Interesting bug!

> > 
> > We should be able to put the options anywhere and not necessarily before 
> > any 
> > arguments.

> Yes, when possible.

> > And even if not (e.g. POSIX conformance overrides,)

> POSIX does say you have to write 'foo -- --help' if you want to
> guarantee that --help is treated as a literal argument rather than
> option, but it also says that the moment you specify '--help' (or any
> other parameter starting with two dashes without the -- end-of-options
> parameter), you are already in undefined territory.  So we can do
> whatever we want when encountering '--help' - which is part of the
> reason WHY the GNU project prefers making 'foo args --help' print help
> output where possible.

> > --help should be handled specially to conform to the GNU coding standards. 
> > [1]

> Yes.

> But the reason that it fails is because we use getopt_long(...,
> "+f:s:w") - where the leading '+' specifically requests that we NOT
> allow option reordering.  Why? Because 'seq' is MOST useful if it can
> parse negative numbers easily.  We deemed it more important to support
> 'seq 2 -1 1' without requiring the user to write 'seq -- 2 -1 1' - but
> in doing so, it also means that we can't reorder options, so any obvious
> non-option (like '1' in your example) makes all other parameters
> non-options (including '--help' in your example).

> It might be possible to do a two-pass parse over argv: one that looks
> just for --help (and where treating -1 as an option is a no-op), and the
> second that actually parses things in order now that it knows --help is
> not present.  But that's a lot of code to add for a corner case, so I
> won't be writing the patch; but I also won't turn it down if someone
> else wants to write the patch.

Hello,

I've taken a stab at fixing this problem because it affects me fairly often.

Instead of using a two-pass system, I check if any of the args we scan are 
--help or --version and bail if we see either.  See attached patch.

The bad side of this approach is that the -f, -s, and -w options and their 
associated long options aren't handled so `seq 1 -w 2 10` still shows an error. 
 Also, it's a kludgy sort of fix, so I completely understand why you wouldn't 
want to include it.  But at least it's a step in the right direction to give 
help when we can instead of an error.

Chad

coreutils-seq-bug-29617.patch
Description: Binary data


[SUGGESTION] nohup_${PID}.out

2018-02-18 Thread Boruch Baum
   ref: nohup (GNU coreutils) 8.23

1] Wouldn't it be useful for nohup to indicate the PID of the process it
spawns?

1.1] What comes to mind would be to have nohup send the PID to
either STDOUT or STDERR, and also to send it as a first line to its
output file.

1.1.1] It would also be helpful for nohup to send to its output file
the text of the command line that it spawned.

1.2] This would be useful to help:

1.2.1] track the process

1.2.2] send it signals

1.2.3] identify what exactly this output file is recording

1.3] This behavior would be consistent with what bash does when ending
a comamnd with '&'; it indicates the PID and job number.

2.] Also, I would find it useful for nohup to have options to produce a
{quasi-,}unique output file:

2.1] nohup_${PID}.out

2.2] nohup_${PID}_${RANDOM}.out

For your consideration,

-- 
hkp://keys.gnupg.net
CA45 09B5 5351 7C11 A9D1  7286 0036 9E45 1595 8BC0