NetBSD Problem Report #46115

From cheusov@tut.by  Wed Feb 29 18:28:42 2012
Return-Path: <cheusov@tut.by>
Received: from mail.netbsd.org (mail.netbsd.org [149.20.53.66])
	by www.NetBSD.org (Postfix) with ESMTP id C3E9D63B952
	for <gnats-bugs@gnats.netbsd.org>; Wed, 29 Feb 2012 18:28:42 +0000 (UTC)
Message-Id: <87k435lcrm.fsf@asrock.chizhovka.net>
Date: Wed, 29 Feb 2012 21:23:25 +0300
From: cheusov@tut.by
To: gnats-bugs@gnats.NetBSD.org
Subject: make: bug in :M (dash inside [])
X-Send-Pr-Version: 3.95

>Number:         46115
>Category:       bin
>Synopsis:       make: bug in :M (dash inside [])
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    rillig
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Feb 29 18:30:04 +0000 2012
>Closed-Date:    Sun Jun 29 08:04:42 +0000 2025
>Last-Modified:  Sun Jun 29 08:04:42 +0000 2025
>Originator:     Aleksey Cheusov
>Release:        NetBSD 6.0_BETA
>Organization:
>Environment:
System: NetBSD asrock.chizhovka.net 6.0_BETA NetBSD 6.0_BETA (GENERIC) #0: Sun Feb 19 21:21:58 FET 2012 cheusov@asrock.chizhovka.net:/srv/obj/sys/arch/amd64/compile/GENERIC amd64
Architecture: x86_64
Machine: amd64
>Description:
From make(1)

     :Mpattern
          Select only those words that match pattern.  The standard shell
          wildcard characters (`*', `?', and `[]') may be used.  The wildcard
          characters may be escaped with a backslash (`\').

Actually dash inside [] works partially.

    0 cheusov>cat ~/tmp/1.mk
    foo = -

    all:
        @echo match=${foo:M[.-]}
        @echo match=${foo:M[-.]}
    0 cheusov>make -f ~/tmp/1.mk
    match=
    match=-
    0 cheusov>

That is, dash in the end of [] doesn't work as it works in shell.

    0 cheusov>touch -- -
    0 cheusov>echo [-.]
    -
    0 cheusov>echo [.-]
    -
    0 cheusov>

>How-To-Repeat:
See below

>Fix:

Unknown
>Release-Note:

>Audit-Trail:

Responsible-Changed-From-To: bin-bug-people->rillig
Responsible-Changed-By: rillig@NetBSD.org
Responsible-Changed-When: Sun, 29 Jun 2025 08:04:42 +0000
Responsible-Changed-Why:
I'm taking it.


State-Changed-From-To: open->closed
State-Changed-By: rillig@NetBSD.org
State-Changed-When: Sun, 29 Jun 2025 08:04:42 +0000
State-Changed-Why:
Invalid patterns in the :M and :N modifiers are now rejected.
Here's the history from 1993 to now:

1993.03.21.09.45.37
| match=
| match=-
| exit status 0
2023.06.23.04.41.24

2023.06.23.04.56.54
| make: warning: Unfinished character list in pattern '[.-]' of modifier ':M'
| match=
| match=-
| exit status 0
2024.04.14.15.21.20

... some changes to the output format of diagnostics ...

2024.07.09.17.07.23
| make: in target "all": while evaluating variable "foo" with value "-": Unfinished character list in pattern '[.-]' of modifier ':M'
| match=
| match=-
| exit status 0
2024.07.09.17.07.23

... some changes for better error handling ...

2025.03.29.10.39.48
| make: Unfinished character list in pattern '[.-]' of modifier ':M'
|       while evaluating variable "foo" with value "-"
|       in command "@echo match=${foo:M[.-]}"
|       in target "all"
| exit status 2
/usr/bin/make


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.47 2022/09/11 19:34:41 kim Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2025 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.