zsh-users
 help / color / mirror / code / Atom feed
* Completion and dircolors problem
@ 2008-11-29 16:51 Thorsten Kampe
  2008-11-30  0:44 ` Peter Stephenson
  0 siblings, 1 reply; 12+ messages in thread
From: Thorsten Kampe @ 2008-11-29 16:51 UTC (permalink / raw)
  To: zsh-users

[latest zsh]

Hi,

I've got a problem in connection with completion: the listing (for 
instance like in "ls /bin/<TAB>") is not aligned and scrambled with 
spurious "argetm" prefixes (see below[1]).

I tracked it down to the following setting in ~/.dircolors:
LINK  target  # symbolic link ('target' = color is as for the file
              # pointed to)

Can someone of the zsh developers have a look at that? Might be an issue 
on the zsh side or on the dircolors side.

(Bash (at least in my setup) doesn't have this problem. Well, bash 
doesn't do coloured completion listings - so that might be the reason.)


Thorsten
[1]
ACTUAL OUTPUT:
files
attr*        argetmawk@             basename*    bash*           argetmbb@         argetmbunzip2@
busybox*     argetmbusybox.static@  argetmbzcat@       bzip2*          cat*        chattr* 
chgrp*       chmod* ls /bin/                                                         ~
cut*         date*            dd*          df*             dir*        dirname*
dmesg*       argetmdnsdomainname@   argetmdomainname@  du*             echo*       ed*     
egrep*       env*             expr*        false*          fgrep*      fuser*  
argetmgawk@        gawk-3.1.6*      getfattr*    grep*           groups*     gunzip* 
gzip*        head*            hostname*    argetmigawk@          kill*       ln*     
loadkeys*    login*           ls*          lsattr*         lsmod*      mbchk*  
mkdir*       mkfifo*          mknod*       mktemp*         more*       mount*  
mountpoint*  mv*              netstat*     argetmnisdomainname@  passwd*     argetmpgawk@  
argetmpidof@       ping*            ps*          pwd*            argetmrbash@      argetmrc-status@
readlink*    argetmred@             rm*          rmdir*          run-parts*  argetmrzsh@   
sed*         seq*             setfattr*    setfont*        setserial*  argetmsh@     
sleep*       sort*            stty*        su*             sync*       tail*   
tar*         tempfile*        touch*       tr*             true*       tty*    
umount*      uname*           argetmuncompress@  uuidgen*        vdir*       wc*     
yes*         argetmypdomainname@    zcat*        zsh*

-- WITHOUT "LINK  target":
files
attr*        awk@             basename*    bash*           bb@         bunzip2@
busybox*     busybox.static@  bzcat@       bzip2*          cat*        chattr* 
chgrp*       chmod*           chown*       chroot*         cp*         cpio*   
cut*         date*            dd*          df*             dir*        dirname*
dmesg*       dnsdomainname@   domainname@  du*             echo*       ed*     
egrep*       env*             expr*        false*          fgrep*      fuser*  
gawk@        gawk-3.1.6*      getfattr*    grep*           groups*     gunzip* 
gzip*        head*            hostname*    igawk@          kill*       ln*     
loadkeys*    login*           ls*          lsattr*         lsmod*      mbchk*  
mkdir*       mkfifo*          mknod*       mktemp*         more*       mount*  
mountpoint*  mv*              netstat*     nisdomainname@  passwd*     pgawk@  
pidof@       ping*            ps*          pwd*            rbash@      rc-status@
readlink*    red@             rm*          rmdir*          run-parts*  rzsh@   
sed*         seq*             setfattr*    setfont*        setserial*  sh@     
sleep*       sort*            stty*        su*             sync*       tail*   
tar*         tempfile*        touch*       tr*             true*       tty*    
umount*      uname*           uncompress@  uuidgen*        vdir*       wc*     
yes*         ypdomainname@    zcat*        zsh*


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

* Re: Completion and dircolors problem
  2008-11-29 16:51 Completion and dircolors problem Thorsten Kampe
@ 2008-11-30  0:44 ` Peter Stephenson
  2008-11-30  1:25   ` Thorsten Kampe
  0 siblings, 1 reply; 12+ messages in thread
From: Peter Stephenson @ 2008-11-30  0:44 UTC (permalink / raw)
  To: zsh-users

On Sat, 29 Nov 2008 17:51:20 +0100Thorsten Kampe <thorsten@thorstenkampe.de> wrote:
> I tracked it down to the following setting in ~/.dircolors:
> LINK  target  # symbolic link ('target' = color is as for the file
>               # pointed to)
> 
> Can someone of the zsh developers have a look at that? Might be an issue 
> on the zsh side or on the dircolors side.

zsh doesn't use ~/.dircolors.  Usually you will have a zstyle to set
list-colors somewhere, possibly from $LS_COLORS.  Find out what it
contains and whether it contains something zsh doesn't support (see the
zsh/complist description in the zshmodules manual for what zsh does
support).

The specification "ln=target" is supported and I've just tested it
works.  I tried with the following:

zstyle :completion:*:default list-colors no=00 fi=00 di=01\;34 \
ln=target pi=40\;33 so=01\;35 do=01\;35 bd=40\;33\;01 cd=40\;33\;01 \
or=40\;31\;01 ex=01\;32

-- 
Peter Stephenson <p.w.stephenson@ntlworld.com>
Web page now at http://homepage.ntlworld.com/p.w.stephenson/


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

* Re: Completion and dircolors problem
  2008-11-30  0:44 ` Peter Stephenson
@ 2008-11-30  1:25   ` Thorsten Kampe
  2008-11-30  1:45     ` Bart Schaefer
  0 siblings, 1 reply; 12+ messages in thread
From: Thorsten Kampe @ 2008-11-30  1:25 UTC (permalink / raw)
  To: zsh-users

* Peter Stephenson (Sun, 30 Nov 2008 00:44:57 +0000)> 
> On Sat, 29 Nov 2008 17:51:20 +0100Thorsten Kampe <thorsten@thorstenkampe.de> wrote:
> > I tracked it down to the following setting in ~/.dircolors:
> > LINK  target  # symbolic link ('target' = color is as for the file
> >               # pointed to)
> > 
> > Can someone of the zsh developers have a look at that? Might be an issue 
> > on the zsh side or on the dircolors side.
> 
> zsh doesn't use ~/.dircolors.  Usually you will have a zstyle to set
> list-colors somewhere, possibly from $LS_COLORS.  Find out what it
> contains and whether it contains something zsh doesn't support (see the
> zsh/complist description in the zshmodules manual for what zsh does
> support).

Ah, right, I forgot. I have...

    zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS}

...in there and that is directly coming from the user guide[1].

Thorsten
[1] http://zsh.sunsite.dk/Guide/zshguide06.html#l158


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

* Re: Completion and dircolors problem
  2008-11-30  1:25   ` Thorsten Kampe
@ 2008-11-30  1:45     ` Bart Schaefer
  2008-11-30  3:07       ` Thorsten Kampe
  0 siblings, 1 reply; 12+ messages in thread
From: Bart Schaefer @ 2008-11-30  1:45 UTC (permalink / raw)
  To: zsh-users

On Nov 30,  2:25am, Thorsten Kampe wrote:
}
} Ah, right, I forgot. I have...
} 
}     zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS}
} 
} ...in there and that is directly coming from the user guide[1].

The value of LS_COLORS usually comes from some startup scripts that
are in /etc/profile.d or another place loaded from /etc/profile.
Is it possible that your system is configured to source /etc/profile
even for zsh?  Perhaps some bash-ism in the script that assigns to
LS_COLORS is running afoul of syntax differences?


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

* Re: Completion and dircolors problem
  2008-11-30  1:45     ` Bart Schaefer
@ 2008-11-30  3:07       ` Thorsten Kampe
  2008-11-30  4:22         ` Bart Schaefer
  0 siblings, 1 reply; 12+ messages in thread
From: Thorsten Kampe @ 2008-11-30  3:07 UTC (permalink / raw)
  To: zsh-users

