NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
bin/39466: /bin/sh: eval and redirections
>Number: 39466
>Category: bin
>Synopsis: /bin/sh: eval and bad redirections
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: bin-bug-people
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Fri Sep 05 21:55:00 +0000 2008
>Originator: cheusov%tut.by@localhost
>Release: NetBSD 4.0_STABLE
>Organization:
>Environment:
System: NetBSD chen.chizhovka.net 4.0_STABLE NetBSD 4.0_STABLE (GENERIC) #0:
Wed Jul 16 00:28:58 EEST 2008
cheusov%chen.chizhovka.net@localhost:/srv/obj/sys/arch/i386/compile/GENERIC i386
Architecture: i386
Machine: i386
>Description:
Exit status of eval with bad redirection
~>bash -c 'eval "cat > /path/to/file"; echo $?'
bash: line 1: /path/to/file: No such file or directory
1
~>zsh -c 'eval "cat > /path/to/file"; echo $?'
zsh: no such file or directory: /path/to/file
1
~>ksh -c 'eval "cat > /path/to/file"; echo $?'
ksh: cannot create /path/to/file: No such file or directory
1
~>zsh -c 'eval "cat > /path/to/file"; echo $?'
zsh: no such file or directory: /path/to/file
1
~>mksh -c 'eval "cat > /path/to/file"; echo $?'
mksh: cannot create /path/to/file: No such file or directory
1
~>dash -c 'eval "cat > /path/to/file"; echo $?'
eval: 1: cannot create /path/to/file: Directory nonexistent
2
~>/usr/pkg/heirloom/bin/sh -c 'eval "cat > /path/to/fi>
/usr/pkg/heirloom/bin/sh: /path/to/file: cannot create
1
~>/bin/sh -c 'eval "cat > /path/to/file"; echo $?'
eval: cannot create /path/to/file: directory nonexistent
=> 0
~>
And 'set -e' too
0 ~>/usr/pkg/heirloom/bin/sh /home/cheusov/tmp/1.sh
/home/cheusov/tmp/1.sh: /path/to/bad/file.txt: cannot create
1 ~>/bin/ksh /home/cheusov/tmp/1.sh
/home/cheusov/tmp/1.sh: cannot create /path/to/bad/file.txt: No such file or
directory
1 ~>mksh /home/cheusov/tmp/1.sh
/home/cheusov/tmp/1.sh: cannot create /path/to/bad/file.txt: No such file or
directory
1 ~>dash /home/cheusov/tmp/1.sh
eval: 1: cannot create /path/to/bad/file.txt: Directory nonexistent
2 ~>zsh /home/cheusov/tmp/1.sh
(eval):1: no such file or directory: /path/to/bad/file.txt
1 ~>bash /home/cheusov/tmp/1.sh
/home/cheusov/tmp/1.sh: line 1: /path/to/bad/file.txt: No such file or
directory
1 ~>/bin/sh /home/cheusov/tmp/1.sh
eval: cannot create /path/to/bad/file.txt: directory nonexistent
=> This should not happen!
=> 0 ~>cat /home/cheusov/tmp/1.sh
#!/bin/sh
set -e
eval 'cat > /path/to/bad/file.txt'
echo "This should not happen!"
0 ~>
>Fix:
Unknown
Home |
Main Index |
Thread Index |
Old Index