From: Ronald Fischer <ynnor@mm.st>
To: cygwin@cygwin.com
Subject: Bug in zsh and bash with builtin ls when colorization is used and the filename starts with a drive letter
Date: Tue, 01 Aug 2017 14:59:00 -0000 [thread overview]
Message-ID: <1501599567.2374603.1059653184.432A46B6@webmail.messagingengine.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 2311 bytes --]
I have in my .zshrc:
alias "ls=ls --color=auto"
export
LS_COLORS="di=1;4;33:*rc=7:*.rb=32:*.irbrc=32:*.sh=36:*.zsh=36:*.bak=2:*~=2:*.log=34;*.txt=34:ex=1"
Now compare these two commands and their output:
$ ls -l
C:/cygwin64/home/fisrona/gitwrk/vp5/manualtest/logs/manualtest_222.log
-rw-r--r-- 1 fisrona Domain Users 5771150 Aug 1 16:33
xt=34mC:/cygwin64/home/fisrona/gitwrk/vp5/manualtest/logs/manualtest_222.log
$ command ls -l
C:/cygwin64/home/fisrona/gitwrk/vp5/manualtest/logs/manualtest_222.log
-rw-r--r-- 1 fisrona Domain Users 5771150 Aug 1 16:33
C:/cygwin64/home/fisrona/gitwrk/vp5/manualtest/logs/manualtest_222.log
The output in both cases is printed in the same way, but as you can see,
the zsh builtin ls displays a strange "xt=34m" in front of the file
path, while /usr/bin/ls does not.
Further investigation shows that this happens only if the file path
starts with a drive letter (here: C:) and the -l option is requested.
When setting --color=always and piping the output into a hex viewer, I
can see that the what is getting prefixed to the file path is:
0000020 r o n a D o m a i n U s e r
6f72 616e 4420 6d6f 6961 206e 7355 7265
0000040 s 5 7 7 1 1 5 0 A u g 1
2073 3735 3137 3531 2030 7541 2067 3120
0000060 1 6 : 3 3 033 [ 0 m 033 [ 3 4 ;
3120 3a36 3333 1b20 305b 1b6d 335b 3b34
0000100 * . t x t = 3 4 m C : / c y g w
2e2a 7874 3d74 3433 436d 2f3a 7963 7767
0000120 i n 6 4 / h o m e / f i s r o n
6e69 3436 682f 6d6f 2f65 6966 7273 6e6f
We can see here, that part of the text inside the LS_COLORS variable
(i.e. ;.txt=34m) has been placed in the output.
It is interesting that this happens only if we have a drive letter. If I
write
ls -l
/cygdrive/c/cygwin64/home/fisrona/gitwrk/vp5/manualtest/logs/manualtest_222.log
instead, the error does not occur.
This is with zsh 5.3, which is what I'm usually using. For curiosity, I
tested the same with bash, and the bash ls builtin command seems to
behave the same as zsh.
[-- Attachment #2: cygcheck.out --]
[-- Type: application/octet-stream, Size: 86689 bytes --]
[-- Attachment #3: Type: text/plain, Size: 219 bytes --]
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
next reply other threads:[~2017-08-01 14:59 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-01 14:59 Ronald Fischer [this message]
2017-08-01 17:46 ` Vlado
2017-08-01 18:20 ` Brian Inglis
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1501599567.2374603.1059653184.432A46B6@webmail.messagingengine.com \
--to=ynnor@mm.st \
--cc=cygwin@cygwin.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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 read-only IMAP folder(s) and NNTP newsgroup(s).