Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: optimal expansions?
- X-seq: zsh-users 29850
- From: Stephane Chazelas <stephane@xxxxxxxxxxxx>
- To: Roman Perepelitsa <roman.perepelitsa@xxxxxxxxx>
- Cc: Ray Andrews <rayandrews@xxxxxxxxxxx>, zsh-users@xxxxxxx
- Subject: Re: optimal expansions?
- Date: Sun, 21 Apr 2024 17:14:40 +0100
- Archived-at: <https://zsh.org/users/29850>
- In-reply-to: <CAN=4vMrmUdgGuhDZjrrhCvQZaiSyCMPm0yAZMM0DYUGf6efDjg@mail.gmail.com>
- List-id: <zsh-users.zsh.org>
- Mail-followup-to: Roman Perepelitsa <roman.perepelitsa@xxxxxxxxx>, Ray Andrews <rayandrews@xxxxxxxxxxx>, zsh-users@xxxxxxx
- References: <53fab6be-26d7-4de5-844f-ffc295d9a494@eastlink.ca> <CAN=4vMqfcxt-C-g=4Sk13Qu28LFK46QCfXajhHfFMzLCcsXysg@mail.gmail.com> <3d15311d-b5fa-4a55-a17e-e61fcdded7d0@eastlink.ca> <CAN=4vMqoWSkGbnDuBqBBfCW602FeROjHV0npQVoTw+phRvZDAg@mail.gmail.com> <9fe68299-c89f-46a1-b10f-eefadd03a262@eastlink.ca> <CAN=4vMrmUdgGuhDZjrrhCvQZaiSyCMPm0yAZMM0DYUGf6efDjg@mail.gmail.com>
2024-04-21 16:19:24 +0200, Roman Perepelitsa:
> On Sun, Apr 21, 2024 at 4:10 PM Ray Andrews <rayandrews@xxxxxxxxxxx> wrote:
> >
> > On 2024-04-21 05:23, Roman Perepelitsa wrote:
> >
> > Seems we want '-r' most of the time. And the '--' should always be there.
> >
> > The missing `-r` is a bug. It should be there. The `--` in this case
> > is optional because the positional argument cannot start with a dash.
> >
> > But the '--' is good standard practice, yes?
>
> You can call it that. It's one of those standard practices that I
> don't follow, but if you find the trade-off palatable, go for it.
[...]
I would urge you to reconsider, especially for the "print"
built-in of zsh.
print $external_data
or
print -r $external_data
is a command injection vulnerability.
$ external_data='-vpsvar[1$(reboot)]' zsh -c 'print -r $external_data'
System going down for reboot now.
(I have actually singled-out zsh's print for that at
https://unix.stackexchange.com/questions/11376/what-does-double-dash-double-hyphen-mean/590210#590210)
--
Stephane
Messages sorted by:
Reverse Date,
Date,
Thread,
Author