Repository: borgbackup/borg

Issue:
1.1.0 no longer works on curlftpfs
I've been using 1.0.11 on Debian 8.9 until now with curlftpfs (0.9.2-9~deb8u1) to mount the repository, working without problems.

But 1.1.0 fails with the following error:
```
Local Exception                                                                                                                                                                       
Traceback (most recent call last):                                                                                                                                                    
  File "/usr/local/lib/python3.4/dist-packages/borg/archiver.py", line 4024, in main                                                                                                  
    exit_code = archiver.run(args)                                                                                                                                                    
  File "/usr/local/lib/python3.4/dist-packages/borg/archiver.py", line 3952, in run                                                                                                   
    return set_ec(func(args))                                                                                                                                                         
  File "/usr/local/lib/python3.4/dist-packages/borg/archiver.py", line 148, in wrapper                                                                                                
    return method(self, args, repository=repository, **kwargs)                                                                                                                        
  File "/usr/local/lib/python3.4/dist-packages/borg/archiver.py", line 528, in do_create                                                                                              
    create_inner(archive, cache)                                                                                                                                                      
  File "/usr/local/lib/python3.4/dist-packages/borg/archiver.py", line 494, in create_inner                                                                                           
    archive.save(comment=args.comment, timestamp=args.timestamp)                                                                                                                      
  File "/usr/local/lib/python3.4/dist-packages/borg/archive.py", line 477, in save                                                                                                    
    self.repository.commit()                                                                                                                                                          
  File "/usr/local/lib/python3.4/dist-packages/borg/repository.py", line 412, in commit                                                                                               
    self.compact_segments()                                                                                                                                                           
  File "/usr/local/lib/python3.4/dist-packages/borg/repository.py", line 763, in compact_segments                                                                                     
    complete_xfer(intermediate=False)                                                                                                                                                 
  File "/usr/local/lib/python3.4/dist-packages/borg/repository.py", line 666, in complete_xfer                                                                                        
    self.io.delete_segment(segment)                                                                                                                                                   
  File "/usr/local/lib/python3.4/dist-packages/borg/repository.py", line 1266, in delete_segment                                                                                      
    truncate_and_unlink(self.segment_filename(segment))                                                                                                                               
  File "/usr/local/lib/python3.4/dist-packages/borg/helpers.py", line 2286, in truncate_and_unlink                                                                                    
    with open(path, 'r+b') as fd:                                                                                                                                                     
OSError: [Errno 95] Operation not supported: '/media/backup/borg/data/0/927'                                                                                                          
                                                                                                                                                                                      
Platform: Linux ns3 4.9.0-0.bpo.3-amd64 #1 SMP Debian 4.9.30-2+deb9u5~bpo8+1 (2017-09-28) x86_64                                                                                      
Linux: debian 8.9                                                                                                                                                                     
Borg: 1.1.0  Python: CPython 3.4.2                                                                                                                                                    
PID: 49978  CWD: /                                                                                                                                                                    
sys.argv: ['/usr/local/bin/borg', 'create', '--stats', '--info', '--compression', 'lz4', '--exclude-caches', '--one-file-system', '--exclude', '/var/log/journal', '--exclude',       
'/var/lib/apt/lists', '--exclude', '/var/cache/apt', '--exclude', '/var/tmp', '--exclude', '/var/swap', '/media/backup/borg::{hostname}-{now:%Y-%m-%d_%H:%M:%S}', '/']                
SSH_ORIGINAL_COMMAND: None                                                                                
```
Commenting fd.truncate() in truncate_and_unlink fixing #2557 allows borgbackup to work again.

Maybe truncate_and_unlink should just continue with the normal unlink() if truncate fails.


Discussion:
Is the traceback complete towards the end?
I mean it is showing the OSError for the "open()", not for "truncate()".
I run borgbackup from a cronjob. Here is the complete output: 

