🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: muc.lists.netbsd.tech.userlevel
Article #61

Re: make: Unfinished character list in pattern

#61
From: Robert Elz
Date: Sun, 01 Nov 2026 16:22
75 lines
4226 bytes
    Date:        Sun, 1 Nov 2026 13:38:46 +0100
    From:        Roland Illig <roland.illig@gmx.de>
    Message-ID:  <16ce95cc-154d-41e6-96ca-12644cbfb9d6@gmx.de>

  | Depending on what you expect. Since 1993, your particular pattern has
  | also matched the words "UPPER", "Mixed" and "mixeD", but not "lower".

  | That's because when make(1) parses a character range such as '+-]', it
  | treats ']' as an ordinary character. The range is thus from '+' to ']',
  | which includes all uppercase letters.

Clearly a bug that needed to be fixed, the question is what the fix
should be.  Making the sequence '-]' into an error, rather than
meaning '-' is one of the characters in the set, and ']' ends it,
is almost certainly not the correct approach.

  | These two completely different interpretations of ']' make it
  | error-prone.

Definitely, simply wrong, and needs (or needed) fixing.

  | Therefore, even though "it is UNIX", I'd want make(1) to
  | reject patterns that behave unexpectedly, and this pattern is one of them.

You mean "behaved unexpectedly" - and "reject" is not the only solution.
That is, instead of making patterns which were broken previously be
rejected, just make them behave as they're expected to behave, so they
are no longer behaving unexpectedly.

Can you point to a single real world example where anything is assuming
that the way you have described make as having been working (and I fully
expect that you know what you're talking about there, and it did work
like that) is the intended operation of some Makefile ?

If there are none, then surely anyone who write "-]" to end a set of
chars to match, was intending to include a literal '-' in the set, and
that is what make should be causing to happen.

  | The pattern that does what you expect is "*[+-+-]*".

That's fine for that pattern, but it need not be that complex, and
users should not need to do this kind of bizarre manipulation (writing
individual characters as ranges from themselves to themselves) in order
to achieve what ought to be trivial.

I assume that "*[+-+---]*" would work as well?   But why?  "*[+-]*"
or "*[-+]*" should both work, as in both cases there are just 2 chars
between the brackets, a range requires three, hence there is no range.

That old make had a bug where it would treat the ']' as the end of a
range if preceded by a '-' which could be a range '-' instead of only
a literal one, is irrelevant, just fix that bug, so it no longer happens,
and there should be no further issues.   Make "make" behave like every
other unix utility which uses glob style patterns.  If writing the code
for that is hard, there's always fnmatch(3) which will do it for you.
(It is a POSIX standard function, so should exist, and work the same,
everywhere.)

kre


--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-admin@muc.de
Technical Details
Message-ID: <16959.1793550151@jacaranda.noi.kre.to>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!2.eu.feeder.erje.net!feeder.erje.net!news2.arglkargh.de!news.karotte.org!news.space.net!news.muc.de!.POSTED.news.muc.de!not-for-mail
References: <16ce95cc-154d-41e6-96ca-12644cbfb9d6@gmx.de> <>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!2.eu.feeder.erje.net!feeder.erje.net!news2.arglkargh.de!news.karotte.org!news.space.net!news.muc.de!.POSTED.news.muc.de!not-for-mail
From: Robert Elz <kre@munnari.OZ.AU>
Newsgroups: muc.lists.netbsd.tech.userlevel
Subject: Re: make: Unfinished character list in pattern
Date: Sun, 01 Nov 2026 23:22:31 +0700
Organization: Newsgate at muc.de e.V.
Sender: tech-userlevel-owner@NetBSD.org
Approved: news-admin@muc.de
Distribution: world
Message-ID: <16959.1793550151@jacaranda.noi.kre.to>
References: <16ce95cc-154d-41e6-96ca-12644cbfb9d6@gmx.de> <>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
Injection-Info: news.muc.de; posting-host="news.muc.de:193.149.48.2";
	logging-data="13453"; mail-complaints-to="news-admin@muc.de"
In-Reply-To: <16ce95cc-154d-41e6-96ca-12644cbfb9d6@gmx.de>
Precedence: bulk
X-Newsgate-Id: f02c70b8849f+
X-No-Archive: Yes