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
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 

Architecture: i386
Machine: i386

/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 
the wrong file. It also fails to set the exit code appropriately indicating 


Execute the following test shell script in a temporary directory:

#! /bin/sh
set -e
while [ $i -lt 256 ]
        char="$(jot -c 1 "$i")"
        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"
        i=$(($i + 1))

Note that there will be complaint if you run this before:

        echo LOL > ""

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 

        cat < kjsdhbfkjsadfhdsjkhf && echo SUCCESS

The above prints SUCCESS after some error message when using /bin/sh.


None provided. As a workaround use ksh.

Home | Main Index | Thread Index | Old Index