Repository navigation
Description
What is the problem you are having with rclone?
I have noticed that under some circumstances (in my case, using a crypted remote) rclone sync fails to remove directories that should be removed since they do not exist on the source. In my particular circumstance, it seems like the problem is that rclone sync uses something like the rmdir command, which (somewhat silently) fails if the directory has any contents left, even broken contents that rclone is ignoring.
I think this could be fixed by making the sync use purge functionality instead of rmdir to remove directories that don't exist on the source.
Here is the output from the rclone sync command, which claims that it has deleted 23 directories.
> rclone sync --progress --bwlimit 1M --links --track-renames --track-renames-strategy size,leaf,modtime --transfers 10 --max-backlog 20 --tpslimit 40 /raid/audio odc:audio
Transferred: 0 B / 0 B, -, 0 B/s, ETA -
Checks: 296345 / 296345, 100%
Deleted: 0 (files), 23 (dirs)
Elapsed time: 13m50.5s
However, a subsequent run of the sync without any changes being made still shows it trying to remove the 23 directories it claimed it had removed on the last run. Note that no warnings or errors were reported at all (which is a separate problem).
So I ran again with -v to see what was going on with the directories it thought it was removing and got messages like this:
2022-09-12 16:44:10 INFO : work/new/waiting/Johann_Sebastian_Bach_Canadian_Brass_-_Art_Of_The_Fugue: Removing directory
2022-09-12 16:44:10 INFO : work/new/waiting/Johann Sebastian Bach; Canadian Brass - Art of the Fugue: Removing directory
Note that again, even with -v, no warnings or errors are reported with the supposedly removed directories.
So I tried manually listing (with lsl) one of the problem directories:
> rclone lsl odc:audio/work/new/waiting/Johann_Sebastian_Bach_Canadian_Brass_-_Art_Of_The_Fugue
>
Apparently no contents. So I tried rmdir on that directory:
> rclone rmdir odc:audio/work/new/waiting/Johann_Sebastian_Bach_Canadian_Brass_-_Art_Of_The_Fugue2022/09/12 16:48:06 ERROR : Attempt 1/3 failed with 1 errors and: folder not empty
2022/09/12 16:48:06 ERROR : Attempt 2/3 failed with 1 errors and: folder not empty
2022/09/12 16:48:06 ERROR : Attempt 3/3 failed with 1 errors and: folder not empty
2022/09/12 16:48:06 Failed to rmdir: folder not empty
So I tried listing the directory again with lsl -v and still got no info. Tried again with lsl -vv and finally got some useful info:
rclone lsl -vv odc:audio/work/new/waiting/Johann_Sebastian_Bach_Canadian_Brass_-_Art_Of_The_Fugue
2022/09/12 16:50:19 DEBUG : rclone: Version "v1.59.2-beta.6379.603efbfe7" starting with parameters ["rclone" "lsl" "-vv" "odc:audio/work/new/waiting/Johann_Sebastian_Bach_Canadian_Brass_-_Art_Of_The_Fugue"]
2022/09/12 16:50:19 DEBUG : Creating backend with remote "odc:audio/work/new/waiting/Johann_Sebastian_Bach_Canadian_Brass_-_Art_Of_The_Fugue"
2022/09/12 16:50:19 DEBUG : Using config file from "<redacted>"
2022/09/12 16:50:19 DEBUG : Creating backend with remote "od:<redacted>"
2022/09/12 16:50:20 DEBUG : Starting OpenDrive session with ID: <redacted>
2022/09/12 16:50:22 DEBUG : 7lnt06c8j2d8pvtcjv5nav7r5leij3atc8nn371onikjps3jbqk8gscemr6fpeibni2pame6u9hmp32kq50llb81i7vf2sbgu3jifh9k9q542dgnp9b9hira8q0l23luc57me0lm0dreqce9tdmems3es9a7v9nnk82ljvbmmqvf4khe3s4r69ethvqjka3pvccub6bi3hftu623tnjonrtuq12i7atloj8g0oc4538kto2jtmgvjpbtj1bsb2d: Skipping undecryptable file name: not a multiple of blocksize
2022/09/12 16:50:22 DEBUG : m7tnlcgevcrm559nd6mctfirjnmcu6c8esth5esmcba052hqqk5vpav73h5i453353ndsjkbqvbq5n13fpbveqi0gm2j0ljlqdg9l3qv2h2lj9mrrt0mpd5ulebr49svbtbh2jmifsdgu5ha8e16nc6q240qjaufap950lu4b3a3e7dvj5demeqc52d9cp8t5cfj77a0tjbmmjq9m0ta21jqne22qp58l5htbqh4cnjrshrd8g21k5cuptoprum: Skipping undecryptable file name: not a multiple of blocksize
2022/09/12 16:50:22 DEBUG : 2 go routines active
>
So it appears there are two files that rclone is ignoring that exist in the directory it claims it is removing, yet it is still not removing the directory when rclone sync is used, and is not providing any warning or error messages about the removal failing without -v being used.
Attempting to purge these directories manually seems to work:
> rclone purge -v odc:audio/work/new/waiting/Johann_Sebastian_Bach_Canadian_Brass_-_Art_Of_The_Fugue
>
And a repeated purge shows that the directory is actually gone now:
> rclone purge -v odc:audio/work/new/waiting/Johann_Sebastian_Bach_Canadian_Brass_-_Art_Of_The_Fugue
2022/09/12 16:58:37 ERROR : Attempt 1/3 failed with 1 errors and: directory not found
2022/09/12 16:58:37 ERROR : Attempt 2/3 failed with 1 errors and: directory not found
2022/09/12 16:58:37 ERROR : Attempt 3/3 failed with 1 errors and: directory not found
2022/09/12 16:58:37 Failed to purge: directory not found
What is your rclone version (output from rclone version)
rclone v1.59.2-beta.6379.603efbfe7
- os/version: debian 11.4 (64 bit)
- os/kernel: 5.10.0-17-amd64 (x86_64)
- os/type: linux
- os/arch: amd64
- go/version: go1.17
- go/linking: dynamic
- go/tags: none
Which OS you are using and how many bits (e.g. Windows 7, 64 bit)
Debian 11.4
Which cloud storage system are you using? (e.g. Google Drive)
Opendrive with crypt remote
How to use GitHub
- Please use the 👍 reaction to show that you are affected by the same issue.
- Please don't comment if you have no relevant information to add. It's just extra noise for everyone subscribed to this issue.
- Subscribe to receive notifications on status change and new comments.
Activity
eharris commentedon Sep 12, 2022
I believe this also points out a problem with
syncthat it allows files that it is "ignoring" to remain existing and un-reported even thoughsyncshould remove any files that are not on the source, even if they are not readable for some reason.animosity022 commentedon Sep 13, 2022
That's because you are mixing crypt and non crypt.
Fix your remotes so they don't mix..
eharris commentedon Sep 13, 2022
@animosity22 that is beside the point.
syncshould make the destination identical to the source, and should delete any files and directories that do not exist on the source, whether they are crypted or not. In this case, sync is not doing that.eharris commentedon Sep 13, 2022
And as an aside, these leftover files were at some point created by
rclone, as this remote has never been touched as non-crypt. I haven't been able to track down why yet, but when I do I'll be filing a bug on that as well. I think it has something to do with exceeding the storable cryptable filename length.animosity022 commentedon Sep 13, 2022
If the file name is too long, you get a message stating such as that's an easy one to produce.
The use case here is at some point, you probably accidentally copied from a non crypt location to a crypt location by mistake.
eharris commentedon Sep 13, 2022
@animosity22 that is a presumption without any evidence on your part, and I'm stating that that's not the case. I merely offered the info to dispel your presumption, even though it is off topic to this bug report.
animosity022 commentedon Sep 13, 2022
Isn't yours a presumption too as there's no evidence? :)
I'm just sharing what I've seen over reading tons of posts, debug logs, etc. The only time I've seen that use case is by an accidental copy from a non crypted remote to a crypt location in a remote.
That's my "theory" which has no malice, ill will, bad intent or anything else.
Could there be a bug? Sure. Could I be incorrect? Sure. I'm sharing my thoughts based on my experience.
eharris commentedon Sep 13, 2022
This is not an enhancement, it is a bug. Please mark it as so, since it clearly a violation of the stated operation of
sync. There is an exception made in the documentation for duplicate objects, but that is not the case here (directory vs files with errors).animosity022 commentedon Sep 13, 2022
It's really an enhancement as garbage in there isn't a bug but a flow issue or a bug somewhere else per your message if something else caused it but the label really doesn't matter than much imo so I changed it.
operations: --no-block-rmdir for disposable files blocking removal of…
crypt: improve handling of undecryptable file names - fixes rclone#5787
soredake commentedon Feb 24, 2024
Same problem but with mirroring folders on local filesystem.
crypt: improve handling of undecryptable file names - fixes #5787 fixes
lnostdal commentedon Apr 26, 2024
Surely this is not fixed? If I delete a directory on the remote, sync fails to remove the same directory at the target. Things like
--ignore-errorsdon't help.I tested with latest release. Using a HTTP source and local target directory.
nielash commentedon Apr 30, 2024
The original issue here was regarding
cryptfailing to remove directories due to ignored non-crypt files present in the directory. It sounds like your issue is slightly different. I'd suggest opening a new issue and including aDEBUGlog that shows the problem.See also #7720
operations: --no-block-rmdir for disposable files blocking removal of…
crypt: improve handling of undecryptable file names - fixes rclone#5787