You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fs/local: copy doesn't work with .. in pathname #4897
I'm trying to copy a file referenced with .. in the pathname and it returns an error. Running strace on the process shows that .. is getting mangled to \357\274\216:
1028793 newfstatat(AT_FDCWD, "/tmp/\357\274\216\357\274\216/tmp/test.txt", 0xc00058b628, AT_SYMLINK_NOFOLLOW) = -1 ENOENT (No such file or directory)
What is your rclone version (output from rclone version)
rclone v1.53.3-DEV
os/arch: linux/amd64
go version: go1.15.5
Which OS you are using and how many bits (e.g. Windows 7, 64 bit)
Fedora 33, 64 bit
Which cloud storage system are you using? (e.g. Google Drive)
Google Drive
The command you were trying to run (e.g. rclone copy /tmp remote:tmp)
rclone copy /tmp/../tmp/test.txt gdrive:
A log from the command with the -vv flag (e.g. output from rclone -vv copy /tmp remote:tmp)
The debug log includes some user-specific information. Here is the output of the command without -vv, let me know if you need more info:
2021/01/02 13:36:20 ERROR : : error reading source directory: directory not found
2021/01/02 13:36:20 ERROR : Attempt 1/3 failed with 1 errors and: directory not found
2021/01/02 13:36:20 ERROR : : error reading source directory: directory not found
2021/01/02 13:36:20 ERROR : Attempt 2/3 failed with 1 errors and: directory not found
2021/01/02 13:36:20 ERROR : : error reading source directory: directory not found
2021/01/02 13:36:20 ERROR : Attempt 3/3 failed with 1 errors and: directory not found
2021/01/02 13:36:20 Failed to copy: directory not found
The script had a variable (e.g. BACKUPDIR) set to the directory to be backed up. The resulting backup file was stored one directory above that, and was referenced like so: $BACKUPDIR/../$BACKUPFILE. The eventual rclone command to archive the backup file to Google Drive looked something like this:
Activity
animosity022 commentedon Jan 3, 2021
Does seem like a bug, but why would you go into a directory to back up one to go back into again? Why not use /tmp/test.txt?
kartiksubbarao commentedon Jan 3, 2021
The script had a variable (e.g. BACKUPDIR) set to the directory to be backed up. The resulting backup file was stored one directory above that, and was referenced like so:
$BACKUPDIR/../$BACKUPFILE. The eventual rclone command to archive the backup file to Google Drive looked something like this:animosity022 commentedon Jan 3, 2021
It has to do with the encoding of the "." on the local file system as you noted above.
I have to play around a bit, but I'd guess the local file system needs to not encode it as I can kinda get it working:
ivandeex commentedon Mar 16, 2021
This is the way rclone works. It is by nature a cloud-first program so instead of normalizing the path it encodes
.and..(frequently used in paths on cloud storage) into utf-8. This might look odd, so rclone allows you to control the encoding (see https://rclone.org/overview/#encoding).For the time being you can stick with the
--local-encoding=Nonekludge.Probably we can introduce an option to normalize paths before encoding and turn it on by default for local storage.
[-]copy doesn't work with .. in pathname[/-][+]fs/local: copy doesn't work with .. in pathname[/+]ivandeex commentedon Mar 16, 2021
This request is similar to #4948 but this one is for local filesystem while #4948 is for cloud storage.