coreutils
coreutils copied to clipboard
nice: compatibility issue, shall we suport deprecated -ADJUSTMENT/ -<niceness>
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
The GNU docs say this:
For compatibility ‘nice’ also supports an obsolete option syntax
-ADJUSTMENT. New scripts should use-n ADJUSTMENTinstead.
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!
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 ADJUSTMENTinstead. 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
-ADJUSTMENTpls update to-n ADJUSTMENT
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
headandtailimplementation, 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.
yeah, we should support it
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 ..
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!
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
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.