Allow renaming paths as they are restored

Bug #388673 reported by Michael Terry
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Duplicity
Fix Released
Wishlist
Unassigned

Bug Description

= Background =

Deja Dup has this feature where if you restore your backup as a different username, it will put your restored files in your current home directory. Which would be easy if the parent directory of the backup were $HOME. But it always backs up with a parent directory of / (to allow backing up non-home directories and the like).

So, Deja Dup restores everything to a /tmp directory, renames what it needs, then moves the files to their final destination. But this has caused several bugs with available space in /tmp.

= Feature Request =

So it would be nice if Deja Dup could just pass --rename='|home/foo|home/bar|' to duplicity and be done. Duplicity would redirect any incoming files to home/foo to similar named files under home/bar.

= Design =

I think a decent syntax would be to follow sed's example and allow a leading separator character, the input match, a separator, the output result, and a final separator. An error would occur if it couldn't be parsed.

To keep it simple, the string would be parsed as a literal string. That is, no globbing, no regular expressions. That would be over-engineering this, I think.

Each rename argument would be chained up. So the first rename would happen, then the second would run, etc.

In the case of a conflict (i.e. home/bar is already in the backup), a warning is printed, and duplicity ignores the rename. Better not to try to merge the two directories.

= Approval =

Ken, does the above make sense and desirable? I can start working on a patch.

Related branches

Revision history for this message
Peter Schuller (scode) wrote :

FWIW I think it sounds like a definitely useful feature. One implementation complexity issue I see is that answering "is X in the backup" is not necessarily simple?

Revision history for this message
Michael Terry (mterry) wrote :

I just remembered that Deja Dup one day also wants to try to visually prompt for sudo rights if it can't restore a file (i.e. you backed up /usr/share or something but are running as a user). So Deja Dup may always want to restore to a /tmp directory first.

In that case, let me open a different bug about other possible ways to alleviate that problem. This feature could still be useful, and I'll leave it open. But I may not be in as much a hurry to implement it.

description: updated
Revision history for this message
Michael Terry (mterry) wrote :

@Peter, I think it is... I think that's part of the signature file metadata. Not sure off the top of my head.

Michael Terry (mterry)
Changed in duplicity:
importance: Undecided → Wishlist
status: New → Triaged
Revision history for this message
Michael Terry (mterry) wrote :

I'm looking at implementing this again. I decided I don't like the idea of a separator. It's just geeky and 99% of the time unneeded. Rather, it would be better to have the option take two arguments. But getopt can't handle that right now. However... optparse can. And it's a little more fully-featured. I'm looking into porting commandline.py to optparse.

Changed in duplicity:
assignee: nobody → Michael Terry (mterry)
Changed in duplicity:
status: Triaged → Fix Committed
milestone: none → 0.6.07
Revision history for this message
Kenneth Loafman (kenneth-loafman) wrote :

Now that you've got optparse working, do you have time to revisit this issue?

Revision history for this message
Michael Terry (mterry) wrote :

Hey, man, I already did! :) It's in 0.6 and 0.7 branches. The --rename argument. Deja Dup is anxiously awaiting 0.6.07's release to use it.

Revision history for this message
Kenneth Loafman (kenneth-loafman) wrote :

Fantastic :-) 0.6.07 will be out by the 28th.

Changed in duplicity:
assignee: Michael Terry (mterry) → nobody
Changed in duplicity:
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.