bzr patch --strip crash on non integer argument

Bug #237844 reported by MarcoBazzani
Affects Status Importance Assigned to Milestone
Fix Released
Jelmer Vernooij

Bug Description

using --strip with non relevant argument such as a character crash
here the stacktrace:
 bzr patch ~/Desktop/django-ticket#6845/6845-against-7424.diff --strip=a
bzr: ERROR: exceptions.ValueError: invalid literal for int() with base 10: 'a'

Traceback (most recent call last):
  File "/usr/lib/python2.5/site-packages/bzrlib/", line 846, in run_bzr_catch_errors
    return run_bzr(argv)
  File "/usr/lib/python2.5/site-packages/bzrlib/", line 797, in run_bzr
    ret = run(*run_argv)
  File "/usr/lib/python2.5/site-packages/bzrlib/plugins/bzrtools/", line 13, in run_argv_aliases
    commands.Command.run_argv_aliases(self, argv, alias_argv)
  File "/usr/lib/python2.5/site-packages/bzrlib/", line 472, in run_argv_aliases
    args, opts = parse_args(self, argv, alias_argv)
  File "/usr/lib/python2.5/site-packages/bzrlib/", line 551, in parse_args
    options, args = parser.parse_args(args)
  File "/usr/lib/python2.5/", line 1385, in parse_args
    stop = self._process_args(largs, rargs, values)
  File "/usr/lib/python2.5/", line 1425, in _process_args
    self._process_long_opt(rargs, values)
  File "/usr/lib/python2.5/", line 1500, in _process_long_opt
    option.process(opt, value, values, self)
  File "/usr/lib/python2.5/", line 782, in process
    self.action, self.dest, opt, value, values, parser)
  File "/usr/lib/python2.5/", line 802, in take_action
    self.callback(self, opt, value, parser, *args, **kwargs)
  File "/usr/lib/python2.5/site-packages/bzrlib/", line 237, in _optparse_callback
    v = self.type(value)
ValueError: invalid literal for int() with base 10: 'a'

bzr 1.5 on python 2.5.2 (linux2)
arguments: ['/usr/bin/bzr', 'patch', '/home/visi/Desktop/django-ticket#6845/6845-against-7424.diff', '--strip=a']
encoding: 'UTF-8', fsenc: 'UTF-8', lang: 'en_US.UTF-8'
  avahi /home/visi/.bazaar/plugins/avahi [0.2.0]
  bisect /home/visi/.bazaar/plugins/bisect [1.1.0pre0]
  bzrtools /usr/lib/python2.5/site-packages/bzrlib/plugins/bzrtools [1.5.0]
  dbus /usr/lib/python2.5/site-packages/bzrlib/plugins/dbus [unknown]
  gtk /usr/lib/python2.5/site-packages/bzrlib/plugins/gtk [0.93.0]
  launchpad /usr/lib/python2.5/site-packages/bzrlib/plugins/launchpad [unknown]
  svn /home/visi/.bazaar/plugins/svn [0.4.11dev0]
  upload /home/visi/.bazaar/plugins/upload [0.1.0]
*** Bazaar has encountered an internal error.
    Please report a bug at
    including this traceback, and a description of what you
    were doing when the error occurred.

Related branches

Jelmer Vernooij (jelmer)
affects: bzrtools → bzr
Changed in bzr:
importance: Undecided → Medium
status: New → Confirmed
Jelmer Vernooij (jelmer)
tags: added: check-for-breezy
Jelmer Vernooij (jelmer)
tags: removed: check-for-breezy
Jelmer Vernooij (jelmer)
Changed in brz:
status: New → In Progress
importance: Undecided → Medium
assignee: nobody → Jelmer Vernooij (jelmer)
milestone: none → 3.1.0
Jelmer Vernooij (jelmer)
Changed in brz:
status: In Progress → Fix Committed
status: Fix Committed → 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.