bug#15157: bug#15158: sort complains about incompatible options (that aren't) AND when it shouldn't
The -g and -h options of 'sort' are indeed incompatible; they result in different outputs. More generally, these bug reports reargue the 'grep' bug reported here: http://lists.gnu.org/archive/html/bug-grep/2013-08/msg00017.html and replied to here: http://lists.gnu.org/archive/html/bug-grep/2013-08/msg00018.html Generally speaking, the GNU utilities follow the POSIX utility syntax guidelines, in particular Guideline 11: The order of different options relative to one another should not matter, unless the options are documented as mutually-exclusive and such an option is documented to override any incompatible options preceding it. http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap12.html#tag_12_02 It sounds like you're disputing the main part of this guideline and are advocating always taking the second (exceptional) part. It's not clear to me that this makes sense, and there are good arguments for sticking with the more-cautious approach.
bug#15157: bug#15158: sort complains about incompatible options (that aren't) AND when it shouldn't
Paul Eggert wrote: The -g and -h options of 'sort' are indeed incompatible; they result in different outputs. More generally, these bug reports reargue the 'grep' bug reported here: http://lists.gnu.org/archive/html/bug-grep/2013-08/msg00017.html --- Not really. There was nothing about the similarity and overlap of sort options and how integer is still in the class of general numbers, which includes 'e' as an abbreviation for a power prefix, just like KMG are power prefixes as well. You can't claim that 3.2e+3, where e indicates some power of 10 follows, and is used as a scaling factor for 3.2 is that different from 3.2k, where k is a scaling factor, and, indicates that 3.2 is scaled by a factor of 10**3. They are both general numeric cases... I don't think I had anything to say, at all, about the overlap of such in grep, which is inconsistent with itself: grep -d read -d skip --color=auto --color=always foo (no error)... GREP_OPTIONS=-d skip --color=auto -P grep -E this|that grep: conflicting matchers specified ??? I didn't specify them on the command line -- OR now: egrep this|that egrep: egrep can only use the egrep pattern syntax But I didn't specify any other syntax... oh.. it reads the cmdline options of 'grep', but it can't function like grep? That sounds a bit ill-designed. --- Please don't try to take over and confused bugs on other utils, just to put forth your view that utilities should default to broken unless the user invokes them perfectly. That's a bad User Interface design -- computers are supposed to be there to help us -- not to enable those who enjoy making others wrong to do so on a wide scale. and replied to here: http://lists.gnu.org/archive/html/bug-grep/2013-08/msg00018.html Generally speaking, the GNU utilities follow the POSIX utility syntax guidelines, in particular Guideline 11: The order of different options relative to one another should not matter, unless the options are documented as mutually-exclusive and such an option is documented to override any incompatible options preceding it. http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap12.html#tag_12_02 It sounds like you're disputing the main part of this guideline and are advocating always taking the second (exceptional) part. --- The 2nd part has been the norm. While you are claiming that the exceptional design should be the norm. Let me know how specifying your options out of order on gnu tar works out... There are many contexts where one option enables or disables others. The idea that options should be order independent is as absurd as the idea that the lines in a C program should also be order independent. This is a perfect example of the ivory tower thinking that is dominating POSIX now. While they used to be more practical and describe what was, now they've jump to the forefront to dictate bad design and dumbed-down interfaces. Have you ever thought about the fact that they are funded by Corporations who might have an interest in seeing Linux's open nature be killed off -- and/or it's usage reduced? It's not clear to me that this makes sense, and there are good arguments for sticking with the more-cautious approach. So you have said, but name some that would be true for most people and make more sense than the previous, deterministic approach... As it is, I could point to sources by them and talk about what they said and everyone knows... to make my point, but I'll rely on the common sense that most people have in knowing that having programs that are resilient in the face of odd user input and have it do something useful and predictable is far better than having fragile programs that break on all but perfect input.
bug#15158: sort complains about incompatible options (that aren't) AND when it shouldn't
tag 15158 notabug close 15158 stop On 08/21/2013 10:57 PM, Linda Walsh wrote: If I tell sort to do a general numeric sort and interpret human suffixes, such as sort -gh ... sort fails similarly, if I ask it to sort by numeric size and respect human suffixes: sort -nh sort claims: sort: options `-dn' are incompatible similarly, numeric and general numeric are claimed to be incompatible -- how is that? Regardless of compatibility or not, sort doesn't use even use _1_ of the options that were specified. If it always used the latest option specified as other utils, it would still behave in a deterministic manner, and give correct output in the majority of cases (if not, then state the question)... I don't know which utils have been dumbed down to fail on, any, ambiguous input (if it is ambiguous, which I argue, it is not -- as there is a prescribed order for evaluation), but the emphasis on computer programs not being resilient. Rigidly making people wrong and refusing to work unless they ask you in the exact right language/syntax is a step backwards for computer programs. The idea on computers is to make life easier -- and enforcing the user to create odd workarounds when the program could have gotten it right, feels like user-abuse. So for these comparison options, it's not obvious what's going on in the implementation. One might think that if -dn was specified, that something like dictionary was used and then numeric done to break ties. Similary with -gh, one might think that -h was an adjustment to -g rather than being a _separate_ comparison method entirely. The errors are imparting this info to the user. Given the complexity of the option combinations for sort(1) in particular, it's important to do so. The edge case of a default sort invocation using for example -d, which is then overridden with -n through config, is not usual, and thus should not proceed, for the reason above. Now you have a point about non mutually exclusive args, which I'll respond to in the related bugs you opened. thanks, Pádraig.