typeerror in globbing.match

Bug #152811 reported by Martin Pool
4
Affects Status Importance Assigned to Milestone
Bazaar
Fix Released
Medium
Dan Watkins

Bug Description

I made bzr crash when trying to remove a directory using
'bzr remove ll/'
The crash report follows, please send me a note if you wish more
detailed information.
regards, Adrian Daerr

kuroko:phynumM1> bzr remove ll/
bzr: ERROR: exceptions.TypeError: expected string or buffer

Traceback (most recent call last):
  File "/usr/lib/python2.4/site-packages/bzrlib/commands.py", line 800,
in run_bzr_catch_errors
    return run_bzr(argv)
  File "/usr/lib/python2.4/site-packages/bzrlib/commands.py", line 758,
in run_bzr
    ret = run(*run_argv)
  File "/usr/lib/python2.4/site-packages/bzrlib/commands.py", line 492,
in run_argv_aliases
    return self.run(**all_cmd_args)
  File "/usr/lib/python2.4/site-packages/bzrlib/builtins.py", line
1121, in run
    force=file_deletion_strategy=='force')
  File "/usr/lib/python2.4/site-packages/bzrlib/mutabletree.py", line
50, in tree_write_locked
    return unbound(self, *args, **kwargs)
  File "/usr/lib/python2.4/site-packages/bzrlib/workingtree.py", line
