Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: PATCH: typeset -n -H
- X-seq: zsh-workers 53366
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: Oliver Kiddle <opk@xxxxxxx>
- Cc: Zsh hackers list <zsh-workers@xxxxxxx>
- Subject: Re: PATCH: typeset -n -H
- Date: Fri, 14 Feb 2025 11:34:58 -0800
- Archived-at: <https://zsh.org/workers/53366>
- In-reply-to: <CAH+w=7YJsY7s-FDxB+1OVqahn68F=AjM3Unqk0YynYxN3m4ZQg@mail.gmail.com>
- List-id: <zsh-workers.zsh.org>
- References: <CAH+w=7aGegF=mk2oXnHod1WrdFdBtCstpHkZURvJ9YA48LwR3w@mail.gmail.com> <98757-1739291158.458303@J0dk.TjJZ.pj5i> <CAH+w=7YJsY7s-FDxB+1OVqahn68F=AjM3Unqk0YynYxN3m4ZQg@mail.gmail.com>
On Wed, Feb 12, 2025 at 8:27 PM Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
>
> On Tue, Feb 11, 2025 at 8:26 AM Oliver Kiddle <opk@xxxxxxx> wrote:
> >
> > Should +n -m be similarly blocked because that appears to work?
>
> I think you mean this?
Hang on, no, that can't be what you meant.
The existing code was already checking for (-n) rather than (+n):
> /* With the -m option, treat arguments as glob patterns */
> if (OPT_ISSET(ops,'m')) {
> if (!OPT_ISSET(ops,'p')) {
> - if (on & PM_NAMEREF) {
Whereas this ...
> + if ((on & PM_NAMEREF) && OPT_MINUS(ops,'m')) {
... would give a pass to (-n +m) as well ... whether that's OK depends
on whether it ends up acting as if -p was also given (doesn't alter
anything).
Removing the nameref flag (+n -m) just leaves behind a bunch of
scalars or does nothing to non-scalars, whereas adding it changes all
sorts of downstream semantics.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author