[PATCH] bzr selftest fails on Mac because of bogus /tmp location
John A Meinel
john at arbash-meinel.com
Mon Jul 11 20:34:53 BST 2005
Aaron Bentley wrote:
> I think it's better to fix the code than to fix the test case. I think
> you just need to change the call from
>
> rp = os.path.abspath(path)
>
> to
>
> rp = os.path.realpath(path)
>
> That way, _relpath() is more reliable.
>
> Aaron
No, the problem is that _relpath is comparing a realpath to a
tempfile.mkdtmp() path.
tempfile.mkdtmp() returns '/tmp/something'
If you create the file
"/tmp/something/newfile.txt"
It actually is created as "/private/tmp/something/newfile.txt"
The problem is:
def _relpath(base, path):
Assumes that base is already cannonicalized, which it typically is.
Because the Branch() constructor calls realpath(base).
But in the testing code, we don't do that.
Now we could make _relpath do:
base = os.path.realpath(base)
Before it does anything else, but that it unnecessary overhead,
considering in 95% of all uses, it already has the realpath, it is just
the test code which does not.
Hence why I fixed the test code, not the _relpath function.
John
=:->
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 253 bytes
Desc: OpenPGP digital signature
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20050711/bd6cb263/attachment.pgp
More information about the bazaar
mailing list