siom79 / jdrivesync

jdrivesync is a simple command line tool that synchronizes a local file system structure to your Google Drive (and back)

Home Page:https://siom79.github.io/jdrivesync/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Problem with .trash being deleted and put into new .trash

marcederis opened this issue · comments

Hello,

I'm having a problem where .trash gets deleted and put into a new .trash, while doing a download. This results in a folder structure like /test/.trash/.trash/.trash etc. (where "test" is my local folder) after several runs.
You can reproduce this by:

  1. In you local folder, create a file that doesn't exist on your Google Drive (touch test.txt).
  2. Run jdrivesync multiple times for download. This is my command:

/usr/local/bin/java -jar /usr/home/admin/jdrivesync-0.3.0-jar-with-dependencies.jar -a "/home/admin/.test-auth" -d -l "/test"

Every time it runs, the summary shows, "Synchronized Deleted /test/.trash". After a few runs, I'll have several copies of .trash inside of itself.

Here is my output after running the command a few times:

2016-03-09 13:06:27 WARNING jdrivesync.fs.FileSystemAdapter delete(): Could not move file to .trash directory: /test/.trash/.trash/.trash/.trash/.trash/.trash
java.nio.file.FileAlreadyExistsException: /test/.trash/.trash/.trash/.trash/.trash/.trash
        at sun.nio.fs.UnixCopyFile.move(UnixCopyFile.java:429)
        at sun.nio.fs.UnixFileSystemProvider.move(UnixFileSystemProvider.java:262)
        at java.nio.file.Files.move(Files.java:1395)
        at jdrivesync.fs.FileSystemAdapter.delete(FileSystemAdapter.java:112)
        at jdrivesync.fs.FileSystemAdapter$1.postVisitDirectory(FileSystemAdapter.java:79)
        at jdrivesync.fs.FileSystemAdapter$1.postVisitDirectory(FileSystemAdapter.java:68)
        at java.nio.file.Files.walkFileTree(Files.java:2688)
        at java.nio.file.Files.walkFileTree(Files.java:2742)
        at jdrivesync.fs.FileSystemAdapter.deleteDirectorySubtree(FileSystemAdapter.java:68)
        at jdrivesync.sync.Synchronization$2.processRemoteChildNotFound(Synchronization.java:394)
        at jdrivesync.sync.Synchronization$2.visitDirectory(Synchronization.java:342)
        at jdrivesync.gdrive.GoogleDriveWalker.walkInternal(GoogleDriveWalker.java:88)
        at jdrivesync.gdrive.GoogleDriveWalker.walk(GoogleDriveWalker.java:35)
        at jdrivesync.sync.Synchronization.syncDown(Synchronization.java:321)
        at jdrivesync.App.sync(App.java:89)
        at jdrivesync.App.run(App.java:54)
        at jdrivesync.App.main(App.java:27)

2016-03-09 13:06:27 WARNING jdrivesync.fs.FileSystemAdapter delete(): Could not move file to .trash directory: /test/.trash/.trash/.trash/.trash/.trash
java.nio.file.FileAlreadyExistsException: /test/.trash/.trash/.trash/.trash/.trash
        at sun.nio.fs.UnixCopyFile.move(UnixCopyFile.java:429)
        at sun.nio.fs.UnixFileSystemProvider.move(UnixFileSystemProvider.java:262)
        at java.nio.file.Files.move(Files.java:1395)
        at jdrivesync.fs.FileSystemAdapter.delete(FileSystemAdapter.java:112)
        at jdrivesync.fs.FileSystemAdapter$1.postVisitDirectory(FileSystemAdapter.java:79)
        at jdrivesync.fs.FileSystemAdapter$1.postVisitDirectory(FileSystemAdapter.java:68)
        at java.nio.file.Files.walkFileTree(Files.java:2688)
        at java.nio.file.Files.walkFileTree(Files.java:2742)
        at jdrivesync.fs.FileSystemAdapter.deleteDirectorySubtree(FileSystemAdapter.java:68)
        at jdrivesync.sync.Synchronization$2.processRemoteChildNotFound(Synchronization.java:394)
        at jdrivesync.sync.Synchronization$2.visitDirectory(Synchronization.java:342)
        at jdrivesync.gdrive.GoogleDriveWalker.walkInternal(GoogleDriveWalker.java:88)
        at jdrivesync.gdrive.GoogleDriveWalker.walk(GoogleDriveWalker.java:35)
        at jdrivesync.sync.Synchronization.syncDown(Synchronization.java:321)
        at jdrivesync.App.sync(App.java:89)
        at jdrivesync.App.run(App.java:54)
        at jdrivesync.App.main(App.java:27)