```
/etc/cron.daily/backup-system:
------ borg start  2017-10-09-00-25 -------
Synchronizing chunks cache...
Archives: 42, w/ cached Idx: 0, w/ outdated Idx: 0, w/o cached Idx: 42.
Fetching and building archive index for ns3-2017-10-07_00:25:07 ...
Merging into master chunks index ...
Fetching and building archive index for ns3-2017-08-13_00:25:06 ...
Merging into master chunks index ...
Fetching and building archive index for ns3-2017-09-18_00:25:18 ...
Merging into master chunks index ...
Fetching and building archive index for ns3-2017-09-26_00:25:07 ...
Merging into master chunks index ...
Fetching and building archive index for ns3-2017-10-08_00:25:05 ...
Merging into master chunks index ...
Fetching and building archive index for ns3-2017-09-29_00:25:06 ...
Merging into master chunks index ...
Fetching and building archive index for ns3-2017-09-21_00:25:06 ...
Merging into master chunks index ...
Fetching and building archive index for ns3-2017-07-30_00:25:07 ...
Merging into master chunks index ...
Fetching and building archive index for ns3-2017-06-30_00:25:05 ...
Merging into master chunks index ...
Fetching and building archive index for ns3-2017-08-06_00:25:05 ...
Merging into master chunks index ...
Fetching and building archive index for ns3-2017-09-12_00:25:06 ...
Merging into master chunks index ...
Fetching and building archive index for ns3-2017-09-19_00:25:06 ...
Merging into master chunks index ...
Fetching and building archive index for ns3-2017-09-24_00:25:07 ...
Merging into master chunks index ...
Fetching and building archive index for ns3-2017-09-16_00:25:06 ...
Merging into master chunks index ...
Fetching and building archive index for ns3-2017-09-10_00:25:07 ...
Merging into master chunks index ...
Fetching and building archive index for ns3-2017-10-03_00:25:06 ...
Merging into master chunks index ...
Fetching and building archive index for ns3-2017-08-27_00:25:07 ...
Merging into master chunks index ...
Fetching and building archive index for ns3-2017-09-22_00:25:06 ...
Merging into master chunks index ...
Fetching and building archive index for ns3-2017-09-27_00:25:07 ...
Merging into master chunks index ...
Fetching and building archive index for ns3-2017-09-17_00:25:06 ...
Merging into master chunks index ...
Fetching and building archive index for ns3-2017-09-15_00:25:06 ...
Merging into master chunks index ...
Fetching and building archive index for ns3-2017-10-06_00:25:07 ...
Merging into master chunks index ...
Fetching and building archive index for ns3-2017-07-31_00:25:07 ...
Merging into master chunks index ...
Fetching and building archive index for ns3-2017-09-03_00:25:06 ...
Merging into master chunks index ...
Fetching and building archive index for ns3-2017-08-20_00:25:07 ...
Merging into master chunks index ...
Fetching and building archive index for ns3-2017-09-08_00:25:07 ...
Merging into master chunks index ...
Fetching and building archive index for ns3-2017-10-01_00:25:07 ...
Merging into master chunks index ...
Fetching and building archive index for ns3-2017-09-28_00:25:06 ...
Merging into master chunks index ...
Fetching and building archive index for ns3-2017-08-31_00:25:07 ...
Merging into master chunks index ...
Fetching and building archive index for ns3-2017-09-14_00:25:09 ...
Merging into master chunks index ...
Fetching and building archive index for ns3-2017-09-13_00:25:08 ...
Merging into master chunks index ...
Fetching and building archive index for ns3-2017-10-02_00:25:08 ...
Merging into master chunks index ...
Fetching and building archive index for ns3-2017-10-08_20:58:41 ...
Merging into master chunks index ...
Fetching and building archive index for ns3-2017-09-23_00:25:07 ...
Merging into master chunks index ...
Fetching and building archive index for ns3-2017-09-20_00:25:06 ...
Merging into master chunks index ...
Fetching and building archive index for ns3-2017-09-09_00:25:07 ...
Merging into master chunks index ...
Fetching and building archive index for ns3-2017-09-11_00:25:06 ...
Merging into master chunks index ...
Fetching and building archive index for ns3-2017-09-25_00:25:06 ...
Merging into master chunks index ...
Fetching and building archive index for ns3-2017-09-30_00:25:06 ...
Merging into master chunks index ...
Fetching and building archive index for ns3-2017-05-31_00:25:06 ...
Merging into master chunks index ...
Fetching and building archive index for ns3-2017-10-05_00:25:06 ...
Merging into master chunks index ...
Fetching and building archive index for ns3-2017-10-04_00:25:07 ...
Merging into master chunks index ...
Done.
Local Exception
Traceback (most recent call last):
  File "/usr/local/lib/python3.4/dist-packages/borg/archiver.py", line 4024, in main
    exit_code = archiver.run(args)
  File "/usr/local/lib/python3.4/dist-packages/borg/archiver.py", line 3952, in run
    return set_ec(func(args))
  File "/usr/local/lib/python3.4/dist-packages/borg/archiver.py", line 148, in wrapper
    return method(self, args, repository=repository, **kwargs)
  File "/usr/local/lib/python3.4/dist-packages/borg/archiver.py", line 528, in do_create
    create_inner(archive, cache)
  File "/usr/local/lib/python3.4/dist-packages/borg/archiver.py", line 494, in create_inner
    archive.save(comment=args.comment, timestamp=args.timestamp)
  File "/usr/local/lib/python3.4/dist-packages/borg/archive.py", line 477, in save
    self.repository.commit()
  File "/usr/local/lib/python3.4/dist-packages/borg/repository.py", line 412, in commit
    self.compact_segments()
  File "/usr/local/lib/python3.4/dist-packages/borg/repository.py", line 763, in compact_segments
    complete_xfer(intermediate=False)
  File "/usr/local/lib/python3.4/dist-packages/borg/repository.py", line 666, in complete_xfer
    self.io.delete_segment(segment)
  File "/usr/local/lib/python3.4/dist-packages/borg/repository.py", line 1266, in delete_segment
    truncate_and_unlink(self.segment_filename(segment))
  File "/usr/local/lib/python3.4/dist-packages/borg/helpers.py", line 2286, in truncate_and_unlink
    with open(path, 'r+b') as fd:
OSError: [Errno 95] Operation not supported: '/media/backup/borg/data/0/927'

Platform: Linux ns3 4.9.0-0.bpo.3-amd64 #1 SMP Debian 4.9.30-2+deb9u5~bpo8+1 (2017-09-28) x86_64 
Linux: debian 8.9 
Borg: 1.1.0  Python: CPython 3.4.2
PID: 49978  CWD: /
sys.argv: ['/usr/local/bin/borg', 'create', '--stats', '--info', '--compression', 'lz4', '--exclude-caches', '--one-file-system', '--exclude', '/var/log/journal', '--exclude', '/var/lib/apt/lists', '--exclude', '/var/cache/apt', '--exclude', '/var/tmp', '--exclude', '/var/swap', '/media/backup/borg::{hostname}-{now:%Y-%m-%d_%H:%M:%S}', '/']
SSH_ORIGINAL_COMMAND: None

Synchronizing chunks cache...
Archives: 43, w/ cached Idx: 42, w/ outdated Idx: 0, w/o cached Idx: 1.
Reading cached archive chunk index for ns3-2017-08-27_00:25:07 ...
Merging into master chunks index ...
Reading cached archive chunk index for ns3-2017-05-31_00:25:06 ...
Merging into master chunks index ...
Reading cached archive chunk index for ns3-2017-09-09_00:25:07 ...
Merging into master chunks index ...
Reading cached archive chunk index for ns3-2017-09-27_00:25:07 ...
Merging into master chunks index ...
Reading cached archive chunk index for ns3-2017-07-31_00:25:07 ...
Merging into master chunks index ...
Reading cached archive chunk index for ns3-2017-09-24_00:25:07 ...
Merging into master chunks index ...
Reading cached archive chunk index for ns3-2017-09-16_00:25:06 ...
Merging into master chunks index ...
Reading cached archive chunk index for ns3-2017-08-06_00:25:05 ...
Merging into master chunks index ...
Reading cached archive chunk index for ns3-2017-09-03_00:25:06 ...
Merging into master chunks index ...
Reading cached archive chunk index for ns3-2017-10-05_00:25:06 ...
Merging into master chunks index ...
Reading cached archive chunk index for ns3-2017-07-30_00:25:07 ...
Merging into master chunks index ...
Reading cached archive chunk index for ns3-2017-08-13_00:25:06 ...
Merging into master chunks index ...
Reading cached archive chunk index for ns3-2017-09-08_00:25:07 ...
Merging into master chunks index ...
Reading cached archive chunk index for ns3-2017-09-19_00:25:06 ...
Merging into master chunks index ...
Reading cached archive chunk index for ns3-2017-09-30_00:25:06 ...
Merging into master chunks index ...
Reading cached archive chunk index for ns3-2017-08-20_00:25:07 ...
Merging into master chunks index ...
Reading cached archive chunk index for ns3-2017-09-13_00:25:08 ...
Merging into master chunks index ...
Reading cached archive chunk index for ns3-2017-10-01_00:25:07 ...
Merging into master chunks index ...
Reading cached archive chunk index for ns3-2017-10-03_00:25:06 ...
Merging into master chunks index ...
Reading cached archive chunk index for ns3-2017-09-17_00:25:06 ...
Merging into master chunks index ...
Reading cached archive chunk index for ns3-2017-10-08_20:58:41 ...
Merging into master chunks index ...
Reading cached archive chunk index for ns3-2017-10-04_00:25:07 ...
Merging into master chunks index ...
Reading cached archive chunk index for ns3-2017-10-06_00:25:07 ...
Merging into master chunks index ...
Reading cached archive chunk index for ns3-2017-09-11_00:25:06 ...
Merging into master chunks index ...
Reading cached archive chunk index for ns3-2017-09-12_00:25:06 ...
Merging into master chunks index ...
Reading cached archive chunk index for ns3-2017-10-02_00:25:08 ...
Merging into master chunks index ...
Reading cached archive chunk index for ns3-2017-10-08_00:25:05 ...
Merging into master chunks index ...
Reading cached archive chunk index for ns3-2017-09-14_00:25:09 ...
Merging into master chunks index ...
Reading cached archive chunk index for ns3-2017-09-20_00:25:06 ...
Merging into master chunks index ...
Reading cached archive chunk index for ns3-2017-06-30_00:25:05 ...
Merging into master chunks index ...
Reading cached archive chunk index for ns3-2017-09-23_00:25:07 ...
Merging into master chunks index ...
Fetching and building archive index for ns3-2017-10-09_00:25:10 ...
Merging into master chunks index ...
Reading cached archive chunk index for ns3-2017-09-18_00:25:18 ...
Merging into master chunks index ...
Reading cached archive chunk index for ns3-2017-09-25_00:25:06 ...
Merging into master chunks index ...
Reading cached archive chunk index for ns3-2017-09-29_00:25:06 ...
Merging into master chunks index ...
Reading cached archive chunk index for ns3-2017-09-28_00:25:06 ...
Merging into master chunks index ...
Reading cached archive chunk index for ns3-2017-09-10_00:25:07 ...
Merging into master chunks index ...
Reading cached archive chunk index for ns3-2017-09-21_00:25:06 ...
Merging into master chunks index ...
Reading cached archive chunk index for ns3-2017-09-22_00:25:06 ...
Merging into master chunks index ...
Reading cached archive chunk index for ns3-2017-09-15_00:25:06 ...
Merging into master chunks index ...
Reading cached archive chunk index for ns3-2017-09-26_00:25:07 ...
Merging into master chunks index ...
Reading cached archive chunk index for ns3-2017-08-31_00:25:07 ...
Merging into master chunks index ...
Reading cached archive chunk index for ns3-2017-10-07_00:25:07 ...
Merging into master chunks index ...
Done.
Keeping archive: ns3-2017-10-09_00:25:10              Mon, 2017-10-09 00:27:10 [d292743707754aac648c63aa7f57fa8a663538fbac17ff3a1a7c470cd949fab1]
Keeping archive: ns3-2017-10-08_20:58:41              Sun, 2017-10-08 20:59:03 [65ad4d0b75aa2d2a5f86d46bb44e9b6c8a6f12381cb7fb12a9c03ea04e8ab5c6]
Keeping archive: ns3-2017-10-08_00:25:05              Sun, 2017-10-08 00:25:59 [26741947e9dfbae412b955f2b26d707cf6996769898b5a3598c9d369610a975e]
Keeping archive: ns3-2017-10-07_00:25:07              Sat, 2017-10-07 00:25:53 [9896095a1568a626efd55b38666d46c4e0303d93640701e425b99c63e23c1f35]
Keeping archive: ns3-2017-10-06_00:25:07              Fri, 2017-10-06 00:25:38 [7fd81559a8e53826861ca187b046352b2b9feff006a1bed41a0424a1d39f93f4]
Keeping archive: ns3-2017-10-05_00:25:06              Thu, 2017-10-05 00:25:53 [88b8783e4ac29ac9caebe1ed21ef325f43daa643ceabe3a72488ee5985de7ef5]
Keeping archive: ns3-2017-10-04_00:25:07              Wed, 2017-10-04 00:26:07 [4e92d7cbe135591ee4078aa819aca991be39d7636a44b94178c5a299f27bb789]
Keeping archive: ns3-2017-10-03_00:25:06              Tue, 2017-10-03 00:26:16 [4aae6c0e5e77acdfd29ee5302d5f8e0a7f4e40683efc31357b9b49134bf99009]
Keeping archive: ns3-2017-10-02_00:25:08              Mon, 2017-10-02 00:26:08 [1d6f05cc9631fcf015e22cb9e66ccae9e57475947cc63b76b1646e24000f79d7]
Keeping archive: ns3-2017-10-01_00:25:07              Sun, 2017-10-01 00:25:53 [99a40da71748bc36950eaee228e5ea5bc84506f9669e9f6d5d4055c3d30aedd7]
Keeping archive: ns3-2017-09-30_00:25:06              Sat, 2017-09-30 00:26:10 [9d62f334670c2c9f0d11f7b51cda4f1b055160e6fa934d720737d2e324b0e4d4]
Keeping archive: ns3-2017-09-29_00:25:06              Fri, 2017-09-29 00:25:56 [97faf2a0d76f1d02455d89faa67596844780f6702a27fc363eca33cfd1bd7449]
Keeping archive: ns3-2017-09-28_00:25:06              Thu, 2017-09-28 00:25:52 [357abc7c1e697084d22fde8be1723fca47e063be4e83f3e4458c3294e4d533e0]
Keeping archive: ns3-2017-09-27_00:25:07              Wed, 2017-09-27 00:25:45 [80154a69a1d23f3b3069abe3591ad42d3d2726b78e4aff7dba5a36d09db4b640]
Keeping archive: ns3-2017-09-26_00:25:07              Tue, 2017-09-26 00:26:08 [b277b617978d988260c79f20538561bb359e30380f84df0a182cd3dcf9656f51]
Keeping archive: ns3-2017-09-25_00:25:06              Mon, 2017-09-25 00:25:53 [8edd54306d04c728e9db2f510df935ee10ff7320808a30c5298adceb14daff4f]
Keeping archive: ns3-2017-09-24_00:25:07              Sun, 2017-09-24 00:25:32 [80299beddb58fcac363f0f0de57a305726a76a8fd6d8b6076593ee4c2899bff8]
Keeping archive: ns3-2017-09-23_00:25:07              Sat, 2017-09-23 00:25:44 [d54fabdd75201c4aadbafc721b034b82716ece5715c084427c094a6d4d0b8e89]
Keeping archive: ns3-2017-09-22_00:25:06              Fri, 2017-09-22 00:25:54 [832409b054580324c93c6a33b4532e3724a3af7bf144e27fdd3a7cb8fe3e7a9e]
Keeping archive: ns3-2017-09-21_00:25:06              Thu, 2017-09-21 00:25:11 [8e95cbd3c04425826f6c4f5b8ca4ced49a4b22e08f5ad105aac2c0d892a15c8c]
Keeping archive: ns3-2017-09-20_00:25:06              Wed, 2017-09-20 00:25:58 [041b59e9f90f5207c647d1fdb0f3c1e792cffca2d28aec2f80aaf56286400cf7]
Keeping archive: ns3-2017-09-19_00:25:06              Tue, 2017-09-19 00:25:37 [98ad714df1195a2b32922c427ccdab05ee7fa7deeee3e01a558d1cdc9bef3b9d]
Keeping archive: ns3-2017-09-18_00:25:18              Mon, 2017-09-18 00:25:46 [86c23a9aa91ab55ba26fa880a129a7d80cbbaff4a05864be31ca10dbfab112cd]
Keeping archive: ns3-2017-09-17_00:25:06              Sun, 2017-09-17 00:25:37 [bd9524df4625aa96a8dfa3b9b713ad7f3a7231eb83ff9cc3cc2425798e0828b2]
Keeping archive: ns3-2017-09-16_00:25:06              Sat, 2017-09-16 00:26:03 [b6ef63586c443777511fceb7962b8af631abc75003f9f7bb5511395d89f710d3]
Keeping archive: ns3-2017-09-15_00:25:06              Fri, 2017-09-15 00:25:37 [fcdc4b218dac9fde89983fd5968a244a1370e7bf14a029c1d46829b25f475b4e]
Keeping archive: ns3-2017-09-14_00:25:09              Thu, 2017-09-14 00:25:51 [b68eddbc2a6b858fdbe2aaa7fb1fa3dc263701bf9871cbac29c83c735eee4216]
Keeping archive: ns3-2017-09-13_00:25:08              Wed, 2017-09-13 00:25:32 [2bdfff4c9acdfef40094a08287899e0db12424027deda99ddeba51953b59e3a8]
Keeping archive: ns3-2017-09-12_00:25:06              Tue, 2017-09-12 00:25:31 [5b01cd479b35536166aa3177a4639da699a2df286a43dd71450db0182e9b1add]
Keeping archive: ns3-2017-09-11_00:25:06              Mon, 2017-09-11 00:26:02 [b90c1930eb0d5189ee8fb5fb29f37fbe0fa606a41bbcce3e40a0ac0cf9a1228e]
Keeping archive: ns3-2017-09-10_00:25:07              Sun, 2017-09-10 00:26:00 [27b0313536f9b06b05552fc664bc75d7265153c5b266fcd6ebee2859d8d537f6]
Keeping archive: ns3-2017-09-09_00:25:07              Sat, 2017-09-09 00:26:00 [8aa8464212283e9a12516970449e04be5599ffd47295404ceac5e219b97586b5]
Pruning archive: ns3-2017-09-08_00:25:07              Fri, 2017-09-08 00:26:07 [2d96d30e1829652f5cf10ced78eb18da1b5970dad8d53406344964c0d88da02f] (1/1)
Keeping archive: ns3-2017-09-03_00:25:06              Sun, 2017-09-03 00:25:49 [514d9617dd00c5913be5d415f2b97742119f7030ff024fdf14ab41e47657b769]
Keeping archive: ns3-2017-08-31_00:25:07              Thu, 2017-08-31 00:25:39 [fae2332bcc51ef473f8bbd7464b54ff126f5d4944478a003b5b8ab5b0c460f14]
Keeping archive: ns3-2017-08-27_00:25:07              Sun, 2017-08-27 00:25:49 [c1b9ce17836a984a6b0fc69c33a590ecfc97d3ec4dec9d0f317536dda6954564]
Keeping archive: ns3-2017-08-20_00:25:07              Sun, 2017-08-20 00:25:49 [3a9abb1d7f1991d22bb4d189f410223f04e27fc5f762e8972f3397009793e757]
Keeping archive: ns3-2017-08-13_00:25:06              Sun, 2017-08-13 00:26:12 [4121f6ad4819ee5535b8ff646e247f3ffe52671e8d124cd4ecfd210eeb8a4047]
Keeping archive: ns3-2017-08-06_00:25:05              Sun, 2017-08-06 00:25:40 [da5e81c5907baa049bdcd11ab7689c707a3ee2d67ab4ad7591d258ac54005f9d]
Keeping archive: ns3-2017-07-31_00:25:07              Mon, 2017-07-31 00:25:49 [3c1314c5d8508e91e5f44c07988c7a2b07d4363bc9bdaee8d829fb458f414e49]
Keeping archive: ns3-2017-07-30_00:25:07              Sun, 2017-07-30 00:26:09 [fd2b1f7397ebc35f77ca38bbeb5f65f3d7bd432f6304ab4edc6f094eaba112cd]
Keeping archive: ns3-2017-06-30_00:25:05              Fri, 2017-06-30 00:25:14 [5d045434755ef48be4419e0ef728a1b1feca0a176fc68d93211519c447010c0b]
Keeping archive: ns3-2017-05-31_00:25:06              Wed, 2017-05-31 00:25:13 [4efc1b1b119b557f00e4fc7b918a9a7ad8f070c3070e9d06948c4ed379cb7ea3]
Local Exception
Traceback (most recent call last):
  File "/usr/local/lib/python3.4/dist-packages/borg/repository.py", line 694, in compact_segments
    new_segment, offset = self.io.write_put(key, data, raise_full=True)
  File "/usr/local/lib/python3.4/dist-packages/borg/repository.py", line 1419, in write_put
    fd = self.get_write_fd(raise_full=raise_full)
  File "/usr/local/lib/python3.4/dist-packages/borg/repository.py", line 1227, in get_write_fd
    raise self.SegmentFull
borg.repository.SegmentFull

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.4/dist-packages/borg/archiver.py", line 4024, in main
    exit_code = archiver.run(args)
  File "/usr/local/lib/python3.4/dist-packages/borg/archiver.py", line 3952, in run
    return set_ec(func(args))
  File "/usr/local/lib/python3.4/dist-packages/borg/archiver.py", line 148, in wrapper
    return method(self, args, repository=repository, **kwargs)
  File "/usr/local/lib/python3.4/dist-packages/borg/archiver.py", line 1549, in do_prune
    repository.commit(save_space=args.save_space)
  File "/usr/local/lib/python3.4/dist-packages/borg/repository.py", line 412, in commit
    self.compact_segments()
  File "/usr/local/lib/python3.4/dist-packages/borg/repository.py", line 696, in compact_segments
    complete_xfer()
  File "/usr/local/lib/python3.4/dist-packages/borg/repository.py", line 666, in complete_xfer
    self.io.delete_segment(segment)
  File "/usr/local/lib/python3.4/dist-packages/borg/repository.py", line 1266, in delete_segment
    truncate_and_unlink(self.segment_filename(segment))
  File "/usr/local/lib/python3.4/dist-packages/borg/helpers.py", line 2286, in truncate_and_unlink
    with open(path, 'r+b') as fd:
OSError: [Errno 95] Operation not supported: '/media/backup/borg/data/0/927'

Platform: Linux ns3 4.9.0-0.bpo.3-amd64 #1 SMP Debian 4.9.30-2+deb9u5~bpo8+1 (2017-09-28) x86_64 
Linux: debian 8.9 
Borg: 1.1.0  Python: CPython 3.4.2
PID: 54632  CWD: /
sys.argv: ['/usr/local/bin/borg', 'prune', '--stats', '--list', '--info', '/media/backup/borg', '--prefix', '{hostname}-', '--keep-hourly=4', '--keep-daily=28', '--keep-weekly=6', '--keep-monthly=48', '--keep-yearly=10']
SSH_ORIGINAL_COMMAND: None

------ borg end 2017-10-09-00-38 -------
```

The script looks like this:

```
#!/bin/bash

curlftpfs backup.serverkompetenz.de /media/backup

export REPOSITORY=/media/backup/borg
export BORG_PASSPHRASE=Super-Secret-Password-Not-Really-Real

if [ "$1" = "full" ]; then
        fullbackup="--no-files-cache"
        full="full"
else
        fullbackup=""
        full=""
fi

echo "------ borg start $full `date +%Y-%m-%d-%H-%M` -------"

borg create --stats --info $fullbackup --compression lz4 --exclude-caches --one-file-system \
        --exclude '/var/log/journal' \
        --exclude '/var/lib/apt/lists' \
        --exclude '/var/cache/apt' \
        --exclude '/var/tmp' \
        --exclude '/var/swap' \
        "$REPOSITORY::{hostname}-{now:%Y-%m-%d_%H:%M:%S}" \
        /

borg prune --stats --list --info $REPOSITORY --prefix "{hostname}-" --keep-hourly=4 --keep-daily=28 --keep-weekly=6 --keep-monthly=48 --keep-yearly=10

echo "------ borg end `date +%Y-%m-%d-%H-%M` -------"

fusermount -u /media/backup

```

I see what you meant. To get borgbackup working again I commented the whole "with open()" block:

```
def truncate_and_unlink(path):
    """
    Truncate and then unlink *path*.

    Do not create *path* if it does not exist.
    Open *path* for truncation in r+b mode (=O_RDWR|O_BINARY).

    Use this when deleting potentially large files when recovering
    from a VFS error such as ENOSPC. It can help a full file system
    recover. Refer to the "File system interaction" section
    in repository.py for further explanations.
    """
    """
    with open(path, 'r+b') as fd:
        fd.truncate()
    """
    os.unlink(path)

```

Resolving patch:
diff --git a/src/borg/helpers.py b/src/borg/helpers.py
--- a/src/borg/helpers.py
+++ b/src/borg/helpers.py
@@ -2,6 +2,7 @@
 import contextlib
 import collections
 import enum
+import errno
 import grp
 import hashlib
 import logging
@@ -2283,8 +2284,13 @@ def truncate_and_unlink(path):
     recover. Refer to the "File system interaction" section
     in repository.py for further explanations.
     """
-    with open(path, 'r+b') as fd:
-        fd.truncate()
+    try:
+        with open(path, 'r+b') as fd:
+            fd.truncate()
+    except OSError as err:
+        if err.errno != errno.ENOTSUP:
+            raise
+        # don't crash if the above ops are not supported.
     os.unlink(path)
 
 


Test patch: