Repository: borgbackup/borg

Issue:
[1.2.0b2] borg info: error about missing "files" cache file and not getting actual info
## Is this a BUG / ISSUE report or a QUESTION?

Bug

## System information. For client/server mode post info for both machines.

#### Your borg version (borg -V).
```
# ./borg-1.2.0b2 -V
borg-1.2.0b2 1.2.0b2
# borg -V
borg 1.1.15
```
#### Operating system (distribution) and version.
Up to date 64 bit Debian 10:
```
# uname -a
Linux borg 4.19.0-14-amd64 #1 SMP Debian 4.19.171-2 (2021-01-30) x86_64 GNU/Linux
```
#### Hardware / network configuration, and filesystems used.
A vsphere VM, repo + cache on SSHFS, files to backup mounted with NFS.

#### How much data is handled by borg?
See output of borg info below.

#### Full borg commandline that lead to the problem (leave away excludes and passwords)
borg info (detailed below)

## Describe the problem you're observing.

With 1.2.0b2 borg info shows an error* and get stuck until I kill it. Using a repo created with previous 1.1 release.
*Note that I am using borg 1.1.15 with BORG_FILES_CACHE_SUFFIX set to a different value for every archive, so the "files" file doesn't exist, but there are many "files.archive-number" files.
The BORG_FILES_CACHE_SUFFIX env var is set just during the create, not while doing borg info.

No issues with borg 1.1.15 (completes in about 15 seconds):
```
# borg info
Repository ID: xxx
Location: /mnt/sshfs/borg-repo
Encrypted: Yes (repokey BLAKE2b)
Cache: /mnt/sshfs/borg-cache/xxx
Security dir: /root/.config/borg/security/xxx
------------------------------------------------------------------------------
                       Original size      Compressed size    Deduplicated size
All archives:              570.08 TB            433.07 TB              2.45 TB

                       Unique chunks         Total chunks
Chunk index:                 5142003           1124036218
```
Error + getting stuck for some minutes (until I kill it) with borg 1.2.0b2:
```
# ./borg-1.2.0b2 info
The files cache can't be read. [[Errno 2] No such file or directory: '/mnt/sshfs/borg-cache/xxx/files']
Continuing without files cache - expect lower performance.
Repository ID: xxx
Location: /mnt/sshfs/borg-repo
Encrypted: Yes (repokey BLAKE2b)
Cache: /mnt/sshfs/borg-cache/xxx
Security dir: /root/.config/borg/security/xxx
------------------------------------------------------------------------------
                       Original size      Compressed size    Deduplicated size
^C^C^C^CKeyboard interrupt
```


Discussion:
It's in `borg.cache.LocalCache._do_open`:

if it is not disabled via `--files-cache=disabled` (which is only available for `borg create`), that unconditionally loads the files cache.

Maybe it should be `constants.DEFAULT_FILES_CACHE_MODE='d'`.


Resolving patch:
diff --git a/src/borg/constants.py b/src/borg/constants.py
--- a/src/borg/constants.py
+++ b/src/borg/constants.py
@@ -72,8 +72,8 @@
 ITEMS_CHUNKER_PARAMS = (15, 19, 17, HASH_WINDOW_SIZE)
 
 # operating mode of the files cache (for fast skipping of unchanged files)
-DEFAULT_FILES_CACHE_MODE_UI = 'ctime,size,inode'
-DEFAULT_FILES_CACHE_MODE = 'cis'  # == CacheMode(DEFAULT_FILES_CACHE_MODE_UI)
+DEFAULT_FILES_CACHE_MODE_UI = 'ctime,size,inode'  # default for "borg create" command (CLI UI)
+DEFAULT_FILES_CACHE_MODE = 'd'  # most borg commands do not use the files cache at all (disable)
 
 # return codes returned by borg command
 # when borg is killed by signal N, rc = 128 + N
diff --git a/src/borg/helpers.py b/src/borg/helpers.py
--- a/src/borg/helpers.py
+++ b/src/borg/helpers.py
@@ -667,9 +667,6 @@ def FilesCacheMode(s):
     return mode
 
 
-assert FilesCacheMode(DEFAULT_FILES_CACHE_MODE_UI) == DEFAULT_FILES_CACHE_MODE  # keep these 2 values in sync!
-
-
 def dir_is_cachedir(path):
     """Determines whether the specified path is a cache directory (and
     therefore should potentially be excluded from the backup) according to


Test patch: