Bug in util.py

Thomas Arendsen Hein thomas at intevation.de
Mon Nov 6 22:12:03 UTC 2006


* Jun Inoue <jun.lambda at gmail.com> [20061029 10:22]:
> Hi, I came across a bug in util.py.  I have a repo whose absolute path
> is /home/dvl/repo.  There's a symlink /dvl -> /home/dvl, and if I open
> a file in the repo with emacs through the symlink, the hg-diff-repo
> command fails.  Apparently, when mercurial tries to figure out if
> /dvl/repo is the same thing as /home/dvl/repo, samestat() tests true
> on the first loop so `rel' never gets updated and os.path.join () gets
> an empty parameter list.

Content-Description: patch
> --- util.py	2006-10-28 23:08:48.056118221 -0700
> +++ /var/lib/python-support/python2.4/mercurial/util.py	2006-10-29 03:00:22.596976864 -0800
> @@ -237,6 +237,9 @@
>              except OSError:
>                  break
>              if samestat(name_st, root_st):
> +                if rel == []:
> +                    # `name' was actually the same as `root'
> +                    return ''
>                  rel.reverse()
>                  name = os.path.join(*rel)
>                  audit_path(name)

This should already have been catched by
"elif name == root:" some lines above, but there is a bug in
mercurial.dirstate.getcwd() which naively returns
cwd[len(self.root) + 1:]
even if self.root is the symlink-expanded version and cwd not.

I'll look into this tomorrow.

Thomas

-- 
Email: thomas at intevation.de
http://intevation.de/~thomas/



More information about the Mercurial-devel mailing list