2 # Test warnings for sort options
4 # Copyright (C) 2010-2019 Free Software Foundation, Inc.
6 # This program is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation, either version 3 of the License, or
9 # (at your option) any later version.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program. If not, see <https://www.gnu.org/licenses/>.
19 .
"${srcdir=.}/tests/init.sh"; path_prepend_ .
/src
24 sort: using simple byte comparison
25 sort: key
1 has zero width and will be ignored
27 sort: using simple byte comparison
28 sort: key
1 has zero width and will be ignored
30 sort: using simple byte comparison
31 sort: key
1 is numeric and spans multiple fields
33 sort: using simple byte comparison
34 sort: options
'-bghMRrV' are ignored
36 sort: using simple byte comparison
37 sort: options
'-bghMRV' are ignored
38 sort: option
'-r' only applies to last-resort comparison
40 sort: using simple byte comparison
41 sort: option
'-r' only applies to last-resort comparison
43 sort: using simple byte comparison
44 sort: leading blanks are significant
in key
2; consider also specifying
'b'
45 sort: options
'-bg' are ignored
47 sort: using simple byte comparison
49 sort: using simple byte comparison
50 sort: option
'-b' is ignored
52 sort: using simple byte comparison
54 sort: using simple byte comparison
55 sort: leading blanks are significant
in key
1; consider also specifying
'b'
57 sort: using simple byte comparison
58 sort: leading blanks are significant
in key
1; consider also specifying
'b'
60 sort: using simple byte comparison
61 sort: leading blanks are significant
in key
1; consider also specifying
'b'
62 sort: option
'-d' is ignored
64 sort: using simple byte comparison
65 sort: leading blanks are significant
in key
1; consider also specifying
'b'
66 sort: option
'-i' is ignored
68 sort: using simple byte comparison
70 sort: using simple byte comparison
72 sort: using simple byte comparison
76 sort -s -k2,1 --debug /dev
/null
2>>out
78 sort -s -k2,1n
--debug /dev
/null
2>>out
80 sort -s -k1,2n
--debug /dev
/null
2>>out
82 sort -s -rRVMhgb -k1,1n
--debug /dev
/null
2>>out
84 sort -rRVMhgb -k1,1n
--debug /dev
/null
2>>out
86 sort -r -k1,1n
--debug /dev
/null
2>>out
88 sort -gbr -k1,1n
-k1,1r
--debug /dev
/null
2>>out
90 sort -b -k1b,1bn
--debug /dev
/null
2>>out
# no warning
92 sort -b -k1,1bn
--debug /dev
/null
2>>out
94 sort -b -k1,1bn
-k2b,2 --debug /dev
/null
2>>out
# no warning
96 sort -r -k1,1r
--debug /dev
/null
2>>out
# no warning for redundant options
98 sort -i -k1,1i
--debug /dev
/null
2>>out
# no warning
100 sort -d -k1,1b
--debug /dev
/null
2>>out
102 sort -i -k1,1d
--debug /dev
/null
2>>out
104 sort -r --debug /dev
/null
2>>out
#no warning
106 sort -rM --debug /dev
/null
2>>out
#no warning
108 sort -rM -k1,1 --debug /dev
/null
2>>out
#no warning
110 compare exp out || fail
=1
114 sort: failed to
set locale
115 sort: using simple byte comparison
118 LC_ALL
=missing
sort --debug /dev
/null
2>out
120 # musl libc maps unknown locales to the default utf8 locale
121 # with no way to determine failures. This is discussed at:
122 # http://www.openwall.com/lists/musl/2016/04/02/1
123 if ! grep -E 'using .*(missing|C.UTF-8).* sorting rules' out
; then
124 compare exp out || fail
=1
129 sort: using simple byte comparison
130 sort: key
1 is numeric and spans multiple fields
131 sort: obsolescent key
'+2 -1' used
; consider
'-k 3,1' instead
132 sort: key
2 has zero width and will be ignored
133 sort: option
'-b' is ignored
134 sort: option
'-r' only applies to last-resort comparison
137 sort --debug -rb -k2n +2.2 -1b /dev
/null
2>out
139 compare exp out || fail
=1