tech-userlevel archive

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

Re: make: Unfinished character list in pattern



    Date:        Sat, 31 Oct 2026 22:56:41 +0100
    From:        Roland Illig <roland.illig%gmx.de@localhost>
    Message-ID:  <23522fbb-d445-457c-bb54-2ea782037404%gmx.de@localhost>

  | That was a deliberate change in order to catch cases where the end of a
  | range was accidentally omitted.

How about cases where the beginning of the range is accidentally omitted?

That explanation is really a fairly poor justification.

  | You can write :M*[-+]* instead.

That works in most cases, but how about when you want to match any
of a ']' a '-' or a '_'.

If you put the '-' first, then wherever you put the ']' it ends things
rather than being a character in the set of possibles.  If you put the
']' first (after the optional invert/negate character, assuming make has
one of those - ie: any char except...), which is the one place it cannot
end the set, as if it did, the set would be empty, which makes no sense
at all (for this purpose) then either you write
	[]-_]
in which case you get the range from ] to _ (which includes ^, which is
not intended to be there, but doesn't include '-' which is), or you
write
	[]_-]
which is the way that glob(7) intends it to be done, and the way it is
done in everything else that has glob style patterns, but which make
apparently rejects now.

I'd suggest reverting whatever change it was that made it an error to
put a '-' last - there are reasons that glob (since 6th edition days,
when glob was a separate program, not built into the Thompson shell,
though it did know when it should run glob) was designed the way it
was, inventing new/different syntaxes, for essentially the same purpose,
is just not the right thing to do.   If old sytle glob isn't what you
want, then the next step is to use RE's instead.

kre




Home | Main Index | Thread Index | Old Index