Repository: borgbackup/borg

Issue:
Borg for Mac OS backs up multiple mount points even with -x
<!--
Thank you for reporting an issue.

*IMPORTANT* -  *before* creating a new issue please look around:
 - Borgbackup documentation: http://borgbackup.readthedocs.io/en/stable/index.html
 - FAQ: https://borgbackup.readthedocs.io/en/stable/faq.html
 and
 - open issues in Github tracker: https://github.com/borgbackup/borg/issues
  
If you cannot find a similar problem, then create a new issue.

Please fill in as much of the template as possible.
-->

## Have you checked borgbackup docs, FAQ, and open Github issues?

Yes

## Is this a BUG / ISSUE report or a QUESTION?

Seems to be a bug

## System information. For client/server mode post info for both machines.

#### Your borg version (borg -V).
1.1.9
#### Operating system (distribution) and version.
Mac OS Catalina
#### Hardware / network configuration, and filesystems used.

#### How much data is handled by borg?
80GB
#### Full borg commandline that lead to the problem (leave away excludes and passwords)
borg create -x --stats --noatime --progress --compression auto,zstd,22 server:/......./OSX-Direct-System-Borg::$(date "+%FT%H-%M-%S") /

## Describe the problem you're observing.
In Catalina, system is readonly partition mounted at / and data is read-write partition mounted at /System/Volumes/Data. When I create backup with -x, all data in /System/Volumes/Data and other mounted partitions are backed as well, but they should not be. Seems like identification of mounted volume at Mac OS Catalina is problematic.


#### Can you reproduce the problem? If so, describe how. If not, describe troubleshooting steps you took before opening the issue.
Use the command line above

#### Include any warning/errors/backtraces from the system logs

<!--

If this complaint relates to borg performance, please include CRUD benchmark
results and any steps you took to troubleshoot.
How to run benchmark: http://borgbackup.readthedocs.io/en/stable/usage/benchmark.html

*IMPORTANT* - Please mark logs and text output from terminal commands 
or else Github will not display them correctly. 
An example is provided below.

Example:
```
this is an example how log text should be marked (wrap it with ```)
```
-->



Discussion:

Resolving patch:
diff --git a/src/borg/archiver.py b/src/borg/archiver.py
--- a/src/borg/archiver.py
+++ b/src/borg/archiver.py
@@ -3448,13 +3448,13 @@ def define_borg_mount(parser):
         The ``-x`` or ``--one-file-system`` option excludes directories, that are mountpoints (and everything in them).
         It detects mountpoints by comparing the device number from the output of ``stat()`` of the directory and its
         parent directory. Specifically, it excludes directories for which ``stat()`` reports a device number different
-        from the device number of their parent. Be aware that in Linux (and possibly elsewhere) there are directories
-        with device number different from their parent, which the kernel does not consider a mountpoint and also the
-        other way around. Examples are bind mounts (possibly same device number, but always a mountpoint) and ALL
-        subvolumes of a btrfs (different device number from parent but not necessarily a mountpoint). Therefore when
-        using ``--one-file-system``, one should make doubly sure that the backup works as intended especially when using
-        btrfs. This is even more important, if the btrfs layout was created by someone else, e.g. a distribution
-        installer.
+        from the device number of their parent.
+        In general: be aware that there are directories with device number different from their parent, which the kernel
+        does not consider a mountpoint and also the other way around.
+        Linux examples for this are bind mounts (possibly same device number, but always a mountpoint) and ALL
+        subvolumes of a btrfs (different device number from parent but not necessarily a mountpoint).
+        macOS examples are the apfs mounts of a typical macOS installation.
+        Therefore, when using ``--one-file-system``, you should double-check that the backup works as intended.
 
 
         .. _list_item_flags:
@@ -3580,7 +3580,8 @@ def define_borg_mount(parser):
 
         fs_group = subparser.add_argument_group('Filesystem options')
         fs_group.add_argument('-x', '--one-file-system', dest='one_file_system', action='store_true',
-                              help='stay in the same file system and do not store mount points of other file systems.  This might behave different from your expectations, see the docs.')
+                              help='stay in the same file system and do not store mount points of other file systems - '
+                              'this might behave different from your expectations, see the description below.')
         fs_group.add_argument('--numeric-owner', dest='numeric_ids', action='store_true',
                               help='deprecated, use ``--numeric-ids`` instead')
         fs_group.add_argument('--numeric-ids', dest='numeric_ids', action='store_true',


Test patch: