"bzr up" fails in checkout that replaces versioned directory with unversioned symlink to out-of-tree path

Bug #691756 reported by Max Kanat-Alexander
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Bazaar
Confirmed
Medium
Unassigned

Bug Description

If you follow these steps, then on the final step you get: “bzr: ERROR: Path "/tmp/lib/lib" is not a child of path "/tmp/checkout"”:

# create a master branch with a lib directory
cd /tmp
bzr init master
cd master
mkdir lib
bzr add
bzr ci -m "Add lib/ directory."
cd ..
# Make a checkout, change lib/ to a out-of-tree-symlink
bzr co master checkout
cd checkout
rm -r lib
mkdir ../lib
ln -s ../lib/ lib
cd ..
# make a change to lib/ in master
cd master
touch lib/new-file.txt
bzr add
bzr ci -m "Add a file to lib/"
cd ..
# update the checkout
cd checkout
bzr up

(Note that with bzr 2.2.2 rather than trunk PathNotChild is a traceback; that's a separate bug.)

The reporter says: “reporting a conflict would be something that would seem reasonable to me. (Totally failing to do the update was not what I expected.)”

Revision history for this message
Andrew Bennetts (spiv) wrote :

A bit more information would be very helpful, your description is a bit hard to interpret.

Is this an accurate reproduction?

# create a master branch with a lib directory
cd /tmp
bzr init master
cd master
mkdir lib
bzr add
bzr ci -m "Add lib/ directory."
cd ..
# Make a checkout, change lib/ to a out-of-tree-symlink
bzr co master checkout
cd checkout
rm -r lib
mkdir ../lib
ln -s ../lib/ lib # backwards to your report, I think you made a typo?
cd ..
# make a change to lib/ in master
cd master
touch lib/new-file.txt
bzr add
bzr ci -m "Add a file to lib/"
cd ..
# update the checkout
cd checkout
bzr up

Does that match your situation?

Under bzr 2.2 this gives me your traceback.

With bzr trunk this gives me:

bzr: ERROR: Path "/tmp/lib/lib" is not a child of path "/tmp/checkout"

(The traceback was bug 98735.)

Which I think is accurate and fairly reasonable, although not as helpful as it could be. Do you disagree? bzr could probably be more explicit about why it is trying to access /tmp/lib, and perhaps also explain why it has to be a child of /tmp/checkout.

I can also imagine that perhaps bzr could re-add the directory under a new name (or rename the symlink instead?) and report some sort of conflict, rather than refusing to update at all. Is that what you expected?

Changed in bzr:
status: New → Incomplete
Revision history for this message
Max Kanat-Alexander (mkanat) wrote :

Yes, your description of the issue and steps to reproduce are perfectly accurate.

Sure, reporting a conflict would be something that would seem reasonable to me. (Totally failing to do the update was not what I expected.)

Changed in bzr:
status: Incomplete → New
Andrew Bennetts (spiv)
summary: - unversioned files underneath a directory that is now a symlink cause
- bzrlib.errors.PathNotChild
+ "bzr up" fails in checkout that replaces versioned directory with
+ unversioned symlink to out-of-tree path
Andrew Bennetts (spiv)
description: updated
Changed in bzr:
importance: Undecided → Medium
status: New → Confirmed
tags: added: checkout conflicts
Revision history for this message
Matthew Fuller (fullermd) wrote :

Here's a repro script doing it all in one dir for convenience:

#!/bin/sh -x
bzr="/usr/local/bin/bzr --no-plugins --no-aliases"

${bzr} init A
(
 # Setup
 cd A ;
 mkdir a ;
 touch a/b ;
 ${bzr} add ;
 ${bzr} ci -m 1 ;

 # Add a rev changing the file
 echo whee > a/b ;
 ${bzr} ci -m 2 ;

 # Back up to before the change
 ${bzr} up -r 1

 # Turn the dir into a symlink
 rm -rf a ;
 ln -s /etc a ;

 # Try to update back across the change to a/b
 bzr up
 # *boom*
)

Revision history for this message
Matthew Fuller (fullermd) wrote :

To expand, it has nothing to do with being a separate checkout per se. It's a combination of a type change from (versioned) dir to (unversioned) symlink, plus update across changes to something underneath the dir.

Parth Malwankar (parthm)
tags: added: symlink
Jelmer Vernooij (jelmer)
tags: added: check-for-breezy
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.