Bug 47710

Summary: Command line arguments not parsed correctly into argv variable
Product: [Retired] Red Hat Linux Reporter: Kyle Bateman <kyle>
Component: tcltkAssignee: Jens Petersen <petersen>
Status: CLOSED RAWHIDE QA Contact: David Lawrence <dkl>
Severity: high Docs Contact:
Priority: high    
Version: 7.1   
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2001-07-06 16:42:34 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Kyle Bateman 2001-07-06 16:42:31 UTC
From Bugzilla Helper:
User-Agent: Mozilla/4.77 [en] (X11; U; Linux 2.4.2-2 i686)

Description of problem:
There is discussion on comp.lang.tcl about what this problem is and how to
fix it (see the message header:  Re: BUG: TclX argv is wrong!!

I just built a single patch file from the messages and applied it against
the standard 7.1 src RPM (and tested it).

How reproducible:
Always

Steps to Reproduce:
1. create a wishx script test containing:
2. puts $argv
3. run script: ./test hello there
	

Actual Results:  output is:

hello there there

Expected Results:  hello there

Additional info:

patch file ready to drop into rpm as patch33:

--- tclX8.2.0/tk/generic/tkXshell.c     Sun Feb  6 17:54:00 2000
+++ tclX8.2.0/tk/generic/tkXshell.c.new Fri Jul  6 10:11:35 2001
@@ -191,12 +191,13 @@
     fileName = NULL;
     argi = 1;
     while ((argi < argc) && (argv[argi][0] == '-')) {
-        argi++;
         if (STREQU(argv[argi], "--")) {
-            break; /* end of options */
+          argi++;
+          break; /* end of options */
         } else if (!STREQU(argv[argi], "-sync")) {
-            argi++; /* takes an argument */
+          argi++; /* takes an argument */
         }
+        argi++;
     }
     /* Parse out file name, if supplied. */
     if (argi < argc) {
@@ -211,7 +212,7 @@
         while (argi < argc) {
             argv[i++] = argv[argi++];
         }
-        argc = i+1;
+        argc = i;
     }
 #else
     /*

Comment 1 Eido Inoue 2001-07-10 16:57:09 UTC
Thanks for the patch. Added for the next release/beta.