Project

General

Profile

Bug #2738

Hammer: Strange behavior when trying to recover old version of moved file

Added by roland almost 3 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
-
Target version:
-
Start date:
11/20/2014
Due date:
% Done:

0%


Description

Hello,

I'm new to BSD and want to use the hammer filesystem for tracking the history of some files. My system is an updated dfly release 3.8.2.

I wanted to know if I could access an old version of a file once it was moved to anover place:

mkdir ./somedir
mkdir ./anotherdir
echo "firstfilecontent" > ./somedir/testfile
sync
sleep 1
echo "secondfilecontent" > ./somedir/testfile
mv ./somedir/testfile ./anotherdir/movedfile
sync

The aim is to get "firstfilecontent" without knowing the old filename nor path:

undo -i ./anotherdir/movedfile
./anotherdir/movedfile: ITERATE ENTIRE HISTORY
0x00000001073aa0c0 19-Nov-2014 21:37:12 file-deleted
0x00000001073aa140 19-Nov-2014 21:37:13

Result: movedfile@@0x00000001073aa0c0 and therefore "firstfilecontent" is not accessible :-(

But after editing movedfile and moving it again within the same directory:

echo tmp >> ./anotherdir/renamedfile
sync
truncate -s -4 ./anotherdir/renamedfile
sync
mv ./anotherdir/renamedfile ./anotherdir/moved
sync

I get:

undo -i ./anotherdir/moved
./anotherdir/moved: ITERATE ENTIRE HISTORY
0x00000001073aa0c0 19-Nov-2014 21:37:12
0x00000001073aa140 19-Nov-2014 21:37:13
0x00000001073aa1e0 19-Nov-2014 21:37:13
0x00000001073aa200 19-Nov-2014 21:37:13

and I can now read moved@@0x00000001073aa0c0 !

I found this with the try and error method without understanding what is going on. After searching on the net I think that it may be related to https://bugs.dragonflybsd.org/issues/1074

I don't really know if this is a "bug", but I think that it would be cool if someone could tweak the undo command in a manner that this "workaround" is no longer needed.

Best regards
Roland

Also available in: Atom PDF