The sort program does not handle filenames like +0, +1, etc. To reproduce: echo "test" > +0 sort -- +0 Expected output: test Actual output: sort: No such file or directory
The file name +0 is trapped by this restriction. > The old key notations +pos1 and -pos2 come from older versions of sort > and are still supported but their use is highly discouraged. The replacement fix_obsolete_keys for this is done before getopt_long. The workaround is ./+0
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=fa43162c63790806d0effba5ac98a1a3c6b835e1 commit fa43162c63790806d0effba5ac98a1a3c6b835e1 Author: Cyril Zhang <cyril@freebsdfoundation.org> AuthorDate: 2021-05-13 12:52:51 +0000 Commit: Mark Johnston <markj@FreeBSD.org> CommitDate: 2021-05-13 13:33:19 +0000 sort: Stop "fixing" obsolete key syntax after -- flag PR: 255798 Reviewed by: markj MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D30234 usr.bin/sort/sort.c | 5 +++++ 1 file changed, 5 insertions(+)
A commit in branch stable/13 references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=f80d1c0035ce2ee5325271ea28916377f813d737 commit f80d1c0035ce2ee5325271ea28916377f813d737 Author: Cyril Zhang <cyril@freebsdfoundation.org> AuthorDate: 2021-05-13 12:52:51 +0000 Commit: Mark Johnston <markj@FreeBSD.org> CommitDate: 2021-05-20 13:15:40 +0000 sort: Stop "fixing" obsolete key syntax after -- flag PR: 255798 Reviewed by: markj Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D30234 (cherry picked from commit fa43162c63790806d0effba5ac98a1a3c6b835e1) usr.bin/sort/sort.c | 5 +++++ 1 file changed, 5 insertions(+)