Allow .bzr.backup on SFTP and smartserver

Bug #118653 reported by Loïc Minier
6
Affects Status Importance Assigned to Milestone
Bazaar
Won't Fix
High
Unassigned
Launchpad itself
Fix Released
High
Jonathan Lange

Bug Description

Hi,

I created a bzr repo with the default format, pushed it to launchpad, but was in the need for tags; bzr requested me to upgrade, which I did, but I couldn't push to launchpad anymore after the upgrade since the remote branch needed an upgrade too.

launchpad doesn't allow the backup copy .bzr.backup, and there was no command-line flag to disable it; I commented out the self._backup_control_dir() call in upgrade.py.

Please add a flag to disable .bzr.backup.

Bye,

Tags: lp-code
Revision history for this message
Szilveszter Farkas (phanatic) wrote :

I'm not sure if it helps, but have you tried 'bzr push --overwrite'?

Revision history for this message
Loïc Minier (lool) wrote :

I did, but like push it would complain that the remote branch needed an upgrade.

Revision history for this message
John A Meinel (jameinel) wrote :

push --overwrite just forces the revision contents, it doesn't change the format.
I've used "bzr upgrade sftp://bazaar.launchpad.net/...." before

It sounds like the problem is that this was attempted one time, and now there is a .bzr.backup directory lying around that is preventing it from being done again.

With an sftp client you could "sftp sftp://bazaar.launchpad.net/; cd path; mv .bzr.backup .bzr.backup.old"

And then upgrade should work.

Alternatively 'bzr upgrade' could do some sort of .bzr.backup.N (.1, .2, .3... etc) chaining. But I'm not sure what the best answer is.

Revision history for this message
Loïc Minier (lool) wrote :

lool@bee ~ 8 255 % sftp bazaar.launchpad.net
2007/06/04 19:13:22
Connecting to bazaar.launchpad.net...
cd ~lool
sftp> cd ~lool
sftp> ls
+junk python-launchpad-code
sftp> cd python-launchpad-code
sftp> ls
trunk
sftp> ls -a
. .. trunk
sftp> cd trunk
sftp> ls
sftp> ls -a
. .. .bzr

I don't think I left any .bzr.backup, and the message sounded clear to me, but I don't have it for reference anymore.

Revision history for this message
John A Meinel (jameinel) wrote :

I think this is actually a bug in launchpad-bazaar, and I will include them on this. But the following commands should succeed, but currently fail:

% bzr init sftp://bazaar.launchpad.net/~jameinel/+junk/test1
$ bzr upgrade --dirstate-tags sftp://bazaar.launchpad.net/~jameinel/+junk/test1
starting upgrade of sftp://bazaar.launchpad.net/%7Ejameinel/%2Bjunk/test1/
making backup of tree history
bzr: ERROR: Permission denied: u'/~jameinel/+junk/test1/.bzr.backup': [Errno 13] Can only create .bzr directories in branch directories: .bzr.backup

Changed in bzr:
importance: Undecided → High
status: Unconfirmed → Confirmed
Revision history for this message
John A Meinel (jameinel) wrote :

This seems like an explicit design decision (since we have an explicit "cannot create anything but .bzr" error message).

However, somebody didn't realize how we do upgrades. I would rather not have a "--no-backup" because then if the upgrade fails midway through (disconnected net access) you potentially have corrupted your branch completely, and have no easy way to fix it.

Changed in launchpad-bazaar:
status: Unconfirmed → Confirmed
Revision history for this message
Andrew Bennetts (spiv) wrote : Re: [Bug 118653] Re: Need --no-backup flag or similar to upgrade remote repos on launchpad

John A Meinel wrote:
[..]
> It sounds like the problem is that this was attempted one time, and now
> there is a .bzr.backup directory lying around that is preventing it from
> being done again.

That's not the problem. The problem is that recently the SFTP server stopped
allowing creation of any directory other than ".bzr" at that point in the
filesystem hierarchy (to prevent mistakes where users pushed to a directory too
deep, and thus made a branch Launchpad couldn't mirror).

Unfortunately, that includes ".bzr.backup". So probably that restriction in
Launchpad needs to be loosened slightly.

Of course, .bzr.backup are pretty inconvenient in Launchpad anyway, because how
can you revert to the backup .bzr if there's a problem? You need to find an
SFTP client that can recursively delete directories, then move the old one back.
And unless you only use a given branch as a checkout, you've probably tested the
upgrade locally anyway. So I think adding a --no-backup flag to upgrade would
be handy anyway.

-Andrew.

Revision history for this message
Jonathan Lange (jml) wrote : Re: Need --no-backup flag or similar to upgrade remote repos on launchpad

Yeah, we should probably loosen the restrictions on Launchpad.

Changed in launchpad-bazaar:
assignee: nobody → jml
importance: Undecided → High
Revision history for this message
Jelmer Vernooij (jelmer) wrote :

Perhaps the upgrade process is something that can later be deferred to the smart server.

Revision history for this message
Robert Collins (lifeless) wrote :

I think:
 - we should support .bzr.backup on the SFTP server as a priority. (note bzr+ssh already supports this AFAICT)
 - the smart server will support upgrades eventually
 - lftp does recursive rm's easily so its easy to recover
 --no-backup is a really bad idea. Lets not create a situation where users can trash their data irrecoverably due to e.g. network interruptions.

Revision history for this message
Robert Collins (lifeless) wrote :

--no-backup is a recipe for trashing data when link errors occur. I think its a harmful thing to include because users won't predict that it can do that.

Changed in bzr:
status: Confirmed → Won't Fix
Jonathan Lange (jml)
Changed in launchpad-bazaar:
status: Confirmed → In Progress
Jonathan Lange (jml)
Changed in launchpad-bazaar:
status: In Progress → Fix Committed
Jonathan Lange (jml)
Changed in launchpad-bazaar:
status: Fix Committed → 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.