Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 6 Nov 2001 10:10:02 -0800 (PST)
From:      Eugene Grosbein <eugen@grosbein.pp.ru>
To:        freebsd-bugs@FreeBSD.org
Subject:   Re: bin/31627 sh(1) is broken - loss of data!
Message-ID:  <200111061810.fA6IA2F68366@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
The following reply was made to PR bin/31627; it has been noted by GNATS.

From: Eugene Grosbein <eugen@grosbein.pp.ru>
To: Thomas Quinot <thomas@cuivre.fr.eu.org>
Cc: Eugene Grosbein <eugen@svzserv.kemerovo.su>, stable@freebsd.org,
	freebsd-gnats-submit@freebsd.org
Subject: Re: bin/31627 sh(1) is broken - loss of data!
Date: Wed, 7 Nov 2001 01:00:20 +0700

 On Tue, Nov 06, 2001 at 06:18:34PM +0100, Thomas Quinot wrote:
 
 > > #!/bin/sh
 > > string=`printf "\21"`
 > > echo $string | hd
 >  
 > > Replace 21 with 201 and rerun. You see:
 > > 00000000  0a                                                |.|
 > > 00000001
 > 
 > Can't reproduce here for the value \201, but for the other values
 > you mention it looks like perfectly normal and expected behaviour
 > from sh(1). It is not surprising at all that some characters "disappear"
 > here: since $string appears unquoted, any character which is whitespace
 > w.r.t. shell parsing rules won't be passed to echo.
 > Try to quote your string:
 >   echo "$string" | hd
 
 I still get unexpected results:
 
 #!/bin/sh
 string=`printf "\210"`
 echo "$string" | hd
 
 gives me:
 00000000  0a                                                |.|
 00000001
 
 The same with \12 and \201. Other codes are Ok, thank you for explanation.
 I see that \12 is removed by backquotes but wonder what with \201 and \210.
 
 Eugene Grosbein

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200111061810.fA6IA2F68366>