Menu

#8 boot_service.py w_getopt BUGFIX

closed-invalid
nobody
None
5
2006-06-02
2004-07-13
Anonymous
No

Hi,
I've notice that in file boot_service.py the w_getopt
function doesen't work as aspected.

This is the old broken code that forget to
remove the last ":" and never detect it adding
it twice in the if sentence:

<snip>
if args[0][:1] in "/-":
arg = args[0][1:] # strip the '-' or '/'
arg = arg.lower()
if arg + ':' in options:
<snip>

This is the new code that add the ":" case:

<snip>
if args[0][:1] in "/-":
arg = args[0][1:] # strip the '-' or '/'
arg = arg.lower()
if arg.endswith(":") : # strip the ':'
arg = arg[:-1]
if arg + ':' in options:
<snip>

Thanks in advance,
luca <l.montecchiani@teamsystem.com>

Discussion

  • Nobody/Anonymous

    Logged In: NO

    Oops the new code with indentation made with "_" :

    <snip>
    if args[0][:1] in "/-":
    ____arg = args[0][1:] # strip the '-' or '/'
    ____arg = arg.lower()
    ____if arg.endswith(":") : # strip the ':'
    ________arg = arg[:-1]
    ____if arg + ':' in options:
    <snip>

     
  • Mark Hammond

    Mark Hammond - 2006-06-02

    Logged In: YES
    user_id=14198

    Note that the trailing ':' is *not* supposed to be specified
    on the command-line - like the getopt module, that simply
    indicates that the option requires an argument.

    For example, a command-line could be:

    foo.py -install -user username

    Note that -install requires no args, but -user does. Note
    that the ':' is never added to the cmdline.

    Please reopen this bug if I have misunderstood, but please
    include an example of a valid command-line that fails to
    work with the existing code.

     
  • Mark Hammond

    Mark Hammond - 2006-06-02
    • status: open --> closed-invalid
     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.