2016-03-09 13:06:27 WARNING jdrivesync.fs.FileSystemAdapter delete(): Could not move file to .trash directory: /test/.trash/.trash/.trash/.trash
java.nio.file.FileAlreadyExistsException: /test/.trash/.trash/.trash/.trash
        at sun.nio.fs.UnixCopyFile.move(UnixCopyFile.java:429)
        at sun.nio.fs.UnixFileSystemProvider.move(UnixFileSystemProvider.java:262)
        at java.nio.file.Files.move(Files.java:1395)
        at jdrivesync.fs.FileSystemAdapter.delete(FileSystemAdapter.java:112)
        at jdrivesync.fs.FileSystemAdapter$1.postVisitDirectory(FileSystemAdapter.java:79)
        at jdrivesync.fs.FileSystemAdapter$1.postVisitDirectory(FileSystemAdapter.java:68)
        at java.nio.file.Files.walkFileTree(Files.java:2688)
        at java.nio.file.Files.walkFileTree(Files.java:2742)
        at jdrivesync.fs.FileSystemAdapter.deleteDirectorySubtree(FileSystemAdapter.java:68)
        at jdrivesync.sync.Synchronization$2.processRemoteChildNotFound(Synchronization.java:394)
        at jdrivesync.sync.Synchronization$2.visitDirectory(Synchronization.java:342)
        at jdrivesync.gdrive.GoogleDriveWalker.walkInternal(GoogleDriveWalker.java:88)
        at jdrivesync.gdrive.GoogleDriveWalker.walk(GoogleDriveWalker.java:35)
        at jdrivesync.sync.Synchronization.syncDown(Synchronization.java:321)
        at jdrivesync.App.sync(App.java:89)
        at jdrivesync.App.run(App.java:54)
        at jdrivesync.App.main(App.java:27)

2016-03-09 13:06:27 WARNING jdrivesync.fs.FileSystemAdapter delete(): Could not move file to .trash directory: /test/.trash/.trash/.trash
java.nio.file.FileAlreadyExistsException: /test/.trash/.trash/.trash
        at sun.nio.fs.UnixCopyFile.move(UnixCopyFile.java:429)
        at sun.nio.fs.UnixFileSystemProvider.move(UnixFileSystemProvider.java:262)
        at java.nio.file.Files.move(Files.java:1395)
        at jdrivesync.fs.FileSystemAdapter.delete(FileSystemAdapter.java:112)
        at jdrivesync.fs.FileSystemAdapter$1.postVisitDirectory(FileSystemAdapter.java:79)
        at jdrivesync.fs.FileSystemAdapter$1.postVisitDirectory(FileSystemAdapter.java:68)
        at java.nio.file.Files.walkFileTree(Files.java:2688)
        at java.nio.file.Files.walkFileTree(Files.java:2742)
        at jdrivesync.fs.FileSystemAdapter.deleteDirectorySubtree(FileSystemAdapter.java:68)
        at jdrivesync.sync.Synchronization$2.processRemoteChildNotFound(Synchronization.java:394)
        at jdrivesync.sync.Synchronization$2.visitDirectory(Synchronization.java:342)
        at jdrivesync.gdrive.GoogleDriveWalker.walkInternal(GoogleDriveWalker.java:88)
        at jdrivesync.gdrive.GoogleDriveWalker.walk(GoogleDriveWalker.java:35)
        at jdrivesync.sync.Synchronization.syncDown(Synchronization.java:321)
        at jdrivesync.App.sync(App.java:89)
        at jdrivesync.App.run(App.java:54)
        at jdrivesync.App.main(App.java:27)

