python2.6 crashed with IndexError in get_prog_name()

Bug #361318 reported by Bender Rodriguez
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
python-profiler (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

Binary package hint: python2.6

running some of the modules (like python -m profile foo.py) doesn't work

ProblemType: Crash
Architecture: i386
Dependencies:
 libgcc1 1:4.3.3-5ubuntu4
 zlib1g 1:1.2.3.3.dfsg-12ubuntu2
 gcc-4.3-base 4.3.3-5ubuntu4
 findutils 4.4.0-2ubuntu4
 libc6 2.9-4ubuntu6
DistroRelease: Ubuntu 9.04
ExecutablePath: /usr/bin/python2.6
Package: python2.6-minimal 2.6.2~rc1-0ubuntu2
ProcCmdline: python -m profile -s f.py
ProcEnviron:
 SHELL=/bin/bash
 PATH=(custom, user)
 LANG=C
PythonArgs: []
SourcePackage: python2.6
Title: python2.6 crashed with IndexError in get_prog_name()
Uname: Linux 2.6.28-11-generic i686
UserGroups: adm admin audio cdrom dialout dip floppy lpadmin netdev plugdev powerdev scanner video

Revision history for this message
Bender Rodriguez (bender.rodriguez) wrote :
visibility: private → public
tags: removed: need-duplicate-check
Revision history for this message
Matthias Klose (doko) wrote :

- is python-profiler installed?
- could you proved a test case?

Changed in python2.6 (Ubuntu):
status: New → Incomplete
Revision history for this message
Bender Rodriguez (bender.rodriguez) wrote :

-python-profiler is installed: python-profiler 2.6.1-0ubuntu1

-problem seems to be related to the use of the module optparse, it does occur when wrong parameters are provided to the profiler module on the command line (like in this case; option '-s' needs a valid parameter)

-is not reproducible in other distros I have access to

-example: 'python -m profile -s spam'

Revision history for this message
Francesco Del Degan (pr0gg3d) wrote :

This seems related to code into profiler.py (2.4, 2.5, 2.6 all applies) around line 607:

    (options, args) = parser.parse_args()
    sys.argv[:] = args

    if (len(sys.argv) > 0):
        sys.path.insert(0, os.path.dirname(sys.argv[0]))
        run('execfile(%r)' % (sys.argv[0],), options.outfile, options.sort)
    else:
        parser.print_usage()
    return parser

"sys.argv" variable is substituted with "args" coming from parse_args, and it doesn't contains original sys.argv[0] necessary for print_usage in case new args after options (provided by command_line) are not present.

Imho, that sys.argv substitution should be inside "if" statement see (attached patch), let me know if it is correct to you.

thanks

Revision history for this message
Francesco Del Degan (pr0gg3d) wrote :
Revision history for this message
Francesco Del Degan (pr0gg3d) wrote :

Bug created upstream w/patch http://bugs.python.org/issue6635

Matthias Klose (doko)
Changed in python2.6 (Ubuntu):
status: Incomplete → In Progress
Matthias Klose (doko)
affects: python2.6 (Ubuntu) → python-profiler (Ubuntu)
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package python-profiler - 2.6.2-0ubuntu2

---------------
python-profiler (2.6.2-0ubuntu2) karmic; urgency=low

  * Fix issue #6635: Fix profiler printing usage message. LP: #361318.

 -- Matthias Klose <email address hidden> Sun, 13 Sep 2009 22:57:23 +0200

Changed in python-profiler (Ubuntu):
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.