Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: P modify in history event
- X-seq: zsh-users 24449
- From: "Daniel Shahaf" <d.s@xxxxxxxxxxxxxxxxxx>
- To: zsh-users@xxxxxxx
- Subject: Re: P modify in history event
- Date: Tue, 19 Nov 2019 18:00:08 +0000
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= daniel.shahaf.name; h=mime-version:message-id:in-reply-to :references:date:from:to:subject:content-type :content-transfer-encoding; s=fm1; bh=HYVex4WXiMD538x4Mug3sZUxfx C/LAFXufyE/avAYM4=; b=D5GVak7l29VWTuuJKCMZt/m1+83YMvRZVqexTRrrfI 7eKQVt+VGfYsjDSIXLiR+I4IUS5hZT0kY6XEL19j7/dF3hexR0Ue0efQtyKrhkv+ m/AhcduyGeFGkn6wGVAM3NrqVS4BKnvE0O9YFyVAFJGoNNrJDzPj508aB1XlJ0n3 Hus5i8wtzQ5UVr5BZpG6AHpotQy7vpN1SdARLuvK291gbd1JbhNchTb6Ktdku7aJ 00JLWKlNffaQJ82aAmVWsX2E2S2zI0ULxa8XMKcfihOid8ZzKenogKei6+H4avm/ aM4qCHz4pG/fmHgRwz8CkipPwnmYKn7AAIWcyKJ26ySA==
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; bh=HYVex4WXiMD538x4Mug3sZUxfxC/LAFXufyE/avAY M4=; b=PWZiNJ0BEW/ORw8pCa/5wi+r58NB3fK9dhwllfRlqsB7FqeM5OTJl+UrI WhmwEXAspwNSaoX7IpF7xuzWeG+bamAM8QjHF6ouVpZpfc1IVoDT0tgs4K9yIeCY KHcfVvi3NVfiMydaOvWAU5w+Ovx9PuEMpxz3Xa7EMJuWAtXze7hmLbwaAWa61OD6 NBhiXVAfzSPLSLkWCp94aE9Z6gIY2L2uDw/f6DXHYLL/kaEak4sI41F435w1qMfU VT0AX4rQFGa/v4CpUwDu+l2FWD/1Ssy1lQ/lIdgCEdMFaAkHbsuNygDFhC4DueWQ 6i4QzwIdAUAIG/2bd++TmZurkS89Q==
- In-reply-to: <1574070429.4551.2.camel@samsung.com>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- List-unsubscribe: <mailto:zsh-users-unsubscribe@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <CGME20191117184333epcas5p15bc1aa7b0f78182c3d1acc703f55d445@epcas5p1.samsung.com> <BEBF5AEC-185E-4887-98D7-4731E1D8F7B0@easesoftware.com> <1574070429.4551.2.camel@samsung.com>
Peter Stephenson wrote on Mon, 18 Nov 2019 09:47 +00:00:
> On Sun, 2019-11-17 at 12:42 -0600, Perry Smith wrote:
> > I’m (slowly) reading through zshexpn and playing with things to
> > learn. This does not work:
> >
> > >
> > > pedz@MysticSlate my-play-dir % echo /this/is/a/../../path
> > > /this/is/a/../../path
> > > pedz@MysticSlate my-play-dir % echo !$:P
> > > zsh: illegal modifier: P
> > even if the file specified exists
>
> I think it just got missed out of the history modifiers, which are
> handled in a different place from the modifiers in the case of glob
> qualifiers and vaariables.
Thanks for fixing this. Test added in 030440d5b7bfd2968138836e962f1ef61ea0bae8.
> +++ b/Src/hist.c
> @@ -920,6 +920,16 @@ histsubchar(int c)
> + case 'P':
> + if (*sline != '/') {
> + char *here = zgetcwd();
> + if (here[strlen(here)-1] != '/')
Can «zgetcwd()» return an empty string? If that's possible, the
condition will be undefined behaviour («""[-1]»).
> + sline = zhtricat(metafy(here, -1, META_HEAPDUP), "/", sline);
> + else
> + sline = dyncat(here, sline);
> + }
> + sline = xsymlink(sline, 1);
> + break;
Cheers,
Daniel
Messages sorted by:
Reverse Date,
Date,
Thread,
Author