1847, in remove
    if not self.is_ignored(path[1]) and (
  File "/usr/lib/python2.4/site-packages/bzrlib/workingtree.py", line
1604, in is_ignored
    return self._ignoreglobster.match(filename)
  File "/usr/lib/python2.4/site-packages/bzrlib/globbing.py", line 213,
in match
    match = regex.match(filename)
TypeError: expected string or buffer

bzr 0.91.0 on python 2.4.4.final.0 (linux2)
arguments: ['/usr/bin/bzr', 'remove', 'll/']

Related branches

Revision history for this message
Martin Pool (mbp) wrote : Re: bug report

On 10/12/07, Adrian <email address hidden> wrote:
> I made bzr crash when trying to remove a directory using
> 'bzr remove ll/'
> The crash report follows, please send me a note if you wish more
> detailed information.
> regards, Adrian Daerr

Thankyou for the report.

https://bugs.edge.launchpad.net/bzr/+bug/152811

Could you please tell me whether anything called ll exists in the
working directory, and what's in your .bzrignore file?
--
Martin

Changed in bzr:
importance: Undecided → Medium
Revision history for this message
Marius Kruger (amanica) wrote :

One of my colleagues got the same error when trying to remove a binary file.
It seems to be the same problem.

Note that both are runing python 2.4.
Do we have any unit tests for removing a binary file?
I'm pretty sure we have tests for removing directories though.
Is PQM running python 2.5?

==
bzr: ERROR: exceptions.TypeError: expected string or buffer

Traceback (most recent call last):
 File "/usr/lib/python2.4/site-packages/bzrlib/commands.py", line 800, in run_bzr_catch_errors
   return run_bzr(argv)
 File "/usr/lib/python2.4/site-packages/bzrlib/commands.py", line 758, in run_bzr
   ret = run(*run_argv)
 File "/usr/lib/python2.4/site-packages/bzrlib/commands.py", line 492, in run_argv_aliases
   return self.run(**all_cmd_args)
 File "/usr/lib/python2.4/site-packages/bzrlib/builtins.py", line 1121, in run
   force=file_deletion_strategy=='force')
 File "/usr/lib/python2.4/site-packages/bzrlib/mutabletree.py", line 50, in tree_write_locked
   return unbound(self, *args, **kwargs)
 File "/usr/lib/python2.4/site-packages/bzrlib/workingtree.py", line 1847, in remove
   if not self.is_ignored(path[1]) and (
 File "/usr/lib/python2.4/site-packages/bzrlib/workingtree.py", line 1604, in is_ignored
   return self._ignoreglobster.match(filename)
 File "/usr/lib/python2.4/site-packages/bzrlib/globbing.py", line 213, in match
   match = regex.match(filename)
TypeError: expected string or buffer

bzr 0.91.0 on python 2.4.3.final.0 (linux2)
arguments: ['/usr/local/bin/bzr', 'remove', 'src/za/co/enerweb/enerbench/client/images/action/back.gif', 'src/za/co/enerweb/enerbench/client/images/action/fastforward.gif', 'src/za/co/enerweb/enerbench/client/images/action/find.gif', 'src/za/co/enerweb/enerbench/client/images/action/forward.gif', 'src/za/co/enerweb/enerbench/client/images/action/rewind.gif']

** please send this report to <email address hidden>

Revision history for this message
Marius Kruger (amanica) wrote :

I was able to reproduce it with the directory but not the binary file.
I proved that it only happens on python 2.4

==python 2.4==

$ /usr/bin/python2.4 /usr/bin/bzr rm x
deleted x/arm.jpg
deleted x

$ bzr revert

$ /usr/bin/python2.4 /usr/bin/bzr rm x/
bzr: ERROR: exceptions.TypeError: expected string or buffer

Traceback (most recent call last):
  File "/stuph/projects/bzr/bzr.repo/bzr.dev/bzrlib/commands.py", line 802, in run_bzr_catch_errors
    return run_bzr(argv)
  File "/stuph/projects/bzr/bzr.repo/bzr.dev/bzrlib/commands.py", line 758, in run_bzr
    ret = run(*run_argv)
  File "/stuph/projects/bzr/bzr.repo/bzr.dev/bzrlib/commands.py", line 492, in run_argv_aliases
    return self.run(**all_cmd_args)
  File "/stuph/projects/bzr/bzr.repo/bzr.dev/bzrlib/builtins.py", line 1120, in run
    force=file_deletion_strategy=='force')
  File "/stuph/projects/bzr/bzr.repo/bzr.dev/bzrlib/mutabletree.py", line 51, in tree_write_locked
    return unbound(self, *args, **kwargs)
  File "/stuph/projects/bzr/bzr.repo/bzr.dev/bzrlib/workingtree.py", line 1885, in remove
    if not self.is_ignored(path[1]) and (
  File "/stuph/projects/bzr/bzr.repo/bzr.dev/bzrlib/workingtree.py", line 1646, in is_ignored
    return self._ignoreglobster.match(filename)
  File "/stuph/projects/bzr/bzr.repo/bzr.dev/bzrlib/globbing.py", line 213, in match
    match = regex.match(filename)
TypeError: expected string or buffer

==python 2.5==

$ bzr revert
+N x/
+N x/arm.jpg

$ bzr rm x/
deleted x/arm.jpg
deleted x

Revision history for this message
Marius Kruger (amanica) wrote :

reproducible on python 2.4
when `bzr rm x/` is called in stead of `bzr rm x`

Changed in bzr:
status: New → Confirmed
Revision history for this message
Martin Pool (mbp) wrote : Re: [Bug 152811] Re: typeerror in globbing.match

Thanks for the reproduction Marius,

I don't think pqm runs python2.4 anymore because we were generally not
seeing many differences from 2.5.

I tried to follow your reproduction script and did not see the error -
did I miss something?

(=bzr is a zsh abbreviation for "bzr from my path")

[1] mbp@grace% bzr init /tmp/t
[1] mbp@grace% cd /tmp/t
[1] mbp@grace% touch a
[1] mbp@grace% mkdir a
[1] mbp@grace% mkdir a/
[1] mbp@grace% touch a/b
[1] mbp@grace% python2.4 =bzr add
/home/mbp/old/bzr.20071016/pack-repository/bzrlib/patiencediff.py:127:
RuntimeWarning: Python C API version mismatch for module
_patiencediff_c: This Python has API version 1012, module
_patiencediff_c has version 1013.
  from bzrlib._patiencediff_c import (
added a
added a/b
[1] mbp@grace% python2.4 =bzr ci -m foo
/home/mbp/old/bzr.20071016/pack-repository/bzrlib/patiencediff.py:127:
RuntimeWarning: Python C API version mismatch for module
_patiencediff_c: This Python has API version 1012, module
_patiencediff_c has version 1013.
  from bzrlib._patiencediff_c import (
Committing revision 1 to "/tmp/t/".
added a
added a/b
Committed revision 1.
[1] mbp@grace% rm /home/mbp/old/bzr.20071016/pack-repository/bzrlib/*so
[1] mbp@grace% python2.4 =bzr rm a/
deleted a/b
deleted a
[1] mbp@grace% python2.4 =bzr revert
+N a/
+N a/b
[1] mbp@grace% python2.4 =bzr rm a/
deleted a/b
deleted a
[1] mbp@grace% python2.4 =bzr rm qq/
qq does not exist.

Revision history for this message
Marius Kruger (amanica) wrote :

thats weird, when I tried to do it again it didn't break,

but then I played around and saw that
it happens ONLY if you are trying to remove something
that is already `bzr rm`ed

eg:

cd temp_branch
bzr init
bzr mkdir x
bzr add x
bzr commit -m"x"
bzr rm x
bzr rm x
bzr: ERROR: exceptions.TypeError: expected string or buffer
...

and this time it broke on python 2.5.1 as well

On 10/17/07, Martin Pool <email address hidden> wrote:
>
> Thanks for the reproduction Marius,
>
> I don't think pqm runs python2.4 anymore because we were generally not
> seeing many differences from 2.5.
>
> I tried to follow your reproduction script and did not see the error -
> did I miss something?
>
...

Revision history for this message
Marius Kruger (amanica) wrote : more info

On 11/1/07, Warren Togami <email address hidden> wrote:

    I did "bzr rm file" in directory "config", then tried "bzr rm config"
    when this crash occurred.

    Warren Togami
    <email address hidden>

    [warren@newcaprica ltsp5]$ bzr rm config/
    bzr: ERROR: exceptions.TypeError: expected string or buffer

    Traceback (most recent call last):
       File "/usr/lib64/python2.5/site-packages/bzrlib/commands.py", line
    800, in run_bzr_catch_errors
         return run_bzr(argv)
       File "/usr/lib64/python2.5/site-packages/bzrlib/commands.py", line
    758, in run_bzr
         ret = run(*run_argv)
       File "/usr/lib64/python2.5/site-packages/bzrlib/commands.py", line
    492, in run_argv_aliases
         return self.run(**all_cmd_args)
       File "/usr/lib64/python2.5/site-packages/bzrlib/builtins.py", line
    1121, in run
         force=file_deletion_strategy=='force')
       File "/usr/lib64/python2.5/site-packages/bzrlib/mutabletree.py", line
    50, in tree_write_locked
         return unbound(self, *args, **kwargs)
       File "/usr/lib64/python2.5/site-packages/bzrlib/workingtree.py", line
    1847, in remove
         if not self.is_ignored(path[1]) and (
       File "/usr/lib64/python2.5/site-packages/bzrlib/workingtree.py", line
    1604, in is_ignored
         return self._ignoreglobster.match(filename)
       File "/usr/lib64/python2.5/site-packages/bzrlib/globbing.py", line
    213, in match
         match = regex.match(filename)
    TypeError: expected string or buffer

    bzr 0.91.0 on python 2.5.1.final.0 (linux2)
    arguments: ['/usr/bin/bzr', 'rm', 'config/']

    ** please send this report to <email address hidden>

On 11/6/07, Kent Gibson <email address hidden> wrote:

    -----BEGIN PGP SIGNED MESSAGE-----
    Hash: SHA1

    Hi Warren,

    That is certainly a bug. I haven't debugged it fully but a None is
    being passed to Globster.match which expects a filename. That only
    appears to happen if there are pending (uncommitted) removed files in
    the directory being deleted, as in your case.

Dan Watkins (oddbloke)
Changed in bzr:
assignee: nobody → daniel-thewatkins
status: Confirmed → In Progress
Dan Watkins (oddbloke)
Changed in bzr:
milestone: none → 1.0rc1
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.