bin/172862: sed improperly deals with escape chars

John D. Hendrickson and Sara Darnell johnandsara2 at cox.net
Sun Oct 21 00:50:01 UTC 2012


The following reply was made to PR bin/172862; it has been noted by GNATS.

From: "John D. Hendrickson and Sara Darnell" <johnandsara2 at cox.net>
To: Garrett Cooper <yanegomi at gmail.com>
Cc: freebsd-gnats-submit at FreeBSD.org
Subject: Re: bin/172862: sed improperly deals with escape chars
Date: Sat, 20 Oct 2012 20:37:25 -0400

 Hi.  This should be files as a Question not a Bug.  You need to investigate things before claiming 
 "bug".
 
 
  > $ echo "foot " | sed -e 's/[\\t ]*$//' | hexdump -C
 
 What I see is your using [] wrong.  '\t' doesn't go inside it for many WELL documented reasons.
 
 Furthermore sed mathes '\t' without [] so why bother filing a bug against [] ?
 
 '\t' has been around more years than your were born and probably sed too...
 
 anyhow.  "ediquitte" is you ask questions to users and file bugs about only if your very as 
 professor sure and also know how to fix it (pref. wtih code patch filed which absolutely CANNOT 
 cause past software to stop working).
 
 
 p.s.
 
 So, when you see a "majorly relied upon" unix tool doing "something stupid"
 it's very likely you have more learning and asking to do.
 
 1) you don't want people hacking sed to make it work your way it would break
     past software
 
 2) you don't want BSD-SED to have false bugs filed it will make BSD look worse
     than it is
 
 3)  since early stable versions of free bsd, bsd has accumulated
     way too many bugs and fixes and hardware compat changes - about
     a suspicious ammount - and still isn't as stable as it had been )
 
 
 Garrett Cooper wrote:
 >> Number:         172862
 >> Category:       bin
 >> Synopsis:       sed improperly deals with escape chars
 >> Confidential:   no
 >> Severity:       non-critical
 >> Priority:       low
 >> Responsible:    freebsd-bugs
 >> State:          open
 >> Quarter:        
 >> Keywords:       
 >> Date-Required:
 >> Class:          sw-bug
 >> Submitter-Id:   current-users
 >> Arrival-Date:   Thu Oct 18 21:10:00 UTC 2012
 >> Closed-Date:
 >> Last-Modified:
 >> Originator:     Garrett Cooper
 >> Release:        9.1-STABLE
 >> Organization:
 > EMC Isilon
 >> Environment:
 > FreeBSD bayonetta.local 9.1-PRERELEASE FreeBSD 9.1-PRERELEASE #0 r240836M: Sat Sep 22 12:30:11 PDT 2012     gcooper at bayonetta.local:/usr/obj/store/freebsd/stable/9/sys/BAYONETTA  amd64
 >> Description:
 > sed doesn't appear to be doing the right thing with escape chars (in this case '\t'); it's not properly reinterpreting '\t' as \011, but is instead interpreting it was 't':
 > 
 > $ echo "foot " | sed -e 's/[\\t ]*$//' | hexdump -C
 > 00000000  66 6f 6f 0a                                       |foo.|
 > 00000004
 > $ echo "foot " | sed -E -e 's/[\\t ]*$//' | hexdump -C
 > 00000000  66 6f 6f 0a                                       |foo.|
 > 00000004
 > 
 > GNU sed does do the right thing with escape chars (verified on Fedora 17):
 > 
 > # cat /etc/redhat-release
 > Fedora release 17 (Beefy Miracle)
 > # echo foot | sed -e 's/[\t ]*$//' | hexdump -C
 > 00000000  66 6f 6f 74 0a                                    |foot.|
 > 00000005
 > # echo "foot " | sed -e 's/[\t ]*$//' | hexdump -C
 > 00000000  66 6f 6f 74 0a                                    |foot.|
 > 00000005
 >> How-To-Repeat:
 > echo foot | sed -e 's/[\t ]*$//'
 >> Fix:
 > 
 > 
 >> Release-Note:
 >> Audit-Trail:
 >> Unformatted:
 > _______________________________________________
 > freebsd-bugs at freebsd.org mailing list
 > http://lists.freebsd.org/mailman/listinfo/freebsd-bugs
 > To unsubscribe, send any mail to "freebsd-bugs-unsubscribe at freebsd.org"
 > 
 


More information about the freebsd-bugs mailing list