NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
bin/38529: /bin/sh: Character 0x88 is illegal in redirects, 0x81 too
>Number: 38529
>Category: bin
>Synopsis: /bin/sh: Character 0x88 is illegal in redirects, 0x81 too
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: bin-bug-people
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Sun Apr 27 15:10:01 +0000 2008
>Originator: Christian Biere
>Release: NetBSD 4.99.7
>Organization:
>Environment:
System: NetBSD cyclonus 4.99.7 NetBSD 4.99.7 (STARSCREAM) #4: Wed Dec 27
02:37:42 CET 2006 src@cyclonus:/o/NetBSD/obj/sys/arch/i386/compile/STARSCREAM
i386
Architecture: i386
Machine: i386
>Description:
/bin/sh cannot handle filenames that contain characters \x81 or \x88 in
redirects because
it strips these characters before processing the string. Therefore it actually
accesses
the wrong file. It also fails to set the exit code appropriately indicating
success.
>How-To-Repeat:
Execute the following test shell script in a temporary directory:
#! /bin/sh
set -e
i=128
while [ $i -lt 256 ]
do
char="$(jot -c 1 "$i")"
name='./zomfg-'"$char"'.wtf'
echo LOL | dd of="$name" 2>/dev/null
if read text < "$name"
then rm -- "$name"
else printf 'Cannot handle filenames with char %#x\n' "$i"
fi
i=$(($i + 1))
done
exit
Note that there will be complaint if you run this before:
echo LOL > "zomfg-.wtf"
Because this file will be accessed instead of the intended file. If this wasn't
bad enough, /bin/sh does not even report an error if you replace "read" in the
above script with a non-built-in command like "cat" which is easily
reproducible:
cat < kjsdhbfkjsadfhdsjkhf && echo SUCCESS
The above prints SUCCESS after some error message when using /bin/sh.
>Fix:
None provided. As a workaround use ksh.
Home |
Main Index |
Thread Index |
Old Index