2016-03-09 13:06:27 INFO jdrivesync.report.NoopReport log(): Synchronized Deleted /test/.trash
2016-03-09 13:06:27 INFO jdrivesync.report.NoopReport log(): Synchronized Unchanged /kandace
2016-03-09 13:06:27 INFO jdrivesync.report.NoopReport log(): Synchronized Unchanged /mark
2016-03-09 13:06:28 INFO jdrivesync.App printStatistics(): Statistics:
2016-03-09 13:06:28 INFO jdrivesync.App printStatistics(): NEW:       0 files
2016-03-09 13:06:28 INFO jdrivesync.App printStatistics(): DELETED:   1 file
2016-03-09 13:06:28 INFO jdrivesync.App printStatistics(): UPDATED:   0 files
2016-03-09 13:06:28 INFO jdrivesync.App printStatistics(): UNCHANGED: 2 files
Finished uploads1 download

I've tried putting .trash and (star)(star)/.trash and (star)(star)/(star).trash into an ignore file and using -i, but no luck, that didn't help. (by star, I mean * , I think markdown is changing them)

Any ideas, or whether I'm doing something wrong?
Thanks!

I have exactly the same problem. I am using jdrivesync on Linux.
Ondřej


Předmět: [jdrivesync] Problem with .trash being deleted and put into
new .trash (#16)
Datum: 9.3.2016 22:26:18
Od: Marcederis
Komu: Siom79/jdrivesync

Hello,

I'm having a problem where .trash gets deleted and put into a new
.trash, while doing a download. This results in a folder structure
like /test/.trash/.trash/.trash etc. (where "test" is my local folder)
after several runs.
You can reproduce this by:

  1. In you local folder, create a file that doesn't exist on your
    Google Drive (touch test.txt).
  2. Run jdrivesync multiple times for download. This is my command:

|/usr/local/bin/java -jar
/usr/home/admin/jdrivesync-0.3.0-jar-with-dependencies.jar -a
"/home/admin/.test-auth" -d -l "/test"|

Every time it runs, the summary shows, "Synchronized Deleted
/test/.trash". After a few runs, I'll have several copies of .trash
inside of itself.

Here is my output after running the command a few times:

|2016-03-09 13:06:27 WARNING jdrivesync.fs.FileSystemAdapter delete():
Could not move file to .trash directory:
/test/.trash/.trash/.trash/.trash/.trash/.trash
java.nio.file.FileAlreadyExistsException:
/test/.trash/.trash/.trash/.trash/.trash/.trash at
sun.nio.fs.UnixCopyFile.move(UnixCopyFile.java:429) at
sun.nio.fs.UnixFileSystemProvider.move(UnixFileSystemProvider.java:262) at
java.nio.file.Files.move(Files.java:1395) at
jdrivesync.fs.FileSystemAdapter.delete(FileSystemAdapter.java:112) at
jdrivesync.fs.FileSystemAdapter$1.postVisitDirectory(FileSystemAdapter.java:79)
at
jdrivesync.fs.FileSystemAdapter$1.postVisitDirectory(FileSystemAdapter.java:68)
at java.nio.file.Files.walkFileTree(Files.java:2688) at
java.nio.file.Files.walkFileTree(Files.java:2742) at
jdrivesync.fs.FileSystemAdapter.deleteDirectorySubtree(FileSystemAdapter.java:68)
at
jdrivesync.sync.Synchronization$2.processRemoteChildNotFound(Synchronization.java:394)
at
jdrivesync.sync.Synchronization$2.visitDirectory(Synchronization.java:342)
at
jdrivesync.gdrive.GoogleDriveWalker.walkInternal(GoogleDriveWalker.java:88)
at jdrivesync.gdrive.GoogleDriveWalker.walk(GoogleDriveWalker.java:35)
at jdrivesync.sync.Synchronization.syncDown(Synchronization.java:321)
at jdrivesync.App.sync(App.java:89) at jdrivesync.App.run(App.java:54)
at jdrivesync.App.main(App.java:27) 2016-03-09 13:06:27 WARNING
jdrivesync.fs.FileSystemAdapter delete(): Could not move file to
.trash directory: /test/.trash/.trash/.trash/.trash/.trash
java.nio.file.FileAlreadyExistsException:
/test/.trash/.trash/.trash/.trash/.trash at
sun.nio.fs.UnixCopyFile.move(UnixCopyFile.java:429) at
sun.nio.fs.UnixFileSystemProvider.move(UnixFileSystemProvider.java:262) at
java.nio.file.Files.move(Files.java:1395) at
jdrivesync.fs.FileSystemAdapter.delete(FileSystemAdapter.java:112) at
jdrivesync.fs.FileSystemAdapter$1.postVisitDirectory(FileSystemAdapter.java:79)
at
jdrivesync.fs.FileSystemAdapter$1.postVisitDirectory(FileSystemAdapter.java:68)
at java.nio.file.Files.walkFileTree(Files.java:2688) at
java.nio.file.Files.walkFileTree(Files.java:2742) at
jdrivesync.fs.FileSystemAdapter.deleteDirectorySubtree(FileSystemAdapter.java:68)
at
jdrivesync.sync.Synchronization$2.processRemoteChildNotFound(Synchronization.java:394)
at
jdrivesync.sync.Synchronization$2.visitDirectory(Synchronization.java:342)
at
jdrivesync.gdrive.GoogleDriveWalker.walkInternal(GoogleDriveWalker.java:88)
at jdrivesync.gdrive.GoogleDriveWalker.walk(GoogleDriveWalker.java:35)
at jdrivesync.sync.Synchronization.syncDown(Synchronization.java:321)
at jdrivesync.App.sync(App.java:89) at jdrivesync.App.run(App.java:54)
at jdrivesync.App.main(App.java:27) 2016-03-09 13:06:27 WARNING
jdrivesync.fs.FileSystemAdapter delete(): Could not move file to
.trash directory: /test/.trash/.trash/.trash/.trash
java.nio.file.FileAlreadyExistsException:
/test/.trash/.trash/.trash/.trash at
sun.nio.fs.UnixCopyFile.move(UnixCopyFile.java:429) at
sun.nio.fs.UnixFileSystemProvider.move(UnixFileSystemProvider.java:262) at
java.nio.file.Files.move(Files.java:1395) at
jdrivesync.fs.FileSystemAdapter.delete(FileSystemAdapter.java:112) at
jdrivesync.fs.FileSystemAdapter$1.postVisitDirectory(FileSystemAdapter.java:79)
at
jdrivesync.fs.FileSystemAdapter$1.postVisitDirectory(FileSystemAdapter.java:68)
at java.nio.file.Files.walkFileTree(Files.java:2688) at
java.nio.file.Files.walkFileTree(Files.java:2742) at
jdrivesync.fs.FileSystemAdapter.deleteDirectorySubtree(FileSystemAdapter.java:68)
at
jdrivesync.sync.Synchronization$2.processRemoteChildNotFound(Synchronization.java:394)
at
jdrivesync.sync.Synchronization$2.visitDirectory(Synchronization.java:342)
at
jdrivesync.gdrive.GoogleDriveWalker.walkInternal(GoogleDriveWalker.java:88)
at jdrivesync.gdrive.GoogleDriveWalker.walk(GoogleDriveWalker.java:35)
at jdrivesync.sync.Synchronization.syncDown(Synchronization.java:321)
at jdrivesync.App.sync(App.java:89) at jdrivesync.App.run(App.java:54)
at jdrivesync.App.main(App.java:27) 2016-03-09 13:06:27 WARNING
jdrivesync.fs.FileSystemAdapter delete(): Could not move file to
.trash directory: /test/.trash/.trash/.trash
java.nio.file.FileAlreadyExistsException: /test/.trash/.trash/.trash
at sun.nio.fs.UnixCopyFile.move(UnixCopyFile.java:429) at
sun.nio.fs.UnixFileSystemProvider.move(UnixFileSystemProvider.java:262) at
java.nio.file.Files.move(Files.java:1395) at
jdrivesync.fs.FileSystemAdapter.delete(FileSystemAdapter.java:112) at
jdrivesync.fs.FileSystemAdapter$1.postVisitDirectory(FileSystemAdapter.java:79)
at
jdrivesync.fs.FileSystemAdapter$1.postVisitDirectory(FileSystemAdapter.java:68)
at java.nio.file.Files.walkFileTree(Files.java:2688) at
java.nio.file.Files.walkFileTree(Files.java:2742) at
jdrivesync.fs.FileSystemAdapter.deleteDirectorySubtree(FileSystemAdapter.java:68)
at
jdrivesync.sync.Synchronization$2.processRemoteChildNotFound(Synchronization.java:394)
at
jdrivesync.sync.Synchronization$2.visitDirectory(Synchronization.java:342)
at
jdrivesync.gdrive.GoogleDriveWalker.walkInternal(GoogleDriveWalker.java:88)
at jdrivesync.gdrive.GoogleDriveWalker.walk(GoogleDriveWalker.java:35)
at jdrivesync.sync.Synchronization.syncDown(Synchronization.java:321)
at jdrivesync.App.sync(App.java:89) at jdrivesync.App.run(App.java:54)
at jdrivesync.App.main(App.java:27) 2016-03-09 13:06:27 INFO
jdrivesync.report.NoopReport log(): Synchronized Deleted /test/.trash
2016-03-09 13:06:27 INFO jdrivesync.report.NoopReport log():
Synchronized Unchanged /kandace 2016-03-09 13:06:27 INFO
jdrivesync.report.NoopReport log(): Synchronized Unchanged /mark
2016-03-09 13:06:28 INFO jdrivesync.App printStatistics(): Statistics:
2016-03-09 13:06:28 INFO jdrivesync.App printStatistics(): NEW: 0
files 2016-03-09 13:06:28 INFO jdrivesync.App printStatistics():
DELETED: 1 file 2016-03-09 13:06:28 INFO jdrivesync.App
printStatistics(): UPDATED: 0 files 2016-03-09 13:06:28 INFO
jdrivesync.App printStatistics(): UNCHANGED: 2 files Finished uploads1
download |

I've tried putting .trash and //.trash and *//.trash into an ignore
file and using -i, but no luck, that didn't help.

Any ideas, or whether I'm doing something wrong?
Thanks!


Reply to this email directly or view it on GitHub
#16.

Ah yes, I should have mentioned that I am using it on a FreeBSD machine.

Thank you for the detailed explanation how to reproduce this issue. Meanwhile I have fixed it on the develop branch.

If you like you can try it out. Just unzip the following archive and replace the file jdrivesync-0.3.0-jar-with-dependencies.jar with the jar file contained in the zip:
jdrivesync-0.3.1-SNAPSHOT-jar-with-dependencies.zip

PS: I know it does not make sense to zip a jar archive, but github does not allow me to attach jar archives.

Thank you, that definitely improved it, and for my simple test scenario that fixes the issue...
Unfortunately, on my actual work drive with thousands of files and folders, the same issue still happens somehow. I'm not sure yet, but maybe it has something to do with the fact that I'm running this on a network drive location. Maybe there are permissions issues or something causing jdrivesync to do unusual things.
I'll see if I can get better details for reproducing it.

Yes, it appears the problem has been fixed. Thank you!