NetBSD-Bugs archive

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

bin/53754: /bin/sh strips too many characters with %% modifier



>Number:         53754
>Category:       bin
>Synopsis:       /bin/sh strips too many characters with %% modifier
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Nov 30 19:50:00 +0000 2018
>Originator:     Roland Illig
>Release:        NetBSD 7.0.2
>Organization:
>Environment:
System: NetBSD nb7.fritz.box 7.0.2 NetBSD 7.0.2 (GENERIC.201610210724Z) amd64
Architecture: x86_64
Machine: amd64

>Description:
line="code // line comment /* block comment */"
printf '<%s>\n' "${line%%/\**}"

The %% should remove the longest suffix after "/*", since the first
asterisk is escaped. Bash and Ksh do it as expected, NetBSD's /bin/sh
doesn't. It removes everything after the first "/", whether or not that
is followed by a "*".

>How-To-Repeat:

>Fix:



Home | Main Index | Thread Index | Old Index