bsync errors out on conflict
The following sequence crashes bsync:
#! /bin/sh
rm -rf testdir1 testdir2 mkdir testdir1 testdir2 echo xxxxx > testdir1/data bsync testdir1 testdir2 sleep 2 rm -rf testdir1 touch testdir2/data bsync testdir1 testdir2
Hello @dieterdeyke
Can you paste the ouput you get ?
On my side this is not a crash (it just tells me that the first directory is missing):
$ sh -x ./mytest.sh
+ rm -rf testdir1 testdir2
+ mkdir testdir1 testdir2
+ echo xxxxx
+ bsync testdir1 testdir2
Loading filelists...
Old filelist not found. Starting with empty history.
(LEFT DIR CONTENT) (RIGHT DIR CONTENT) (ACTION)
data --> (copy)
Todo in testdir1:
Todo in testdir2: cp:1
Apply actions? [y/N] y
Applying actions...
rsync: data
Updating filelists...
Done!
+ sleep 2
+ rm -rf testdir1
+ touch testdir2/data
+ bsync testdir1 testdir2
Loading filelists...
Error: could not open directory: testdir1/ (is it created?)
Marc MAURICE [email protected] writes:
Can you paste the ouput you get ?
On my side this is not a crash (it just tells me that the first directory is missing):
$ sh -x ./mytest.sh
- rm -rf testdir1 testdir2
- mkdir testdir1 testdir2
- echo xxxxx
- bsync testdir1 testdir2 Loading filelists... Old filelist not found. Starting with empty history.
(LEFT DIR CONTENT) (RIGHT DIR CONTENT) (ACTION)
data --> (copy)
Todo in testdir1: Todo in testdir2: cp:1 Apply actions? [y/N] y
Applying actions... rsync: data Updating filelists... Done!
- sleep 2
- rm -rf testdir1
- touch testdir2/data
- bsync testdir1 testdir2 Loading filelists... Error: could not open directory: testdir1/ (is it created?)
I get the same output. I thought it was crashing, but it could have just been reporting the conflict in an unusual way. Never mind then.
What I was really trying to do is find a test case which makes bsync really crash. That happens a lot when syncing my ext4 file system with FAT file systems on mp3 players, when I deleted files on both sides before. But so far I have not been able to make a simple example.
Thanks for looking into it,
Dieter Deyke mailto:[email protected] Get my Gnupg key: gpg --keyserver keys.gnupg.net --recv-keys B116EA20
Thanks for the details. Feel free to paste the output / exception of the error even if you are not able to reproduce it. It may give me clues of what is going wrong.
Marc MAURICE [email protected] writes:
Feel free to paste the output / exception of the error even if you are not able to reproduce it. It may give me clues of what is going wrong.
I played some more and I think I can show the error. Attached is the script I used, and the output I got.
Unmounting and remounting the DOS filesystem changes the timestamps, because FAT has only a 2 second resolution, and cannot preserve odd seconds.
-- Dieter Deyke mailto:[email protected] Get my Gnupg key: gpg --keyserver keys.gnupg.net --recv-keys B116EA20
Just saw that github does not recognize email attachments, so I will attach those files here:
Thanks ! Amazing work @dieterdeyke . After remounting the dos fs, the file time seems rounded. I'm checking to fix this.
I first fixed a bug when showing conflict of a file in vfat. As vfat files do not have permissions I should not try to display them.
Now it's not crashing anymore, but I still need to find a way to work around the vfat time problem, as it wrongly detect changes.
I will probably round the file time when on vfat, but I still need a way to detect if a directory is on vfat or not. I may use df for that but I don't think this is really portable (does it work on mac?)...
Marc MAURICE [email protected] writes:
Now it's not crashing anymore, but I still need to find a way to work around the vfat time problem, as it wrongly detect changes.
I will probably round the file time when on vfat, but I still need a way to detect if a directory is on vfat or not. I may use df for that but I don't think this is really portable (does it work on mac?)...
I wrote a little function which tries to guess time resolution by looking at the already existing files. It was just a quick hack to show the concept.
#! /usr/bin/env python3
Author: Dieter Deyke [email protected]
Time-stamp: <2019-03-06 07:37:18 deyke>
import os import sys
def get_time_resolution(directory): bitmask = 0 for dirpath, dirnames, filenames in os.walk(directory): for name in dirnames + filenames: path = os.path.join(dirpath, name) statinfo = os.stat(path) mtime = int(statinfo.st_mtime) bitmask |= mtime resolution = 1 while (bitmask & 1) == 0: resolution *= 2 bitmask >>= 1 return resolution
print(get_time_resolution(sys.argv[1]))
-- Dieter Deyke mailto:[email protected] Get my Gnupg key: gpg --keyserver keys.gnupg.net --recv-keys B116EA20