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

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

Open
marcederis opened this issue Mar 9, 2016 · 5 comments
Open

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

marcederis opened this issue Mar 9, 2016 · 5 comments

Comments

@marcederis
Copy link

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!

@ondrejb7
Copy link

ondrejb7 commented Mar 9, 2016

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.

@marcederis
Copy link
Author

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

@siom79
Copy link
Owner

siom79 commented Mar 10, 2016

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.

@marcederis
Copy link
Author

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.

@ondrejb7
Copy link

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

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

4 participants
@siom79 @marcederis @ondrejb7 and others