Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
From: Arnaud Ferraris <arnaud.ferraris@collabora.com>
Date: Fri, 11 Jun 2021 13:45:58 +0200
Subject: sort: fix `--key` argument handling
When using `sort` with the `--key` option, all subsequent arguments
are considered its values, leading to failures such as:
$ sort -t ":" -k 3 /etc/passwd
sort: failed to parse key `/etc/passwd`: invalid option: `e`
This is a side-effect of having `multiple(true)` for this option,
as `multiple` supports separating values with either a comma or
whitespace. Therefore, as long as no other flag or option is
provided, all arguments following `-k` are treated like values
for this option.
Switching to `use_delimiter(true)` instead ensures only
comma-separated values are taken into account, and the following
arguments are properly interpreted.
Signed-off-by: Arnaud Ferraris <arnaud.ferraris@collabora.com>
Forwarded: https://github.com/uutils/coreutils/pull/2403
---
src/uu/sort/src/sort.rs | 1 -
1 file changed, 1 deletion(-)
diff --git a/src/uu/sort/src/sort.rs b/src/uu/sort/src/sort.rs
index 7b1fe07..c4d9e60 100644
--- a/src/uu/sort/src/sort.rs
+++ b/src/uu/sort/src/sort.rs
@@ -658,7 +658,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 {
.long(OPT_KEY)
.help("sort by a key")
.long_help(LONG_HELP_KEYS)
- .multiple(true)
+ .use_delimiter(true)
.takes_value(true),
)
.arg(