coreutils icon indicating copy to clipboard operation
coreutils copied to clipboard

nice: compatibility issue, shall we suport deprecated -ADJUSTMENT/ -<niceness>

Open Wabuo opened this issue 4 years ago • 8 comments

nice -19 echo "hello" will run just fine with the GNU core utils but will throw an error "Found argument '-1' which wasn't expected, or isn't valid in this context" with uutils.

Do we want to be fully compatible on that front or is omitting the -n considered bad practise? Edit: yes it is If so, I suggest changing the error message to something on the lines of this Found argument '-1' which wasn't expected, or isn't valid in this context. Did u forget the '-n' nice -<niceness> isn't supported, pls use nice -n19/ -n 19/ -n=19

PS: ping me for a pull request Cheers Wabuo

Wabuo avatar May 22 '21 13:05 Wabuo

The GNU docs say this:

For compatibility ‘nice’ also supports an obsolete option syntax -ADJUSTMENT. New scripts should use -n ADJUSTMENT instead.

However, since it is a feature that is still used (as shown by the linked issue), I think makes sense to support it. It would be great if you could make a PR!

tertsdiepraam avatar May 22 '21 14:05 tertsdiepraam

For compatibility ‘nice’ also supports an obsolete option syntax -ADJUSTMENT. New scripts should use -n ADJUSTMENT instead.

Do we really want to keep dragging that one on? Till when?

Should we maybe throw an error like

For compatibility ‘GNU nice’ also supports an obsolete option syntax -ADJUSTMENT. New scripts should use -n ADJUSTMENT instead. We don't!

Or better print a deprecated warning till GNU drops it. To where; terminal only, system log with some log level?

nice got called from</some/executable> with deprecated -ADJUSTMENT pls update to -n ADJUSTMENT

Wabuo avatar May 22 '21 15:05 Wabuo

It is indeed a little bit of a hassle to keep it, but I see a few reasons for it:

  • People expect the same results as GNU and BSD implementation (which still support it, see for example https://man.openbsd.org/nice).
  • It is consistent with our head and tail implementation, which support a similar syntax.

Also, I don't think GNU is going to drop this syntax any time soon. I think POSIX has deprecated it and they just keep it.

tertsdiepraam avatar May 22 '21 16:05 tertsdiepraam

yeah, we should support it

sylvestre avatar May 22 '21 16:05 sylvestre

Will fix it tomorrow, its way to late here.

Do we want to throw any kind of warning? Should it be documented somewhere? Shall it be mentioned in help?

Should I write a test for it? Seems to be a bit over board to me ..

Wabuo avatar May 22 '21 17:05 Wabuo

For now I'd say no warning, but mentioning it in the help text would be nice. We're trying to test as much as we can, so adding one would be nice!

tertsdiepraam avatar May 22 '21 17:05 tertsdiepraam

It is consistent with our head and tail implementation, which support a similar syntax.

Are we sure tail supports a similar syntax? I'm seeing the following on my Mac running uutils-coreutils:

[arni]% nvm use 12.22.1    
error: Found argument '-1' which wasn't expected, or isn't valid in this context

USAGE:
    tail [FLAGS] [OPTIONS] [files]...

For more information try --help
N/A: version "12.22.1 -> N/A" is not yet installed.

You need to run "nvm install 12.22.1" to install it before using it.
[arni]% tail --version
tail 0.0.6

ArniDagur avatar Jun 29 '21 14:06 ArniDagur

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Jun 30 '22 03:06 stale[bot]