* Bart Schaefer (Sat, 29 Nov 2008 17:45:52 -0800)> 
> On Nov 30,  2:25am, Thorsten Kampe wrote:
> } Ah, right, I forgot. I have...
> } 
> }     zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS}
> } 
> } ...in there and that is directly coming from the user guide[1].
> 
> The value of LS_COLORS usually comes from some startup scripts that
> are in /etc/profile.d or another place loaded from /etc/profile.
> Is it possible that your system is configured to source /etc/profile
> even for zsh?  Perhaps some bash-ism in the script that assigns to
> LS_COLORS is running afoul of syntax differences?

That's me in .zshrc: "eval $(dircolors -b ~/.dir_colors)" - and that 
works perfectly for "ls /bin" as well as "ls /bin/<TAB>". Only for links 
it does not work and only if "LINK target" is configured in 
~/.dir_colors. If I set "LINK 00;31" for instance, everything is fine.

Thorsten


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

* Re: Completion and dircolors problem
  2008-11-30  3:07       ` Thorsten Kampe
@ 2008-11-30  4:22         ` Bart Schaefer
  2008-11-30 16:15           ` Thorsten Kampe
  0 siblings, 1 reply; 12+ messages in thread
From: Bart Schaefer @ 2008-11-30  4:22 UTC (permalink / raw)
  To: zsh-users

On Nov 30,  4:07am, Thorsten Kampe wrote:
}
} That's me in .zshrc: "eval $(dircolors -b ~/.dir_colors)" - and that 
} works perfectly for "ls /bin" as well as "ls /bin/<TAB>". Only for links 
} it does not work and only if "LINK target" is configured in 
} ~/.dir_colors. If I set "LINK 00;31" for instance, everything is fine.

So what does
    zstyle -L | grep list-colors
look like?

And which version of zsh?  ln=target has been supported only since
2008-05-06, so 4.3.9 is the first non-"dev" release that handles it.


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

* Re: Completion and dircolors problem
  2008-11-30  4:22         ` Bart Schaefer
@ 2008-11-30 16:15           ` Thorsten Kampe
  2008-11-30 16:30             ` Mikael Magnusson
  2008-11-30 18:21             ` Bart Schaefer
  0 siblings, 2 replies; 12+ messages in thread
From: Thorsten Kampe @ 2008-11-30 16:15 UTC (permalink / raw)
  To: zsh-users

* Bart Schaefer (Sat, 29 Nov 2008 20:22:18 -0800)> 
> On Nov 30,  4:07am, Thorsten Kampe wrote:
> }
> } That's me in .zshrc: "eval $(dircolors -b ~/.dir_colors)" - and that 
> } works perfectly for "ls /bin" as well as "ls /bin/<TAB>". Only for links 
> } it does not work and only if "LINK target" is configured in 
> } ~/.dir_colors. If I set "LINK 00;31" for instance, everything is fine.
> 
> So what does
>     zstyle -L | grep list-colors
> look like?

zstyle ':completion:*:jobs' list-colors 'no=01;31'
zstyle ':completion:*:processes' list-colors '=(#b) #([0-9]#)*=0=01;31'
zstyle ':completion:*' list-colors 'no=00;37' 'bd=00;33' 'cd=00;33' 'di=
00;36' 'do=00;35' 'ex=01;32' 'pi=00;33' 'fi=00;37' 'ln=target' 'or=
00;31' 'ow=00;36' 'sg=01;37' 'su=01;37' 'so=00;35' 'st=01;36' 'tw=
01;36' '*.bz2=00;31' '*.gz=00;31' '*.msi=00;31' '*.sqx=00;31' '*.tar=
00;31' '*.tgz=00;31' '*.xpi=00;31' '*.zip=00;31' '*.bak=00;31' '*.conf=
01;36' '*.css=01;36' '*.ini=01;36' '*.reg=01;36' '*.xml=01;36' '*.abw=
01;37' '*.chm=01;37' '*.doc=01;37' '*.htm=01;37' '*.html=01;37' '*.pdf=
01;37' '*.rtf=01;37' '*.txt=01;37' '*.exe=01;32' '*.bmp=00;33' '*.gif=
00;33' '*.ico=00;33' '*.jpg=00;33' '*.png=00;33' '*.xpm=00;33' '*.lnk=
00;36' '*.url=00;36' '*.bat=01;36' '*.btm=01;36' '*.py=01;36' '*.pyc=
01;36' '*.pyo=01;36' '*.pyw=01;36' '*.sh=01;36' '*.zsh=01;36'
 
> And which version of zsh?  ln=target has been supported only since
> 2008-05-06, so 4.3.9 is the first non-"dev" release that handles it.

4.3.6. So this is expected?! As I said I don't set the list-colors 
manually but I let zsh read my LS_COLORS (tip from the user guide 
("list-colors ${(s.:.)LS_COLORS}")).

So if I understand it correctly the external command dircolors 
understands "LINK target" - while zsh does not ("ln=target") until 
4.3.9?!

Thorsten


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

* Re: Completion and dircolors problem
  2008-11-30 16:15           ` Thorsten Kampe
