Strange Win32 ARGV problem

  • Thread starter Bennett, Patrick
  • Start date
B

Bennett, Patrick

This is a multi-part message in MIME format.

----=_NextPart_ST_15_55_03_Thursday_October_02_2003_2578
Content-Type: text/plain;
charset="US-ASCII"
Content-Transfer-Encoding: quoted-printable

Using the following one line ruby script (to dump out argv):
puts "ARGV:\n#{ARGV.join("\n")}\n---"
I'm seeing VERY strange behavior with Ruby 1.8.0:
=20
First, I'll show that 4 different files exist in a local directory.
=20
M:\builds\SYStest\eic\Yellow\products\EIC\src\attendant>dir
audiodetaildlg.*
Volume in drive M is WorkDrive3
Volume Serial Number is 90DB-A0F3
=20
Directory of M:\builds\SYStest\eic\Yellow\products\EIC\src\attendant
=20
09/04/2002 03:15 PM 3,817 AudioDetailDlg.cpp
03/25/2003 05:00 PM 1,498 AudioDetailDlg.h
2 File(s) 5,315 bytes
0 Dir(s) 6,820,958,208 bytes free
=20
M:\builds\SYStest\eic\Yellow\products\EIC\src\attendant>dir audionode.*
Volume in drive M is WorkDrive3
Volume Serial Number is 90DB-A0F3
=20
Directory of M:\builds\SYStest\eic\Yellow\products\EIC\src\attendant
=20
08/01/2002 02:25 PM 3,409 AudioNode.cpp
07/31/2002 04:07 PM 1,849 AudioNode.h
2 File(s) 5,258 bytes
0 Dir(s) 6,820,958,208 bytes free
=20
Now, I'll run the script that dumps out argv and pass it some wildcard
arguments which should match these files.
=20
M:\builds\SYStest\eic\Yellow\products\EIC\src\attendant>ruby bs.rb test
AudioDetailDlg.* AudioNode.*
ARGV:
test
AudioDetailDlg.* AudioNode.*
---
=20
Huh? Why did the two arguments get passed in as one argument to argv !?
This is causing some of my scripts serious problems. :(
=20
M:\builds\SYStest\eic\Yellow\products\EIC\src\attendant>ruby bs.rb test
AudioDetailDlg.*
ARGV:
test
AudioDetailDlg.cpp
AudioDetailDlg.h
---
Hmmm.... now it performed wildcard expansion and put the two files as
separate arguments.
Basically, the first option after a wildcard argument gets grouped in
with that wildcard parameter as a single argument and the expansion
doesn't occur.
=20
M:\builds\SYStest\eic\Yellow\products\EIC\src\attendant>ruby bs.rb test
AudioDetailDlg.* foo AudioNode.*
ARGV:
test
AudioDetailDlg.* foo
AudioNode.cpp
AudioNode.h
---
=20
Cheers...
Patrick Bennett

----=_NextPart_ST_15_55_03_Thursday_October_02_2003_2578
Content-Type: text/html;
charset="US-ASCII"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE>Message</TITLE>
<META http-equiv=3DContent-Type content=3D"text/html; charset=3Dus-ascii">
<META content=3D"MSHTML 6.00.2800.1226" name=3DGENERATOR></HEAD>
<BODY>
<DIV><SPAN class=3D286264720-02102003><FONT face=3DArial size=3D2>Using the=
following=20
one line ruby script (to dump out argv):</FONT></SPAN></DIV>
<DIV><SPAN class=3D286264720-02102003><FONT face=3DArial size=3D2>puts=20
"ARGV:\n#{ARGV.join("\n")}\n---"</FONT></SPAN></DIV>
<DIV><SPAN class=3D286264720-02102003><FONT face=3DArial size=3D2>I'm seein=
g VERY=20
strange behavior with Ruby 1.8.0:</FONT></SPAN></DIV>
<DIV><SPAN class=3D286264720-02102003><FONT face=3DArial=20
size=3D2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=3D286264720-02102003><FONT face=3DArial size=3D2>First, I'=
ll show=20
that 4 different files exist in a local directory.</FONT></SPAN></DIV>
<DIV><SPAN class=3D286264720-02102003><FONT face=3DArial size=3D2></FONT></=
SPAN><SPAN=20
class=3D286264720-02102003><FONT face=3DArial size=3D2></FONT></SPAN>&nbsp;=
</DIV>
<DIV><SPAN class=3D286264720-02102003><FONT face=3DArial=20
size=3D2>M:\builds\SYStest\eic\Yellow\products\EIC\src\attendant&gt;dir=20
audiodetaildlg.*<BR>&nbsp;Volume in drive M is WorkDrive3<BR>&nbsp;Volume S=
erial=20
Number is 90DB-A0F3</FONT></SPAN></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><SPAN class=3D286264720-02102003><FONT face=3DArial size=3D2>&nbsp;Dir=
ectory of=20
M:\builds\SYStest\eic\Yellow\products\EIC\src\attendant</FONT></SPAN></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><SPAN class=3D286264720-02102003><FONT face=3DArial size=3D2>09/04/200=
2&nbsp;=20
03:15 PM&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
nbsp;=20
3,817 AudioDetailDlg.cpp<BR>03/25/2003&nbsp; 05:00=20
PM&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
1,498=20
AudioDetailDlg.h<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
2 File(s)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 5,315=20
bytes<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;&nbsp;=20
0 Dir(s)&nbsp;&nbsp; 6,820,958,208 bytes free</FONT></SPAN></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><SPAN class=3D286264720-02102003><FONT face=3DArial=20
size=3D2>M:\builds\SYStest\eic\Yellow\products\EIC\src\attendant&gt;dir=20
audionode.*<BR>&nbsp;Volume in drive M is WorkDrive3<BR>&nbsp;Volume Serial=
=20
Number is 90DB-A0F3</FONT></SPAN></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><SPAN class=3D286264720-02102003><FONT face=3DArial size=3D2>&nbsp;Dir=
ectory of=20
M:\builds\SYStest\eic\Yellow\products\EIC\src\attendant</FONT></SPAN></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><SPAN class=3D286264720-02102003><FONT face=3DArial size=3D2>08/01/200=
2&nbsp;=20
02:25 PM&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
nbsp;=20
3,409 AudioNode.cpp<BR>07/31/2002&nbsp; 04:07=20
PM&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
1,849=20
AudioNode.h<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;&nbsp;&nbsp;=20
2 File(s)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 5,258=20
bytes<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;&nbsp;=20
0 Dir(s)&nbsp;&nbsp; 6,820,958,208 bytes free</FONT></SPAN></DIV>
<DIV><SPAN class=3D286264720-02102003><FONT face=3DArial=20
size=3D2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=3D286264720-02102003><FONT face=3DArial size=3D2>Now, I'll=
run the=20
script that dumps out argv and pass it some wildcard arguments which should=
=20
match these files.</FONT></SPAN></DIV>
<DIV><SPAN class=3D286264720-02102003><FONT face=3DArial=20
size=3D2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=3D286264720-02102003><FONT face=3DArial=20
size=3D2>M:\builds\SYStest\eic\Yellow\products\EIC\src\attendant&gt;ruby bs=
=2Erb=20
test AudioDetailDlg.* AudioNode.*<BR>ARGV:<BR>test<BR>AudioDetailDlg.*=20
AudioNode.*<BR>---</FONT></SPAN></DIV>
<DIV><SPAN class=3D286264720-02102003><FONT face=3DArial=20
size=3D2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=3D286264720-02102003><FONT face=3DArial size=3D2>Huh?&nbsp=
; Why did=20
the two arguments get passed in as one argument to argv !?</FONT></SPAN></D=
IV>
<DIV><SPAN class=3D286264720-02102003><FONT face=3DArial size=3D2>This is c=
ausing some=20
of my scripts serious problems.&nbsp; :(</FONT></SPAN></DIV>
<DIV><SPAN class=3D286264720-02102003><FONT face=3DArial=20
size=3D2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=3D286264720-02102003><FONT face=3DArial=20
size=3D2>M:\builds\SYStest\eic\Yellow\products\EIC\src\attendant&gt;ruby bs=
=2Erb=20
test=20
AudioDetailDlg.*<BR>ARGV:<BR>test<BR>AudioDetailDlg.cpp<BR>AudioDetailDlg.h=
<BR>---</FONT></SPAN></DIV>
<DIV><SPAN class=3D286264720-02102003><FONT face=3DArial size=3D2>Hmmm.... =
now=20
it&nbsp;performed wildcard expansion and put the two files as separate=20
arguments.</FONT></SPAN></DIV>
<DIV><SPAN class=3D286264720-02102003><FONT face=3DArial size=3D2>Basically=
,&nbsp;the=20
first option after&nbsp;a wildcard argument gets grouped in with that wildc=
ard=20
parameter as a single argument and&nbsp;the expansion doesn't=20
occur.</FONT></SPAN></DIV>
<DIV><SPAN class=3D286264720-02102003><FONT face=3DArial=20
size=3D2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=3D286264720-02102003><FONT face=3DArial=20
size=3D2>M:\builds\SYStest\eic\Yellow\products\EIC\src\attendant&gt;ruby bs=
=2Erb=20
test AudioDetailDlg.* foo AudioNode.*<BR>ARGV:<BR>test<BR>AudioDetailDlg.*
foo<BR>AudioNode.cpp<BR>AudioNode.h<BR>---</FONT></SPAN></DIV>
<DIV><SPAN class=3D286264720-02102003></SPAN><FONT face=3DArial><FONT size=3D=
2><SPAN=20
class=3D286264720-02102003></SPAN></FONT></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial><FONT size=3D2><SPAN=20
class=3D286264720-02102003>Cheers...</SPAN></FONT></FONT></DIV>
<DIV><FONT face=3DArial><FONT size=3D2><SPAN class=3D286264720-02102003>Pat=
rick=20
Bennett</DIV></SPAN></FONT></FONT></BODY></HTML>
=00
----=_NextPart_ST_15_55_03_Thursday_October_02_2003_2578--
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Strange Win32 ARGV problem 1
Test/Unit question 0
Petroleum Solvent Colours 0
[WIN32OLE]: Using Events 0
Help with code 0
Trouble with inherited 1
Slow ruby start up on XP 0
List problem 0

Members online

Forum statistics

Threads
473,967
Messages
2,570,148
Members
46,694
Latest member
LetaCadwal

Latest Threads

Top