NetBSD Problem Report #46455

From www@NetBSD.org  Tue May 15 09:02:22 2012
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [149.20.53.66])
	by www.NetBSD.org (Postfix) with ESMTP id 1B41963C785
	for <gnats-bugs@gnats.NetBSD.org>; Tue, 15 May 2012 09:02:22 +0000 (UTC)
Message-Id: <20120515090221.2389B63B86B@www.NetBSD.org>
Date: Tue, 15 May 2012 09:02:21 +0000 (UTC)
From: blink@bojary.koba.pl
Reply-To: blink@bojary.koba.pl
To: gnats-bugs@NetBSD.org
Subject: /bin/sh: set -C breaks 2>/dev/null redirection
X-Send-Pr-Version: www-1.0

>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:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue May 15 09:05:00 +0000 2012
>Closed-Date:    Tue Apr 05 08:50:49 +0000 2016
>Last-Modified:  Tue Apr 05 08:50:49 +0000 2016
>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:

>Release-Note:

>Audit-Trail:
From: Robert Elz <kre@munnari.OZ.AU>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: bin/46455 (/bin/sh: set -C breaks 2>/dev/null redirection)
Date: Mon, 22 Feb 2016 05:34:23 +0700

 I believe this is fixed in NetBSD current.   Not in 7.0 though.
 I'm not sure if pullups of the fix to -7 and -6 are appropriate
 or not.

 kre

State-Changed-From-To: open->closed
State-Changed-By: wiz@NetBSD.org
State-Changed-When: Tue, 05 Apr 2016 08:50:49 +0000
State-Changed-Why:
Fixed in -current, thanks for the report!


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2014 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.