zsh-workers
 help / color / mirror / code / Atom feed
* Not-quite-alphabetic sorting: bug in Zsh or in Ubuntu?
@ 2021-08-27 14:49 Marlon Richert
  2021-08-27 22:33 ` Bart Schaefer
  0 siblings, 1 reply; 3+ messages in thread
From: Marlon Richert @ 2021-08-27 14:49 UTC (permalink / raw)
  To: Zsh hackers list

% exec -c zsh -fc "HOME=$PWD SHELL=$SHELL TERM=$TERM PS1='%# ' exec Src/zsh -f"
% autoload compinit
% compinit
% zstyle '*' extra-verbose yes
% less<TAB>
less     -- opposite of more
lessecho -- expand metacharacters
lessfile -- "input preprocessor" for less.
lesskey  -- specify key bindings for less
lesspipe -- "input preprocessor" for less.
% LANG=en_US.UTF-8
% less<TAB>
lessecho -- expand metacharacters
lessfile -- "input preprocessor" for less.
lesskey  -- specify key bindings for less
less     -- opposite of more
lesspipe -- "input preprocessor" for less.

Without `$LANG`, the output is correctly sorted, but with
`LANG=en_US.UTF-8`, `less` somehow ends up in the wrong spot.

The problem occurs for me on Ubuntu, but not on macOS. Ergo, I suppose
this is a bug on the OS level?

On the other hand, it appears to affect only completion sorting:

% LANG=en_US.UTF-8
% touch lessecho lessfile lesskey lesspipe less
% print -l less*
less
lessecho
lessfile
lesskey
lesspipe
% rm less*
% tmp=( lessecho lessfile lesskey lesspipe less )
% print ${(o)tmp}
less lessecho lessfile lesskey lesspipe
%

These are all sorted just fine.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Not-quite-alphabetic sorting: bug in Zsh or in Ubuntu?
  2021-08-27 14:49 Not-quite-alphabetic sorting: bug in Zsh or in Ubuntu? Marlon Richert
@ 2021-08-27 22:33 ` Bart Schaefer
  2021-08-30 10:50   ` Marlon Richert
  0 siblings, 1 reply; 3+ messages in thread
From: Bart Schaefer @ 2021-08-27 22:33 UTC (permalink / raw)
  To: Marlon Richert; +Cc: Zsh hackers list

I believe this has been discussed before, it has to do with how each
platform defines locale-specific collation order.  In the completion
example I believe this has to do with collation of spaces, because the
descriptions are included in the strings passed to strcoll() for
sorting.

Try

LANG=en_US.UTF-8 sort <<\EOF
less     -- opposite of more
lessecho -- expand metacharacters
lessfile -- "input preprocessor" for less.
lesskey  -- specify key bindings for less
lesspipe -- "input preprocessor" for less.
EOF

and you'll get the same result.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Not-quite-alphabetic sorting: bug in Zsh or in Ubuntu?
  2021-08-27 22:33 ` Bart Schaefer
@ 2021-08-30 10:50   ` Marlon Richert
  0 siblings, 0 replies; 3+ messages in thread
From: Marlon Richert @ 2021-08-30 10:50 UTC (permalink / raw)
  To: Bart Schaefer; +Cc: Zsh hackers list

On Sat, Aug 28, 2021 at 1:33 AM Bart Schaefer <schaefer@brasslantern.com> wrote:
>
> I believe this has been discussed before, it has to do with how each
> platform defines locale-specific collation order.  In the completion
> example I believe this has to do with collation of spaces, because the
> descriptions are included in the strings passed to strcoll() for
> sorting.
>
> Try
>
> LANG=en_US.UTF-8 sort <<\EOF
> less     -- opposite of more
> lessecho -- expand metacharacters
> lessfile -- "input preprocessor" for less.
> lesskey  -- specify key bindings for less
> lesspipe -- "input preprocessor" for less.
> EOF
>
> and you'll get the same result.

Thanks for the explanation! :)


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-08-30 10:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-27 14:49 Not-quite-alphabetic sorting: bug in Zsh or in Ubuntu? Marlon Richert
2021-08-27 22:33 ` Bart Schaefer
2021-08-30 10:50   ` Marlon Richert

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).