nmh-workers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

ali(1)'s glob Matching is Too Slack.


From: Ralph Corderoy
Subject: ali(1)'s glob Matching is Too Slack.
Date: Tue, 15 Nov 2022 19:13:47 +0000

Hi,

I was just pootering about adding comments at the start of functions in
uip/aliasbr.c to document what they do, which means working out what
they do, and noticed this.

    $ ali -alias <(echo 'foo*bar: xyzzy') foonot
    xyzzy
    $

I think the ordinary punter would expect ‘foo*bar’ to need ‘bar’ to
match at the end.

mh-alias(5) says

    In match, a trailing “*” on an alias will match just about anything
    appropriate.
...
        news.*: news
...
    Lastly, “news.anything” is aliased to “news”; the full stop is just
    another literal character.

My ‘*’ in the example above isn't trailing but still globs.

My comment so far is:

    /* Does string match aliasent where the latter may contain a ‘*’ which
     * matches zero or more characters and stops matching,
     * e.g. "foobar" matches "foo*xyzzy". */
    static bool
    aleq (char *string, char *aliasent)

I think the fix is to allow only a single ‘*’ which must be the last
character but this may break some user's habits.

-- 
Cheers, Ralph.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]