bug-bash
[Top][All Lists]
Advanced

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

getopts: OPTARG should be unset after last option


From: llattanzi+bash
Subject: getopts: OPTARG should be unset after last option
Date: Mon, 21 Jun 2004 17:29:59 -0700 (PDT)

Configuration Information [Automatically generated, do not change]:
Machine: powerpc
OS: darwin8.0
Compiler: gcc
Compilation CFLAGS: -arch i386 -arch ppc -g -Os -pipe -no-cpp-precomp -arch i386 -arch ppc -pipe -DPROGRAM='bash' -DCONF_HOSTTYPE='powerpc' -DCONF_OSTYPE='darwin8.0' -DCONF_MACHTYPE='powerpc-apple-darwin8.0' -DCONF_VENDOR='apple' -DSHELL -DHAVE_CONFIG_H -DMACOSX -I. -I/SourceCache/bash/bash-30/bash -I/SourceCache/bash/bash-30/bash/include -I/SourceCache/bash/bash-30/bash/lib -arch i386 -arch ppc -g -Os -pipe -no-cpp-precomp -arch i386 -arch ppc -pipe uname output: Darwin stderr.apple.com 8.0.0b1 Darwin Kernel Version 8.0.0b1: Mon May 10 23:45:14 PDT 2004; root:xnu/xnu-600.3.obj~4/RELEASE_PPC Power Macintosh powerpc
Machine Type: powerpc-apple-darwin8.0

Bash Version: 2.05b
Patch Level: 0
Release Status: release

Description:
        OPTARG is still set after all options parsed

Repeat-By:
        getopts : optvar -x foo
        echo OPTARG=$OPTARG
        getopts : optvar -x foo
        echo OPTARG=$OPTARG
Fix:
Index: getopts.def
===================================================================
RCS file: /cvs/root/bash/bash/builtins/getopts.def,v
retrieving revision 1.1.1.5
diff -u -d -b -w -r1.1.1.5 getopts.def
--- getopts.def 2003/04/05 08:00:28     1.1.1.5
+++ getopts.def 2004/06/21 22:17:15
@@ -245,6 +245,7 @@
        
   if (ret == G_EOF)
     {
+      unbind_variable("OPTARG");
       getopts_bind_variable (name, "?");
       return (EXECUTION_FAILURE);
     }





reply via email to

[Prev in Thread] Current Thread [Next in Thread]