NetBSD Problem Report #35270

From lhp@toft-hp.dk  Mon Dec 18 03:05:59 2006
Return-Path: <lhp@toft-hp.dk>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
	by narn.NetBSD.org (Postfix) with ESMTP id DC24E63B8C9
	for <gnats-bugs@gnats.NetBSD.org>; Mon, 18 Dec 2006 03:05:58 +0000 (UTC)
Message-Id: <20061218030211.CC473FB67@toft-hp.dk>
Date: Mon, 18 Dec 2006 04:02:11 +0100 (CET)
From: lhp@toft-hp.dk
Reply-To: lhp@toft-hp.dk
To: gnats-bugs@NetBSD.org
Subject: globbing/redirection bug in csh
X-Send-Pr-Version: 3.95

>Number:         35270
>Category:       bin
>Synopsis:       globbing/redirection bug in csh
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Dec 18 03:10:01 +0000 2006
>Last-Modified:  Tue Jul 17 04:53:50 +0000 2007
>Originator:     Lasse H Petersen
>Release:        NetBSD 4.99.4
>Organization:
	Not terribly organised.
>Environment:


System: NetBSD dog.toft-hp.dk 4.99.4 NetBSD 4.99.4 (GENERIC.MP) #0: Fri Nov 24 11:47:13 UTC 2006 builds@b3.netbsd.org:/home/builds/ab/HEAD/i386/200611240000Z-obj/home/builds/ab/HEAD/src/sys/arch/i386/compile/GENERIC.MP i386
Architecture: i386
Machine: i386

>Description:
	This problem is not restricted to NetBSD, but seems to
	affect many, possibly all implementations of csh, including tcsh.

	When executing a command in csh, like
	command * >fil
	the file fil is created before the * is expanded, and as
	a result the file fil is included as argument to the command.
	If the command is for example a cat or grep, it may append
	the file fil onto itself, until the filesystem is full.

>How-To-Repeat:

	$ csh
	% mkdir foo
	% cd foo
	% touch a
	% echo *>foobar
	% cat foobar
	a foobar

>Fix:
	This is apparantly a bug in several csh implementations.
	A workaround, which could also be called a fix, would be
	not to use csh. This could be mandated by removing csh
	altogether, or suggested through addition of a comment in
	the bug section of the man page.

	A proper fix would be to change the order of globbing and
	redirection, so that the globbing is done before the stdout
	redirect file is created, or so that this file is filtered
	out from the resulting list of files.

>Release-Note:

>Audit-Trail:

>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-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.