Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: PATCH: typeset -n -H



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