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

--b2-versions should not treat file names starting with periods as extensions #5244

Closed
jikamens opened this issue Apr 13, 2021 · 5 comments
Closed

Comments

@jikamens
Copy link

The associated forum post URL from https://forum.rclone.org

n/a

What is the problem you are having with rclone?

The --b2-versions logic in rclone tries to be smart about moving the file extensions of the names of previous versions of files to the end of the file name, after the version string. For example:

$ rclone mount B2:jik-test ~/tmp/mnt &
[1] 111847
$ cd ~/tmp/mnt
$ echo foo > foo.txt
$ echo bar >| foo.txt
$ rclone ls --b2-versions B2:jik-test
        4 foo.txt
        4 foo-v2021-04-13-183633-000.txt
$ 

This doesn't quite have the correct behavior for dot-files:

$ echo foo > .bash_profile
$ echo bar >| .bash_profile
$ rclone ls --b2-versions B2:jik-test
        4 .bash_profile
        4 -v2021-04-13-183730-000.bash_profile
        4 foo.txt
        4 foo-v2021-04-13-183633-000.txt
$ 

If the file name starts with a period, then that period should not be considered the start of an extension.

What is your rclone version (output from rclone version)

$ rclone version
rclone v1.56.0-beta.5398.964c3e073
- os/version: ubuntu 21.04 (64 bit)
- os/kernel: 5.10.0-14-generic (x86_64)
- os/type: linux
- os/arch: amd64
- go/version: go1.16.3
- go/linking: static
- go/tags: none

Which OS you are using and how many bits (e.g. Windows 7, 64 bit)

Ubuntu 21.04 amd64

Which cloud storage system are you using? (e.g. Google Drive)

B2

The command you were trying to run (e.g. rclone copy /tmp remote:tmp)

See above.

A log from the command with the -vv flag (e.g. output from rclone -vv copy /tmp remote:tmp)

$ rclone ls -vv --b2-versions B2:jik-test                                      
2021/04/13 14:39:04 DEBUG : Using config file from "/home/jik/.rclone.conf"    
2021/04/13 14:39:04 DEBUG : rclone: Version "v1.56.0-beta.5398.964c3e073" starting with parameters ["rclone" "ls" "-vv" "--b2-versions" "B2:jik-test"]       
2021/04/13 14:39:04 DEBUG : Creating backend with remote "B2:jik-test"         
2021/04/13 14:39:04 DEBUG : B2: detected overridden config - adding "{pO73u}" suffix to name                                                                 
2021/04/13 14:39:04 DEBUG : fs cache: renaming cache item "B2:jik-test" to be canonical "B2{pO73u}:jik-test"                                                 
        4 .bash_profile                                                        
        4 -v2021-04-13-183730-000.bash_profile                                 
        4 foo.txt                                                              
        4 foo-v2021-04-13-183633-000.txt                                       
2021/04/13 14:39:05 DEBUG : 6 go routines active                               
$ 
@ncw
Copy link
Member

ncw commented Apr 17, 2021

Well spotted.

It should be quite easy to fix if you want to have a go?

@jikamens
Copy link
Author

Alas, I have not yet learned to Go, and as much as I would like to, I don't have the time to do so on personal time and there's nothing to justify doing it on work time. While it would probably indeed be "quite easy" for a Go programmer, I can't afford the time to do the necessary ramp-up just to fix this bug. ;-)

@ncw
Copy link
Member

ncw commented Apr 19, 2021

That is fine!

I've attempted to fix this here - can you give it a go?

v1.56.0-beta.5411.5ef08186d.fix-5244-versions on branch fix-5244-versions (uploaded in 15-30 mins)

@ncw ncw added this to the v1.56 milestone Apr 19, 2021
@ncw
Copy link
Member

ncw commented May 17, 2021

I've merged this to master now which means it will be in the latest beta in 15-30 minutes and released in v1.56

@ncw ncw closed this as completed in 06f2738 May 17, 2021
@jikamens
Copy link
Author

Thanks. Sorry I wasn't able to test. It was in my queue but I just never managed to get it all the way to the top. :-/

negative0 pushed a commit to negative0/rclone that referenced this issue Aug 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants