Error with 0.92

John Arbash Meinel john at arbash-meinel.com
Thu Nov 29 23:34:33 GMT 2007


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

Will Lentz wrote:
> Hi all,
> 
> I got the error below with bzr 0.92 on Linux.  To reproduce the problem
> just do:
>   mkdir dir1
>   ln -s dir1 sym1
>   echo "hi" > dir1/test.txt
>   bzr init .
>   bzr add */*.txt
>   bzr ci
> 
> Then I got:
> added dir1
> added sym1
> added dir1/test.txt
> bzr: ERROR: exceptions.AttributeError: children
> 

it is trying to add "sym1/test.txt" because you supplied it on the command
line. It does a stat to make sure that file exists (which passes because
os.lstat('sym1/test.txt') will follow the sym1/* symlink).

It has added "sym1" into the inventory.

So it goes to look up the directory for "sym1/test.txt" and finds that sym1 is
present. So it goes to check to see if "test.txt" is already a versioned child
of sym1. Only to find out that sym1 isn't actually a directory (because it is
actually a symlink.)

I'm not sure how to fix it, it becomes a bit more obvious if you expand the shell:

mkdir dir1
ln -s dir1 sym1
touch dir1/test.txt
bzr init
bzr add dir1/test.txt sym1/test.txt

I'm not 100% sure how we should fix this. It is mostly about sanitizing user
input, so we can tell when they are passing a bogus path. Doing:

  bzr add symlink/file.txt

Should not add that path as "symlink/file.txt". *maybe* it should add it as
"real/directory/file.txt".

I suppose we could call "os.realpath()" on all user supplied paths? I'm not
sure if that will dereference "symlink" (I believe it does.)

At one point, I think we wrote code to find the "realpath" for all path
sections except for the final node, which would "do the right thing" for "bzr
add", (I believe.)

John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFHT0yIJdeBCYSNAAMRAuezAJ4gbw1mOJpbhrvndbbAGMXSV8EJogCcDM2O
gCjs8Tr3bFw5cWdUovt5j84=
=dk+i
-----END PGP SIGNATURE-----



More information about the bazaar mailing list