From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4543 invoked from network); 22 Jan 2000 17:18:01 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 22 Jan 2000 17:18:01 -0000 Received: (qmail 3063 invoked by alias); 22 Jan 2000 17:17:52 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 9406 Received: (qmail 3055 invoked from network); 22 Jan 2000 17:17:52 -0000 To: zsh-workers@math.gatech.edu Subject: playing with backreferences in list-colors X-Attribution: adl From: Alexandre Duret-Lutz Date: 22 Jan 2000 18:17:55 +0100 Message-ID: User-Agent: Gnus/5.070096 (Pterodactyl Gnus v0.96) Emacs/20.5 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii I have been playing with list-colors to colorize process listing and so on. This is quite fun. The snipsets below show two problems I had 1) patterns containing letters don't seems to match; 2) backreferences when (x)# style patterns don't match make zsh segfault. % zsh -f phobos% unset {,Z}LS_COLO{,U}RS phobos% autoload -U compinit; compinit; zmodload zsh/complist phobos% zstyle ':completion:*' group-name '' phobos% zstyle ':completion:*:files' list-colors '=(#b)(a)*=0=1' phobos% setopt extendedglob phobos% touch a{a,b,c}foo phobos% ls a aafoo abfoo acfoo # nothing is highlighted phobos% zstyle ':completion:*:files' list-colors '=(#b)(?)*=0=1' phobos% ls a aafoo abfoo acfoo # first letters are highlighted phobos% zstyle ':completion:*:files' list-colors '=(#b)a(*)=1=0' phobos% ls a aafoo abfoo acfoo # nothing is highlighted Can't I put letters in those patterns? And now : phobos% zstyle ':completion:*:files' list-colors '=(#b)(a)#*=1=0' phobos% ls a zsh: segmentation fault (core dumped) zsh -f (I know, `(a)#' is weird, but actualy I would like to be able to write something like `(*/)#([^ ]*)*' at the end of the pattern for my processes listings, to colorize only basename of processes) (gdb) bt #0 0x80a7a37 in ztrsub (t=0x40014c50 "", s=0x40018001
) at ../../last/Src/utils.c:2594 #1 0x8094d5c in pattryrefs (prog=0x40014a98, string=0x40014c58 "./aafoo", nump=0x401e2150, begp=0x401e2160, endp=0x401e21a0) at ../../last/Src/pattern.c:1382 #2 0x401de36e in putfilecol (c=0x401e2100, group=0x814d470 "files", n=0x40014c58 "./aafoo", m=33204) at ../../../last/Src/Zle/complist.c:585 #3 0x401de92c in clprintm (g=0x814d670, mp=0x814d6e0, mc=0, ml=0, lastc=0, width=8, path=0x40014c58 "./aafoo", buf=0xbffff308) at ../../../last/Src/Zle/complist.c:703 [...] Does string="./aafoo" in frame #1 means that `(#b)(a)#*' is matched over "./aafoo" instead of only "aafoo"? BTW zsh seems to go into troubles when such a pattern don't match : ~ % zsh -f phobos% setopt extendedglob phobos% [[ ab = (#b)(a)#* ]] phobos% echo $match a phobos% [[ .ab = (#b)(a)#* ]] phobos% echo $match zsh: bad pattern: ( phobos% [[ ./ab = (#b)(a)#* ]] phobos% echo $match zsh: bad pattern: ( phobos% [[ ab = (#b)(a)#* ]] phobos% echo $match a phobos% [[ aafoo = (#b)(a)#* ]] phobos% echo $match a phobos% [[ .aafoo = (#b)(a)#* ]] phobos% echo $match O phobos% [[ ./aafoo = (#b)(a)#* ]] phobos% echo $match O phobos% [[ ./aaffffffffffffffffffffoo = (#b)(a)#* ]] phobos% echo $match f phobos% [[ .ab = (#b)(a)#* ]] zsh: segmentation fault (core dumped) zsh -f (sometime it's faster to coredump) (gdb) bt #0 0x80a7a37 in ztrsub (t=0x40014fc1 "O\001@", s=0x40018001
) at ../../last/Src/utils.c:2594 #1 0x8094ed7 in pattryrefs (prog=0x810b650, string=0x400153f8 ".ab", nump=0x0, begp=0x0, endp=0x0) at ../../last/Src/pattern.c:1417 #2 0x80949f0 in pattry (prog=0x810b650, string=0x400153f8 ".ab") at ../../last/Src/pattern.c:1286 #3 0x805c025 in evalcond (state=0xbffff6c0) at ../../last/Src/cond.c:206 #4 0x8064407 in execcond (state=0xbffff6c0, do_exec=0) at ../../last/Src/exec.c:2856 [...] -- Alexandre Duret-Lutz