NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

bin/46455: /bin/sh: set -C breaks 2>/dev/null redirection



>Number:         46455
>Category:       bin
>Synopsis:       /bin/sh: set -C breaks 2>/dev/null redirection
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue May 15 09:05:00 +0000 2012
>Originator:     Paul Onyschuk
>Release:        6.0_BETA
>Organization:
>Environment:
NetBSD Labla 6.0_BETA NetBSD 6.0_BETA (GENERIC) i386
>Description:
/bin/sh doesn't handle noclobber option and 2>/dev/null redirection
at the same time.  Script fails just silently and aborts further
execution. This can be overridden by using 2>|/dev/null instead
(n<>| overrides -C).

Still what concerns me is the difference in behavior of /bin/sh
and /bin/ksh. With ksh it works just fine. Is this intended behavior
of /bin/sh or a bug?

>How-To-Repeat:
#!/bin/sh
#
# Empty file with "testfile" name should be created,
# if it doesn't exist yet. 
#

set -C
2>/dev/null > testfile && echo "yes, it works!"
>Fix:



Home | Main Index | Thread Index | Old Index