Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 06 Nov 2001 23:39:55 +0700
From:      Eugene Grosbein <eugen@svzserv.kemerovo.su>
To:        stable@freebsd.org
Subject:   sh(1) is broken - loss of data!
Message-ID:  <3BE8125B.E7DA340C@svzserv.kemerovo.su>

next in thread | raw e-mail | index | archive | help
Hi!

Try this script:

#!/bin/sh
string=`printf "\21"`
echo $string | hd

You see:
00000000  11 0a                                             |..|
00000002

That's right.

Replace 21 with 201 and rerun. You see:
00000000  0a                                                |.|
00000001

Very, very bad. The character is just missing.
I've found this accidentally and sent bin/31627.

Then I used this script and found more codes:

#!/bin/sh
i=0
jot -c 256 0 | while read s # we try each code in [0..255]
do
 echo -n $i
 echo "$s" | wc -c # this mush show 2: first is our char and last is \n
 i=$(($i+1))
done | grep -v '2$' # find which is processed incorrectly

These codes (in decimal) that are processed incorrectly: 
0, 9, 10, 11, 33, 129 and 136.

That does not depend of locale settings.
It is very annoying bug, some of my scripts just 
cannot handle (f.e., remove) files when names contain
some of these codes.

Eugene Grosbein

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




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