Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: [mpol@xxxxxxxxxxxxxxxxxxx: Bug#306346: zsh: replacement seems broken in prompt]
- X-seq: zsh-workers 21194
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxx
- Subject: Re: [mpol@xxxxxxxxxxxxxxxxxxx: Bug#306346: zsh: replacement seems broken in prompt]
- Date: Tue, 26 Apr 2005 03:49:16 +0000
- Cc: 306346-forwarded@xxxxxxxxxxxxxxx
- In-reply-to: <20050426013716.GA3958@xxxxxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
- References: <20050426013716.GA3958@xxxxxxxxxxx>
On Apr 25, 9:37pm, Clint Adams wrote:
} Subject: [mpol@xxxxxxxxxxxxxxxxxxx: Bug#306346: zsh: replacement seems bro
}
} This is with 21170.
}
} ----- Forwarded message from Michal Politowski <mpol@xxxxxxxxxxxxxxxxxxx> -----
}
} ${${foo}/?*/replacement} puts replacement in the prompt even when foo is empty
Hrm. This seems to be strictly a promptsubst thing, because
schaefer<505> echo ${${foo}/?*/replacement}
schaefer<506> RPS1='${${foo}/?*/replacement}'
schaefer<507> setopt promptsubst ${${foo}/?*/replacement}
schaefer<508> replacement
Ah, here's an easier way to reproduce it:
schaefer<510> echo "${${foo}/?*/replacement}"
replacement
So it's a quoting thing.
According to GDB, both before and after 21170 the inner ${foo} is
resulting in "\233\0" (which is a Nularg). After 21170, however, the
comparison against ?* matches this as one character.
The problem is here at line 2344:
2344 if (pattrylen(p, t, s + l - t, umlen, ioff)) {
And it seems that this is the answer to the question in pattern.c:
/* inherited from domatch, but why, exactly? */
if (*string == Nularg)
string++;
This is precisely the case we're encountering here; it changes the value
of unmetalen within pattryrefs() in a way that we're not changing it
when precomputing it in igetmatch().
What I don't know, though, is whether the Nularg test should be copied
into both igetmatch() and down to by the ztrsub() call in pattryrefs(),
or whether it should simply be
/* inherited from domatch, but why, exactly? */
if (*string == Nularg)
string++, unmetalen--;
Messages sorted by:
Reverse Date,
Date,
Thread,
Author