@ 2008-11-30 16:30             ` Mikael Magnusson
  2008-11-30 16:58               ` Thorsten Kampe
  2008-11-30 18:21             ` Bart Schaefer
  1 sibling, 1 reply; 12+ messages in thread
From: Mikael Magnusson @ 2008-11-30 16:30 UTC (permalink / raw)
  To: zsh-users

2008/11/30 Thorsten Kampe <thorsten@thorstenkampe.de>:

> 4.3.6. So this is expected?! As I said I don't set the list-colors
> manually but I let zsh read my LS_COLORS (tip from the user guide
> ("list-colors ${(s.:.)LS_COLORS}")).
>
> So if I understand it correctly the external command dircolors
> understands "LINK target" - while zsh does not ("ln=target") until
> 4.3.9?!

You can filter out the ln with an expression like
${${(s.:.)LS_COLORS}%ln=*}, then you probably want to add an explicit
'ln=0;36' too after. Ie,
zstyle ':completion:*' list-colors ${(s.:.)${LS_COLORS}%ln=*} 'ln=00;36'

Heh, I think I found a bug in ls, ls -l *(@) shows only broken links,
while ls -ld *(@) shows the correct colors, when I've set ln=target.

If you want to be fancy, you can make the above depend on $ZSH_VERSION
too, but it's probably easier to just remove it when you update zsh.

-- 
Mikael Magnusson


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

* Re: Completion and dircolors problem
  2008-11-30 16:30             ` Mikael Magnusson
@ 2008-11-30 16:58               ` Thorsten Kampe
  0 siblings, 0 replies; 12+ messages in thread
From: Thorsten Kampe @ 2008-11-30 16:58 UTC (permalink / raw)
  To: zsh-users

* Mikael Magnusson (Sun, 30 Nov 2008 17:30:20 +0100)> 
> 2008/11/30 Thorsten Kampe <thorsten@thorstenkampe.de>:
> > 4.3.6. So this is expected?! As I said I don't set the list-colors
> > manually but I let zsh read my LS_COLORS (tip from the user guide
> > ("list-colors ${(s.:.)LS_COLORS}")).
> >
> > So if I understand it correctly the external command dircolors
> > understands "LINK target" - while zsh does not ("ln=target") until
> > 4.3.9?!
> 
> You can filter out the ln with an expression like
> ${${(s.:.)LS_COLORS}%ln=*}, then you probably want to add an explicit
> 'ln=0;36' too after. Ie,
> zstyle ':completion:*' list-colors ${(s.:.)${LS_COLORS}%ln=*} 'ln=00;36'
> [...]
> If you want to be fancy, you can make the above depend on $ZSH_VERSION
> too, but it's probably easier to just remove it when you update zsh.

I commented it out in ~/.dir_colors and I will re-enable it when 
Gentoo's zsh gets updated.

Thorsten


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

* Re: Completion and dircolors problem
  2008-11-30 16:15           ` Thorsten Kampe
  2008-11-30 16:30             ` Mikael Magnusson
@ 2008-11-30 18:21             ` Bart Schaefer
  2008-11-30 18:34               ` Thorsten Kampe
  2008-11-30 18:42               ` Stephane Chazelas
  1 sibling, 2 replies; 12+ messages in thread
From: Bart Schaefer @ 2008-11-30 18:21 UTC (permalink / raw)
  To: zsh-users

On Nov 30,  5:15pm, Thorsten Kampe wrote:
}
} So if I understand it correctly the external command dircolors 
} understands "LINK target" - while zsh does not ("ln=target") until 
} 4.3.9?!

Yes, you understand correctly.

I'm not sure why this is surprising; "ln=target" is a fairly recent
addition to ls / dircolors as well.  It's not supported on my CentOS4
machine at home, for example.  Zsh isn't a GNU project, so it will
always lag behind a little on significant changes to the GNU base.


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

* Re: Completion and dircolors problem
  2008-11-30 18:21             ` Bart Schaefer
@ 2008-11-30 18:34               ` Thorsten Kampe
  2008-11-30 18:42               ` Stephane Chazelas
  1 sibling, 0 replies; 12+ messages in thread
From: Thorsten Kampe @ 2008-11-30 18:34 UTC (permalink / raw)
  To: zsh-users

* Bart Schaefer (Sun, 30 Nov 2008 10:21:15 -0800)> 
> On Nov 30,  5:15pm, Thorsten Kampe wrote:
> } So if I understand it correctly the external command dircolors 
> } understands "LINK target" - while zsh does not ("ln=target") until 
> } 4.3.9?!
> 
> Yes, you understand correctly.
> 
> I'm not sure why this is surprising; "ln=target" is a fairly recent
> addition to ls / dircolors as well.

Aah, I didn't know that.

> Zsh isn't a GNU project, so it will
> always lag behind a little on significant changes to the GNU base.

I'm just surprised that the answer is so easy.

Thorsten



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

* Re: Completion and dircolors problem
  2008-11-30 18:21             ` Bart Schaefer
  2008-11-30 18:34               ` Thorsten Kampe
@ 2008-11-30 18:42               ` Stephane Chazelas
  1 sibling, 0 replies; 12+ messages in thread
From: Stephane Chazelas @ 2008-11-30 18:42 UTC (permalink / raw)
  To: Bart Schaefer; +Cc: zsh-users

On Sun, Nov 30, 2008 at 10:21:15AM -0800, Bart Schaefer wrote:
> On Nov 30,  5:15pm, Thorsten Kampe wrote:
> }
> } So if I understand it correctly the external command dircolors 
> } understands "LINK target" - while zsh does not ("ln=target") until 
> } 4.3.9?!
> 
> Yes, you understand correctly.
> 
> I'm not sure why this is surprising; "ln=target" is a fairly recent
> addition to ls / dircolors as well.  It's not supported on my CentOS4
> machine at home, for example.  Zsh isn't a GNU project, so it will
> always lag behind a little on significant changes to the GNU base.

Not so recent:

Sat, 8 Apr 2000 19:03:29 +0000 according to
http://git.savannah.gnu.org/gitweb/?p=coreutils.git;a=commitdiff;h=5c7059a33aade6ad2b0548f2fcb05f9ede05295c

I was surprised, I wasn't aware of the feature.

-- 
Stéphane


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

end of thread, other threads:[~2008-11-30 18:42 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-11-29 16:51 Completion and dircolors problem Thorsten Kampe
2008-11-30  0:44 ` Peter Stephenson
2008-11-30  1:25   ` Thorsten Kampe
2008-11-30  1:45     ` Bart Schaefer
2008-11-30  3:07       ` Thorsten Kampe
2008-11-30  4:22         ` Bart Schaefer
2008-11-30 16:15           ` Thorsten Kampe
2008-11-30 16:30             ` Mikael Magnusson
2008-11-30 16:58               ` Thorsten Kampe
2008-11-30 18:21             ` Bart Schaefer
2008-11-30 18:34               ` Thorsten Kampe
2008-11-30 18:42               ` Stephane Chazelas

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).