Bug 49 - ORB_init() reorders its arguments
Summary: ORB_init() reorders its arguments
Status: RESOLVED
Alias: None
Product: TAO
Classification: Unclassified
Component: ORB (show other bugs)
Version: 0.4
Hardware: All All
: P2 normal
Assignee: Luther Baker
URL:
Depends on:
Blocks:
 
Reported: 1999-07-09 19:30 CDT by Carlos O'Ryan
Modified: 1999-07-19 14:56 CDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Carlos O'Ryan 1999-07-09 19:30:40 CDT
Calling ORB_init() is supposed to eat its arguments, but it re-orders the
arguments it does not consume, more precisely:

args:
  -Files file1 file2 file3 -SomethingOther huhu -SomethingOther2 hihi

args stack now:
- -Files
file1
file2
file3
- -SomethingOther
huhu
- -SomethingOther2
hihi

assume the -SomethingOther options gets parsed first:
args stack now:
- -Files
file1
file2
file3
hihi                         <--- rearranged by consume_arg
- -SomethingOther2             <--- rearranged by consume_arg
huhu                         <--- rearranged by consume_arg
- -SomethingOther              <--- rearranged by consume_arg

		Thanks to  Lothar Werzinger <lwerzinger@krones.de> for reporting this problem.
Comment 1 Carlos O'Ryan 1999-07-09 19:49:59 CDT
*** Bug 50 has been marked as a duplicate of this bug. ***
Comment 2 Carlos O'Ryan 1999-07-15 12:28:59 CDT
Luther, David and myself think that you can take care of this problem.
It shouldn't be hard, please feel free to drop by my office if you have any
questions.
Comment 3 Luther Baker 1999-07-16 11:11:59 CDT
Building ACE/TAO currently. Will soon fix bug. 990716.
Comment 4 Luther Baker 1999-07-19 14:56:59 CDT
ORB_init(...) makes extensive use of an ACE_Arg_Shifter object. This object
correctly places 'consumed' arguments at the rear of argv. It also changes the
value of argc so that it DOES NOT GO HIGH ENOUGH to include the consumed
arguments.

Therefore, if -ORB... style arguments are consumed, the programmer must use argc
to find out how many arguments are left. I believe Lothar is using an integer
copy of argc (or predefined value) that is trying to access 'higher' elements of
argv - elements that were logically consumed.

The correct behavior for consume_args() will re-arrange each group of arguments
consumed - starting from the bottom up.

ljb1@cs.wustl.edu (Luther Baker) 990819