GNU bug report logs -
#77462
"/s" instability? I think this is a bug.
Previous Next
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
This seems to qualify as a bug:
The sed version included in my Linux seems to be unstable when using
the '\s' and/or '\S' regex extensions:
Example:
id <at> pc:~$ echo '[ subCA2 ]' | sed -n 's|^\[\s\+\([^\s]\+[0-
9]\+\)\s\+\]\s*$|\1|p'
id <at> pc:~$ echo '[ subCA2 ]' | sed -n 's:^\[\s\+\([\S]\+[0-
9]\+\)\s\+\]\s*$:\1:p'
id <at> pc:~$ echo '[ rootCA1 ]' | sed -n 's|^\[\s\+\([^\s]\+[0-
9]\+\)\s\+\]\s*$|\1|p'
rootCA1
If I replace '\s' with '[ \t]' (and '\S' with '[^ \t]') things work as
expected:
id <at> pc:~$ echo '[ subCA2 ]' | sed -n 's:^\[[ \t]\+\([^ \t]\+[0-9]\+\)[
\t]\+\][ \t]*$:\1:p'
subCA2
id <at> pc:~$ echo '[ rootCA2 ]' | sed -n 's:^\[[ \t]\+\([^ \t]\+[0-9]\+\)[
\t]\+\][ \t]*$:\1:p'
rootCA2
-----------------------------------------------------------------------
--------------------------
My Linux version:
Debian 12.10 as per 2025-04-02, terminal session in an Xfce4 desktop
environment, fully updated:
My sed version:
id <at> pc:~$ sed --version
sed (GNU sed) 4.9
Packaged by Debian
Copyright (C) 2022 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
<https://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Written by Jay Fenlason, Tom Lord, Ken Pizzini,
Paolo Bonzini, Jim Meyering, and Assaf Gordon.
This sed program was built with SELinux support.
SELinux is disabled on this system.
GNU sed home page: <https://www.gnu.org/software/sed/>.
General help using GNU software: <https://www.gnu.org/gethelp/>.
E-mail bug reports to: <bug-sed <at> gnu.org>.
id <at> pc:~$
-----------------------------------------------------------------------
--------------------------
Regards,
Vidar Hanto
Norway
[Message part 2 (text/html, inline)]
This bug report was last modified 72 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.