Merge lp:~marienz/apport/search-for-executable into lp:~ubuntu-core-dev/ubuntu/lucid/apport/ubuntu

Proposed by Marco Rodrigues
Status: Rejected
Rejected by: Martin Pitt
Proposed branch: lp:~marienz/apport/search-for-executable
Merge into: lp:~ubuntu-core-dev/ubuntu/lucid/apport/ubuntu
Diff against target: 51 lines (+27/-13)
1 file modified
apport/ui.py (+27/-13)
To merge this branch: bzr merge lp:~marienz/apport/search-for-executable
Reviewer Review Type Date Requested Status
Martin Pitt Disapprove
Review via email: mp+14568@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Martin Pitt (pitti) wrote :

For backwards compatibility, please check if it is a valid package name first, and only then fall back to searching $PATH.

You might also consider calling "which" to search the PATH.

review: Needs Fixing
Revision history for this message
Martin Pitt (pitti) wrote :
review: Disapprove

Unmerged revisions

1623. By Marien Zwart <marienz@siren>

When given a single argument also search $PATH for it.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'apport/ui.py'
--- apport/ui.py 2009-11-06 12:56:15 +0000
+++ apport/ui.py 2009-11-06 22:25:19 +0000
@@ -501,20 +501,34 @@
501 self.options.pid = sys.argv[1]501 self.options.pid = sys.argv[1]
502502
503 # executable?503 # executable?
504 elif '/' in sys.argv[1]:
505 pkg = apport.packaging.get_file_package(sys.argv[1])
506 if not pkg:
507 optparser.error('%s does not belong to a package.' % sys.argv[1])
508 sys.exit(1)
509 self.args = []
510 self.options.filebug = True
511 self.options.package = pkg
512
513 # otherwise: package name
514 else:504 else:
515 self.args = []505 if '/' in sys.argv[1]:
516 self.options.filebug = True506 # Use as absolute path to the executable.
517 self.options.package = sys.argv[1]507 fullpath = sys.argv[1]
508 else:
509 # Search $PATH for it:
510 for path in os.environ['PATH'].split(os.pathsep):
511 fullpath = os.path.join(path, sys.argv[1])
512 # This follows symlinks, which is what we want.
513 if os.path.isfile(fullpath):
514 break
515 else:
516 fullpath = None
517
518 if fullpath is not None:
519 pkg = apport.packaging.get_file_package(fullpath)
520 if not pkg:
521 optparser.error('%s does not belong to a package.' % fullpath)
522 sys.exit(1)
523 self.args = []
524 self.options.filebug = True
525 self.options.package = pkg
526
527 # otherwise: package name
528 else:
529 self.args = []
530 self.options.filebug = True
531 self.options.package = sys.argv[1]
518532
519 def format_filesize(self, size):533 def format_filesize(self, size):
520 '''Format the given integer as humanly readable and i18n'ed file size.'''534 '''Format the given integer as humanly readable and i18n'ed file size.'''

Subscribers

People subscribed via source and target branches

to all changes: