Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Editing .bitpocket/exclude results in unexpeced deletions & data loss #35

Closed
torfason opened this issue Jan 11, 2013 · 4 comments
Closed

Comments

@torfason
Copy link
Collaborator

When an exclusion line is removed from .bitpocket/exclude, the expected behavior would be to start syncing that file/directory. However, the actual behavior is that this file is deleted. The following script, as well as script output, illustrates the issue (using a fresh BitPocketMaster directory):

Script

mkdir BitPocket
cd BitPocket
bitpocket init user@host.domain.net /home/user/BitPocketMaster
bitpocket sync
bitpocket sync
echo content>file-1.txt
echo content>file-2.txt
bitpocket sync
echo content>file-excluded.txt
echo "/file-excluded.txt">.bitpocket/exclude
bitpocket sync
ll
rm .bitpocket/exclude
bitpocket sync
ll

Result

file-excluded.txt is gone, which is not the expected behavior, since it has never been deleted.

With output

[tmp]$ mkdir BitPocket
[tmp]$ cd BitPocket
[BitPocket]$ bitpocket init user@host.domain.net /home/user/BitPocketMaster
Initialized bitpocket directory at /home/user/tmp/BitPocket
Please have a look at the config file (.bitpocket/config)
[BitPocket]$ bitpocket sync
bitpocket started at Fri Jan 11 15:34:14 EST 2013.

Fetching changes from server
receiving incremental file list
.d..t...... ./

sent 31 bytes received 59 bytes 60.00 bytes/sec
total size is 0 speedup is 0.00
Pushing changes to server
sending incremental file list

sent 74 bytes received 12 bytes 57.33 bytes/sec
total size is 0 speedup is 0.00
[BitPocket]$ bitpocket sync
bitpocket started at Fri Jan 11 15:34:31 EST 2013.

Fetching changes from server
receiving incremental file list

sent 28 bytes received 56 bytes 56.00 bytes/sec
total size is 0 speedup is 0.00
Pushing changes to server
sending incremental file list

sent 74 bytes received 12 bytes 57.33 bytes/sec
total size is 0 speedup is 0.00
[BitPocket]$ echo content>file-1.txt
[BitPocket]$ echo content>file-2.txt
[BitPocket]$ bitpocket sync
bitpocket started at Fri Jan 11 15:34:49 EST 2013.

Fetching changes from server
receiving incremental file list
.d..t...... ./

sent 65 bytes received 59 bytes 82.67 bytes/sec
total size is 0 speedup is 0.00
Pushing changes to server
sending incremental file list
<f+++++++++ file-1.txt
<f+++++++++ file-2.txt

sent 208 bytes received 50 bytes 172.00 bytes/sec
total size is 16 speedup is 0.06
[BitPocket]$ echo content>file-excluded.txt
[BitPocket]$ echo "/file-excluded.txt">.bitpocket/exclude
[BitPocket]$ bitpocket sync
bitpocket started at Fri Jan 11 15:35:13 EST 2013.

Fetching changes from server
receiving incremental file list
.d..t...... ./

sent 79 bytes received 97 bytes 117.33 bytes/sec
total size is 16 speedup is 0.09
Pushing changes to server
sending incremental file list

sent 136 bytes received 12 bytes 98.67 bytes/sec
total size is 16 speedup is 0.11
[BitPocket]$ ll
total 3
-rw------- 1 mtorfason Domain Users 8 Jan 11 15:34 file-1.txt
-rw------- 1 mtorfason Domain Users 8 Jan 11 15:34 file-2.txt
-rw------- 1 mtorfason Domain Users 8 Jan 11 15:35 file-excluded.txt
[BitPocket]$ rm .bitpocket/exclude
[BitPocket]$
[BitPocket]$ bitpocket sync
bitpocket started at Fri Jan 11 15:35:38 EST 2013.

Fetching changes from server
receiving incremental file list
*deleting file-excluded.txt

sent 28 bytes received 94 bytes 81.33 bytes/sec
total size is 16 speedup is 0.13
Pushing changes to server
sending incremental file list

sent 112 bytes received 12 bytes 82.67 bytes/sec
total size is 16 speedup is 0.13
[BitPocket]$ ll
total 2
-rw------- 1 mtorfason Domain Users 8 Jan 11 15:34 file-1.txt
-rw------- 1 mtorfason Domain Users 8 Jan 11 15:34 file-2.txt
[BitPocket]$ # file-excluded.txt is gone, which is not the expected
[BitPocket]$ # behavior, since it has never been deleted.

@thomie
Copy link

thomie commented Jan 13, 2013

See issue #20 for a probable cause.

@torfason
Copy link
Collaborator Author

I'm not familiar enough with bitpocket to completely understand that issue (#20), especially since I can't see a description of that, but perhaps that issue refers to the fact that an excluded file:

1: Ends up in .bitpocket/state/tree-current, but
2: Is not sent to the server on initial sync (because it's excluded), but
3: On syncing after changing exclude, it is observed as having once existed locally (because it's in tree-current), but not does not exist on master, and is therefore classified as having been deleted somewhere else.

That sounds convincing, and it also seems clear to me that the correct behavior would be that a file that is not sent to Master should also not be added to tree-current.

@torfason
Copy link
Collaborator Author

This is fixed in torfason/bitpocket@60dd63367e.
However, I'd recommend pulling the changes from torfason/bitpocket@bc67232bbf in that same repo instead of torfason/bitpocket@60dd63367e, since torfason/bitpocket@bc67232bbf has been much more extensively tested.

@torfason
Copy link
Collaborator Author

torfason commented Feb 5, 2014

The fix described above was merged into sickill/bitpocket around a year ago, so this issue can be closed.

@torfason torfason closed this as completed Feb 5, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants