Vim leaves extra file with 4-digit name on save when editing file on mounted box drive

What is the problem you are having with rclone?

When I save a file from vim in a box folder mounted using rclone, it creates an extra empty file with a 4-digit filename. For example:

[dylan@tisdall-nixos-dev:~/pennbox/Reviews/2023_07_MRM]$ ls
4913  5036  5159  5282  5405  5528  MRM-23-24017_Proof_hi.pdf  Review.txt  SupportingInformation.docx

The six number-named files were created through six separate saves of the text file Review.txt while editing.

Run the command 'rclone version' and share the full output of the command.

rclone 1.57.0
- os/version: nixos 21.11 (Porcupine) (64 bit)
- os/kernel: 5.10.126 (aarch64)
- os/type: linux
- os/arch: arm64
- go/version: go1.16.13
- go/linking: dynamic
- go/tags: cmount

Which cloud storage system are you using? (eg Google Drive)

Box

The command you were trying to run (eg rclone copy /tmp remote:tmp)

rclone mount pennbox: ~/pennbox

The rclone config contents with secrets removed.

[pennbox]
type = box
token = {"access_token":"<redacted>","token_type":"bearer","refresh_token":"<redacted>","expiry":"2023-07-20T14:52:44.786022719Z"}

A log from the command with the -vv flag

This is the log produced when I mount the Box drive, then open, save, and close the file Reviews.txt. This operation created the unwanted file 5651.

I'm not sure I've ever seen vim create a file that is not .swp as that seems strange.

You'd want to perhaps put tmp files eleswhere.

set swapfile
set dir=~/tmp

or google it and see some other ways.

And update your rclone. You are using very old version

Thanks for the suggestion. My .vimrc currently includes:

      set undofile
      set backup
      set swapfile
      set undodir=$HOME/.vim/tmp/undo
      set backupdir=$HOME/.vim/tmp/backup
      set directory=$HOME/.vim/tmp/swap

      " Make those folders automatically if they don't already exist.
      if !isdirectory(expand(&undodir))
          call mkdir(expand(&undodir), "p")
      endif
      if !isdirectory(expand(&backupdir))
          call mkdir(expand(&backupdir), "p")
      endif
      if !isdirectory(expand(&directory))
          call mkdir(expand(&directory), "p")
      endif

I've verified that swap, backup, and undo files are created in my home directory and not in the mounted Box directory. As such, I'm not sure of the origin of these files, which are created on every save, but they are only created by vim when saving on the rclone mount.

If you edit files on mount you should mount it with VFS caching mode set to full. Only then it behaves less or more like regular drive.

Thanks! My issue is resolved by mounting via:

rclone mount --vfs-cache-mode full pennbox: ~/pennbox
1 Like

I am using the latest stable and couldn't reproduce it as I tried on my mount as well. I've always seen .swp files for vi so not sure what/how that odd 5612 file is being made.

You might want to limit cache size and location. Otherwise it can grow forever:) but this should be enough if there are no other issues. Defaults are quite good.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.