{"action":"created","issue":{"url":"https://api.github.com/repos/ncw/rclone/issues/268","labels_url":"https://api.github.com/repos/ncw/rclone/issues/268/labels{/name}","comments_url":"https://api.github.com/repos/ncw/rclone/issues/268/comments","events_url":"https://api.github.com/repos/ncw/rclone/issues/268/events","html_url":"https://github.com/ncw/rclone/issues/268","id":124540261,"number":268,"title":"filtering","user":{"login":"bardamatic","id":3026074,"avatar_url":"https://avatars.githubusercontent.com/u/3026074?v=3","gravatar_id":"","url":"https://api.github.com/users/bardamatic","html_url":"https://github.com/bardamatic","followers_url":"https://api.github.com/users/bardamatic/followers","following_url":"https://api.github.com/users/bardamatic/following{/other_user}","gists_url":"https://api.github.com/users/bardamatic/gists{/gist_id}","starred_url":"https://api.github.com/users/bardamatic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bardamatic/subscriptions","organizations_url":"https://api.github.com/users/bardamatic/orgs","repos_url":"https://api.github.com/users/bardamatic/repos","events_url":"https://api.github.com/users/bardamatic/events{/privacy}","received_events_url":"https://api.github.com/users/bardamatic/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-01-01T10:55:08Z","updated_at":"2016-01-02T12:27:26Z","closed_at":null,"body":"Hi ncw,\r\n\r\nFrom working with filtering rules, I noticed that rclone expands through the entire directory structure even when excluding some files.  In my setup this leads to a (infinite?) recursion of a directory that is mounted within the directory structure I am trying to sync.\r\n\r\nFor example, I have /mnt/bind which is a bind mount of /\r\n\r\nNow if I try to sync /mnt/bind, it fails.\r\n\r\nI believe the reason is because within /mnt/bind is this same mount point recurring over and over again i.e.\r\n/mnt/bind/mnt/bind/mnt...\r\n\r\nI have put this particular directory in the exclude-files.txt trying the following exclude rules for 4 separate attempts:\r\n/mnt/** \r\n/mnt** \r\nmnt/**\r\nmnt**\r\n\r\nI believe all of these function the same way for this example.  \r\n\r\nThe log reports back that this directory /mnt/ is in fact being properly excluded but rclone continues to traverse the total /mnt/ directory, attempting to report back the name of everything that was excluded.  In doing this traverse, it logs filename too long errors.\r\n\r\nI think this is the expected behaviour for name based matching, but an enhancement could be to have rclone stop traversing a directory structure that matched to be excluded, but I have no idea how possible that is.\r\n\r\n\r\nOne way around this is to use rclone in series, where each new instance is responsible for a different specific directory within /mnt/bind versus something more global.  This way I can manually skip the /mnt/bind/mnt/ directory.\r\n\r\nThat being said, I really appreciate rclone.  Thanks for all the hard work."},"comment":{"url":"https://api.github.com/repos/ncw/rclone/issues/comments/168385441","html_url":"https://github.com/ncw/rclone/issues/268#issuecomment-168385441","issue_url":"https://api.github.com/repos/ncw/rclone/issues/268","id":168385441,"user":{"login":"ncw","id":536803,"avatar_url":"https://avatars.githubusercontent.com/u/536803?v=3","gravatar_id":"","url":"https://api.github.com/users/ncw","html_url":"https://github.com/ncw","followers_url":"https://api.github.com/users/ncw/followers","following_url":"https://api.github.com/users/ncw/following{/other_user}","gists_url":"https://api.github.com/users/ncw/gists{/gist_id}","starred_url":"https://api.github.com/users/ncw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ncw/subscriptions","organizations_url":"https://api.github.com/users/ncw/orgs","repos_url":"https://api.github.com/users/ncw/repos","events_url":"https://api.github.com/users/ncw/events{/privacy}","received_events_url":"https://api.github.com/users/ncw/received_events","type":"User","site_admin":false},"created_at":"2016-01-02T12:27:26Z","updated_at":"2016-01-02T12:27:26Z","body":"Thanks for analysing that - I agree with you.\r\n\r\nI can think of two ways of fixing your problem.\r\n\r\n  * Get the remotes which understand directories to stop recursing on excluded directories.  This would be the most efficient fix.  At minimum I could to this for the local filesystem.\r\n  * Get the local filesystem driver to keep a note of the inode number of each directory it scans and skip directories it has already scanned.  This would speciffically solve the mount bind issue.\r\n\r\nI should note that rsync also has issues with mount bind directories - It doesn't skip them with the `-x` flag like you might expect."}}