← Back to team overview

touch-packages team mailing list archive

[Bug 1378888] [NEW] OptionParser on PPC64LE does not split args correctly

 

Public bug reported:

The issue appears on PPC64 LE.
It is OK on (Ubuntu) x86_64.
Version of Python is 2.7.6 on both systems.
The issue is demonstrated while running AVRO Python tests (in lang/py : ant test).


- On Ubuntu / PPC64 LE :

$ pwd
..../lang/py
$ export PYTHONPATH=./build/src
$ /home/tony/AVRO/avro-FromFreshIBMSOEGitHub/lang/py/build/test/../scripts/avro cat /tmp/REIX --fields 'first, last'
{"first": "daffy"}
{"first": "bugs"}
{"first": "tweety"}
{"first": "road"}
{"first": "wile"}
{"first": "pepe"}
{"first": "foghorn"}
Usage: avro cat|write [options] FILE [FILE...]

avro: error: Can't open last - [Errno 2] No such file or directory: 'last'
$ echo $?
2

The issue is that 'first, last' is not parsed correctly. The white space
between "," and "last" is parsed in a way that makes "last" been
interpreted as a "FILE" instead of an option.


Without the white space, that works fine:

$ /home/tony/AVRO/avro-FromFreshIBMSOEGitHub/lang/py/build/test/../scripts/avro cat /tmp/REIX --fields 'first,last'
{"last": "duck", "first": "daffy"}
{"last": "bunny", "first": "bugs"}
{"last": "", "first": "tweety"}
{"last": "runner", "first": "road"}
{"last": "e", "first": "wile"}
{"last": "le pew", "first": "pepe"}
{"last": "leghorn", "first": "foghorn"}
$ echo $?
0


- On Ubuntu / x86_64, both 'first, last' and 'first,last' are OK:

$ pwd
..../lang/py
$ export PYTHONPATH=./build/src
$ build/test/../scripts/avro cat /tmp/REIX --fields 'first, last'
{"last": "duck", "first": "daffy"}
{"last": "bunny", "first": "bugs"}
{"last": "", "first": "tweety"}
{"last": "runner", "first": "road"}
{"last": "e", "first": "wile"}
{"last": "le pew", "first": "pepe"}
{"last": "leghorn", "first": "foghorn"}
$ echo $?
0


Source code of: /home/tony/AVRO/avro-FromFreshIBMSOEGitHub/lang/py/build/test/../scripts/avro  is:

def main(argv=None):
    import sys
    from optparse import OptionParser, OptionGroup

    argv = argv or sys.argv

    parser = OptionParser(description="Display/write for Avro files",
                      version="1.7.4",
                      usage="usage: %prog cat|write [options] FILE [FILE...]")
....

So, OptionParser() does not work on PPC64 like it does on x86_64.

** Affects: python2.7 (Ubuntu)
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Ubuntu
Touch seeded packages, which is subscribed to python2.7 in Ubuntu.
https://bugs.launchpad.net/bugs/1378888

Title:
  OptionParser on PPC64LE does not split args correctly

Status in “python2.7” package in Ubuntu:
  New

Bug description:
  The issue appears on PPC64 LE.
  It is OK on (Ubuntu) x86_64.
  Version of Python is 2.7.6 on both systems.
  The issue is demonstrated while running AVRO Python tests (in lang/py : ant test).

  
  - On Ubuntu / PPC64 LE :

  $ pwd
  ..../lang/py
  $ export PYTHONPATH=./build/src
  $ /home/tony/AVRO/avro-FromFreshIBMSOEGitHub/lang/py/build/test/../scripts/avro cat /tmp/REIX --fields 'first, last'
  {"first": "daffy"}
  {"first": "bugs"}
  {"first": "tweety"}
  {"first": "road"}
  {"first": "wile"}
  {"first": "pepe"}
  {"first": "foghorn"}
  Usage: avro cat|write [options] FILE [FILE...]

  avro: error: Can't open last - [Errno 2] No such file or directory: 'last'
  $ echo $?
  2

  The issue is that 'first, last' is not parsed correctly. The white
  space between "," and "last" is parsed in a way that makes "last" been
  interpreted as a "FILE" instead of an option.

  
  Without the white space, that works fine:

  $ /home/tony/AVRO/avro-FromFreshIBMSOEGitHub/lang/py/build/test/../scripts/avro cat /tmp/REIX --fields 'first,last'
  {"last": "duck", "first": "daffy"}
  {"last": "bunny", "first": "bugs"}
  {"last": "", "first": "tweety"}
  {"last": "runner", "first": "road"}
  {"last": "e", "first": "wile"}
  {"last": "le pew", "first": "pepe"}
  {"last": "leghorn", "first": "foghorn"}
  $ echo $?
  0

  
  - On Ubuntu / x86_64, both 'first, last' and 'first,last' are OK:

  $ pwd
  ..../lang/py
  $ export PYTHONPATH=./build/src
  $ build/test/../scripts/avro cat /tmp/REIX --fields 'first, last'
  {"last": "duck", "first": "daffy"}
  {"last": "bunny", "first": "bugs"}
  {"last": "", "first": "tweety"}
  {"last": "runner", "first": "road"}
  {"last": "e", "first": "wile"}
  {"last": "le pew", "first": "pepe"}
  {"last": "leghorn", "first": "foghorn"}
  $ echo $?
  0

  
  Source code of: /home/tony/AVRO/avro-FromFreshIBMSOEGitHub/lang/py/build/test/../scripts/avro  is:

  def main(argv=None):
      import sys
      from optparse import OptionParser, OptionGroup

      argv = argv or sys.argv

      parser = OptionParser(description="Display/write for Avro files",
                        version="1.7.4",
                        usage="usage: %prog cat|write [options] FILE [FILE...]")
  ....

  So, OptionParser() does not work on PPC64 like it does on x86_64.

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/python2.7/+bug/1378888/+subscriptions


Follow ups

References