mirror of
https://github.com/rclone/rclone.git
synced 2025-01-08 23:40:29 +01:00
bisync: provide more info in critical error msgs
This commit is contained in:
parent
44637dcd7f
commit
4d5d6ee61b
@ -1231,6 +1231,7 @@ func (b *bisyncTest) newReplacer(mangle bool) *strings.Replacer {
|
||||
"//?/" + strings.TrimSuffix(strings.Replace(b.path2, slash, "/", -1), "/"), "{path2}",
|
||||
strings.TrimSuffix(b.path1, slash), "{path1}", // ensure it's still recognized without trailing slash
|
||||
strings.TrimSuffix(b.path2, slash), "{path2}",
|
||||
b.workDir, "{workdir}",
|
||||
b.sessionName, "{session}",
|
||||
}
|
||||
if fixSlash {
|
||||
|
@ -98,7 +98,10 @@ func Bisync(ctx context.Context, fs1, fs2 fs.Fs, optArg *Options) (err error) {
|
||||
if !opt.DryRun {
|
||||
lockFile = b.basePath + ".lck"
|
||||
if bilib.FileExists(lockFile) {
|
||||
return fmt.Errorf("prior lock file found: %s", lockFile)
|
||||
errTip := Color(terminal.MagentaFg, "Tip: this indicates that another bisync run (of these same paths) either is still running or was interrupted before completion. \n")
|
||||
errTip += Color(terminal.MagentaFg, "If you're SURE you want to override this safety feature, you can delete the lock file with the following command, then run bisync again: \n")
|
||||
errTip += fmt.Sprintf(Color(terminal.HiRedFg, "rclone deletefile \"%s\""), lockFile)
|
||||
return fmt.Errorf(Color(terminal.RedFg, "prior lock file found: %s \n")+errTip, Color(terminal.HiYellowFg, lockFile))
|
||||
}
|
||||
|
||||
pidStr := []byte(strconv.Itoa(os.Getpid()))
|
||||
@ -222,7 +225,13 @@ func (b *bisyncRun) runLocked(octx context.Context) (err error) {
|
||||
// On prior critical error abort, the prior listings are renamed to .lst-err to lock out further runs
|
||||
b.critical = true
|
||||
b.retryable = true
|
||||
return errors.New("cannot find prior Path1 or Path2 listings, likely due to critical error on prior run")
|
||||
errTip := Color(terminal.MagentaFg, "Tip: here are the filenames we were looking for. Do they exist? \n")
|
||||
errTip += fmt.Sprintf(Color(terminal.CyanFg, "Path1: %s\n"), Color(terminal.HiBlueFg, b.listing1))
|
||||
errTip += fmt.Sprintf(Color(terminal.CyanFg, "Path2: %s\n"), Color(terminal.HiBlueFg, b.listing2))
|
||||
errTip += Color(terminal.MagentaFg, "Try running this command to inspect the work dir: \n")
|
||||
errTip += fmt.Sprintf(Color(terminal.HiCyanFg, "rclone lsl \"%s\""), b.workDir)
|
||||
|
||||
return errors.New("cannot find prior Path1 or Path2 listings, likely due to critical error on prior run \n" + errTip)
|
||||
}
|
||||
|
||||
fs.Infof(nil, "Building Path1 and Path2 listings")
|
||||
@ -526,6 +535,9 @@ func (b *bisyncRun) checkAccess(checkFiles1, checkFiles2 bilib.Names) error {
|
||||
numChecks1 := len(checkFiles1)
|
||||
numChecks2 := len(checkFiles2)
|
||||
if numChecks1 == 0 || numChecks1 != numChecks2 {
|
||||
if numChecks1 == 0 && numChecks2 == 0 {
|
||||
fs.Logf("--check-access", Color(terminal.RedFg, "Failed to find any files named %s\n More info: %s"), Color(terminal.CyanFg, opt.CheckFilename), Color(terminal.BlueFg, "https://rclone.org/bisync/#check-access"))
|
||||
}
|
||||
fs.Errorf(nil, "%s Path1 count %d, Path2 count %d - %s", prefix, numChecks1, numChecks2, opt.CheckFilename)
|
||||
ok = false
|
||||
}
|
||||
|
@ -83,7 +83,12 @@ Bisync error: bisync aborted
|
||||
[36m(19) :[0m [34mtest 6. run again. should fail critical due to missing listings.[0m
|
||||
[36m(20) :[0m [34mbisync check-access[0m
|
||||
INFO : Synching Path1 "{path1/}" with Path2 "{path2/}"
|
||||
ERROR : [31mBisync critical error: cannot find prior Path1 or Path2 listings, likely due to critical error on prior run[0m
|
||||
ERROR : [31mBisync critical error: cannot find prior Path1 or Path2 listings, likely due to critical error on prior run
|
||||
[35mTip: here are the filenames we were looking for. Do they exist?
|
||||
[0m[36mPath1: [94m{workdir/}{session}.path1.lst[0m
|
||||
[0m[36mPath2: [94m{workdir/}{session}.path2.lst[0m
|
||||
[0m[35mTry running this command to inspect the work dir:
|
||||
[0m[96mrclone lsl "{workdir}"[0m[0m
|
||||
ERROR : [31mBisync aborted. Must run --resync to recover.[0m
|
||||
Bisync error: bisync aborted
|
||||
[36m(21) :[0m [34mmove-listings missing-listings[0m
|
||||
|
@ -32,7 +32,12 @@ Bisync error: bisync aborted
|
||||
[36m(12) :[0m [34mtest 4. run normal sync to check that it aborts[0m
|
||||
[36m(13) :[0m [34mbisync[0m
|
||||
INFO : Synching Path1 "{path1/}" with Path2 "{path2/}"
|
||||
ERROR : [31mBisync critical error: cannot find prior Path1 or Path2 listings, likely due to critical error on prior run[0m
|
||||
ERROR : [31mBisync critical error: cannot find prior Path1 or Path2 listings, likely due to critical error on prior run
|
||||
[35mTip: here are the filenames we were looking for. Do they exist?
|
||||
[0m[36mPath1: [94m{workdir/}{session}.path1.lst[0m
|
||||
[0m[36mPath2: [94m{workdir/}{session}.path2.lst[0m
|
||||
[0m[35mTry running this command to inspect the work dir:
|
||||
[0m[96mrclone lsl "{workdir}"[0m[0m
|
||||
ERROR : [31mBisync aborted. Must run --resync to recover.[0m
|
||||
Bisync error: bisync aborted
|
||||
|
||||
|
@ -24,7 +24,12 @@ Bisync error: bisync aborted
|
||||
[36m(08) :[0m [34mtest 3. run without filters-file. should be blocked due to prior abort.[0m
|
||||
[36m(09) :[0m [34mbisync[0m
|
||||
INFO : Synching Path1 "{path1/}" with Path2 "{path2/}"
|
||||
ERROR : [31mBisync critical error: cannot find prior Path1 or Path2 listings, likely due to critical error on prior run[0m
|
||||
ERROR : [31mBisync critical error: cannot find prior Path1 or Path2 listings, likely due to critical error on prior run
|
||||
[35mTip: here are the filenames we were looking for. Do they exist?
|
||||
[0m[36mPath1: [94m{workdir/}{session}.path1.lst[0m
|
||||
[0m[36mPath2: [94m{workdir/}{session}.path2.lst[0m
|
||||
[0m[35mTry running this command to inspect the work dir:
|
||||
[0m[96mrclone lsl "{workdir}"[0m[0m
|
||||
ERROR : [31mBisync aborted. Must run --resync to recover.[0m
|
||||
Bisync error: bisync aborted
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user