Repository: borgbackup/borg

Issue:
socket causing crash (regression)
current master branch code:

```
Traceback (most recent call last):
  File "/home/tw/w/borg/borg/archiver.py", line 2156, in main
    exit_code = archiver.run(args)
  File "/home/tw/w/borg/borg/archiver.py", line 2097, in run
    return args.func(args)
  File "/home/tw/w/borg/borg/archiver.py", line 83, in wrapper
    return method(self, args, repository=repository, **kwargs)
  File "/home/tw/w/borg/borg/archiver.py", line 295, in do_create
    create_inner(archive, cache)
  File "/home/tw/w/borg/borg/archiver.py", line 269, in create_inner
    read_special=args.read_special, dry_run=dry_run, st=st)
  File "/home/tw/w/borg/borg/archiver.py", line 350, in _process
    read_special=read_special, dry_run=dry_run)
  File "/home/tw/w/borg/borg/archiver.py", line 350, in _process
    read_special=read_special, dry_run=dry_run)
  File "/home/tw/w/borg/borg/archiver.py", line 350, in _process
    read_special=read_special, dry_run=dry_run)
  File "/home/tw/w/borg/borg/archiver.py", line 319, in _process
    if get_flags(path, st) & stat.UF_NODUMP:
  File "borg/platform_linux.pyx", line 92, in borg.platform_linux.get_flags (borg/platform_linux.c:2156)
    fd = os.open(path, os.O_RDONLY|os.O_NONBLOCK|os.O_NOFOLLOW)
OSError: [Errno 6] No such device or address: '/home/tw/w/xxx/run/gunicorn.sock'

Platform: Linux tux 4.5.4-tw1 #2 SMP Sun May 15 04:36:09 CEST 2016 x86_64 x86_64
Linux: Ubuntu 16.04 xenial
Borg: 1.0.4.dev210+ng1a02770  Python: CPython 3.5.1+
PID: 5821  CWD: /home/tw/w/borg
sys.argv: ['/home/tw/w/borg-env/bin/borg', 'create', '--progress', '--info', '--stats', '--compression', 'lz4', '/extra/repo::master', '/home/tw/w']
SSH_ORIGINAL_COMMAND: None
```



Discussion:

Resolving patch:
diff --git a/borg/testsuite/archiver.py b/borg/testsuite/archiver.py
--- a/borg/testsuite/archiver.py
+++ b/borg/testsuite/archiver.py
@@ -5,6 +5,7 @@
 from io import StringIO
 import logging
 import random
+import socket
 import stat
 import subprocess
 import sys
@@ -357,6 +358,16 @@ def filter(output):
         # the interesting parts of info_output2 and info_output should be same
         self.assert_equal(filter(info_output), filter(info_output2))
 
+    def test_unix_socket(self):
+        self.cmd('init', self.repository_location)
+        sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
+        sock.bind(os.path.join(self.input_path, 'unix-socket'))
+        self.cmd('create', self.repository_location + '::test', 'input')
+        sock.close()
+        with changedir('output'):
+            self.cmd('extract', self.repository_location + '::test')
+            assert not os.path.exists('input/unix-socket')
+
     def test_symlink_extract(self):
         self.create_test_files()
         self.cmd('init', self.repository_location)
@@ -1244,6 +1255,9 @@ def test_fuse_mount_repository(self):
         try:
             self.cmd('mount', self.repository_location, mountpoint, fork=True)
             self.wait_for_mount(mountpoint)
+            if has_lchflags:
+                # remove the file we did not backup, so input and output become equal
+                os.remove(os.path.join('input', 'flagfile'))
             self.assert_dirs_equal(self.input_path, os.path.join(mountpoint, 'archive', 'input'))
             self.assert_dirs_equal(self.input_path, os.path.join(mountpoint, 'archive2', 'input'))
         finally:
@@ -1265,6 +1279,9 @@ def test_fuse_mount_archive(self):
         try:
             self.cmd('mount', self.repository_location + '::archive', mountpoint, fork=True)
             self.wait_for_mount(mountpoint)
+            if has_lchflags:
+                # remove the file we did not backup, so input and output become equal
+                os.remove(os.path.join('input', 'flagfile'))
             self.assert_dirs_equal(self.input_path, os.path.join(mountpoint, 'input'))
         finally:
             if sys.platform.startswith('linux'):


Test patch: