From: Alexandre Duret-Lutz <duret_g@epita.fr>
To: zsh-workers@math.gatech.edu
Subject: playing with backreferences in list-colors
Date: 22 Jan 2000 18:17:55 +0100 [thread overview]
Message-ID: <mvbzotyqb3w.fsf@phobos.lrde.epita.fr> (raw)
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<TAB>
aafoo abfoo acfoo # nothing is highlighted
phobos% zstyle ':completion:*:files' list-colors '=(#b)(?)*=0=1'
phobos% ls a<TAB>
aafoo abfoo acfoo # first letters are highlighted
phobos% zstyle ':completion:*:files' list-colors '=(#b)a(*)=1=0'
phobos% ls a<TAB>
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<TAB>
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 <Address 0x40018001 out of bounds>)
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 <Address 0x40018001 out of bounds>)
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
next reply other threads:[~2000-01-22 17:18 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2000-01-22 17:17 Alexandre Duret-Lutz [this message]
2000-01-22 19:53 ` Peter Stephenson
2000-01-24 9:14 Sven Wischnowsky
2000-01-24 9:54 Sven Wischnowsky
2000-01-24 15:07 ` Alexandre Duret-Lutz
2000-01-28 6:14 ` Bart Schaefer
2000-01-28 6:18 ` Bart Schaefer
2000-01-28 8:14 Sven Wischnowsky
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=mvbzotyqb3w.fsf@phobos.lrde.epita.fr \
--to=duret_g@epita.fr \
--cc=zsh-workers@math.gatech.edu \
/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.
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).