mirror of
git://git.sv.gnu.org/coreutils.git
synced 2026-04-18 09:46:33 +02:00
sort: fix a contradictory --debug warning
* src/sort.c (key_warn): `sort -k2,1n --debug` would output warnings about being both "zero width" and "spanning multiple fields". Suppress the latter one. * tests/misc/sort-debug-warn: Add a couple of test cases.
This commit is contained in:
@@ -2385,7 +2385,7 @@ key_warnings (struct keyfield const *gkey, bool gkey_only)
|
||||
size_t eword = key->eword + 1;
|
||||
if (!sword)
|
||||
sword++;
|
||||
if (sword != eword)
|
||||
if (!eword || sword < eword)
|
||||
error (0, 0, _("key %lu is numeric and spans multiple fields"),
|
||||
keynum);
|
||||
}
|
||||
|
||||
@@ -23,6 +23,10 @@ cat <<\EOF > exp
|
||||
sort: using simple byte comparison
|
||||
sort: key 1 has zero width and will be ignored
|
||||
sort: using simple byte comparison
|
||||
sort: key 1 has zero width and will be ignored
|
||||
sort: using simple byte comparison
|
||||
sort: key 1 is numeric and spans multiple fields
|
||||
sort: using simple byte comparison
|
||||
sort: options `-bghMRrV' are ignored
|
||||
sort: using simple byte comparison
|
||||
sort: options `-bghMRV' are ignored
|
||||
@@ -50,6 +54,8 @@ sort: using simple byte comparison
|
||||
EOF
|
||||
|
||||
sort -s -k2,1 --debug /dev/null 2>>out
|
||||
sort -s -k2,1n --debug /dev/null 2>>out
|
||||
sort -s -k1,2n --debug /dev/null 2>>out
|
||||
sort -s -rRVMhgb -k1,1n --debug /dev/null 2>>out
|
||||
sort -rRVMhgb -k1,1n --debug /dev/null 2>>out
|
||||
sort -r -k1,1n --debug /dev/null 2>>out
|
||||
|
||||
Reference in New Issue
Block a user