Subject: bin/24256: Some shell scripts pass arguments the wrong way
To: None <gnats-bugs@gnats.netbsd.org>
From: Christian Biere <christianbiere@gmx.de>
List: netbsd-bugs
Date: 01/27/2004 05:35:36
>Number: 24256
>Category: bin
>Synopsis: Some shell scripts pass arguments the wrong way
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: bin-bug-people
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Tue Jan 27 05:36:00 UTC 2004
>Closed-Date:
>Last-Modified:
>Originator: Christian Biere
>Release: NetBSD 1.6ZH
>Organization:
>Environment:
System: NetBSD cyclonus 1.6ZH NetBSD 1.6ZH (STARSCREAM) #2: Sun Jan 25 22:37:39 CET 2004 bin@cyclonus:/usr/build/src/sys/arch/i386/compile/STARSCREAM i386
>Description:
The correct way of passing through arguments "as-is", is to use ${1+"$@"}.
Everything else won't handle blanks in the arguments properly.
>How-To-Repeat:
$ touch 'blah blah.c'
$ c89 -c 'blah blah.c'
cc: blah: no such file or directory
cc: blah.c: no such file or directory
cc: no input files
>Fix:
Index: gnu/libexec/uucp/uusched/uusched.in
===================================================================
RCS file: /cvsroot/src/gnu/libexec/uucp/uusched/uusched.in,v
retrieving revision 1.2
diff -u -r1.2 uusched.in
--- gnu/libexec/uucp/uusched/uusched.in 1994/10/24 22:29:33 1.2
+++ gnu/libexec/uucp/uusched/uusched.in 2004/01/27 05:07:04
@@ -10,4 +10,4 @@
# This is pretty trivial, since all the functionality was moved into
# uucico itself.
#
-exec @SBINDIR@/uucico -r1 $*
+exec @SBINDIR@/uucico -r1 ${1+"$@"}
Index: gnu/libexec/uucp/uuto/uuto.in
===================================================================
RCS file: /cvsroot/src/gnu/libexec/uucp/uuto/uuto.in,v
retrieving revision 1.2
diff -u -r1.2 uuto.in
--- gnu/libexec/uucp/uuto/uuto.in 1994/10/24 22:30:02 1.2
+++ gnu/libexec/uucp/uuto/uuto.in 2004/01/27 05:07:04
@@ -13,4 +13,4 @@
# -c means to not copy the files to the spool directory (may be
# overriden by -C or -p).
#
-exec @BINDIR@/uucp -t -R -c $*
+exec @BINDIR@/uucp -t -R -c ${1+"$@"}
Index: gnu/usr.bin/c89/c89.sh
===================================================================
RCS file: /cvsroot/src/gnu/usr.bin/c89/c89.sh,v
retrieving revision 1.1
diff -u -r1.1 c89.sh
--- gnu/usr.bin/c89/c89.sh 2001/08/19 14:21:04 1.1
+++ gnu/usr.bin/c89/c89.sh 2004/01/27 05:07:33
@@ -1,33 +1,2 @@
-#!/bin/sh
-# Copyright (c) 1998 The NetBSD Foundation, Inc.
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-# 3. All advertising materials mentioning features or use of this software
-# must display the following acknowledgement:
-# This product includes software developed by the NetBSD
-# Foundation, Inc. and its contributors.
-# 4. Neither the name of The NetBSD Foundation nor the names of its
-# contributors may be used to endorse or promote products derived
-# from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
-# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
-# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
-# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-# POSSIBILITY OF SUCH DAMAGE.
-#
-exec /usr/bin/cc -ansi ${1+$@}
+#! /bin/sh
+exec /usr/bin/cc -ansi ${1+"$@"}
>Release-Note:
>Audit-Trail:
>Unformatted: