|
@@ -2,6 +2,7 @@ import argparse
|
|
import contextlib
|
|
import contextlib
|
|
import collections
|
|
import collections
|
|
import enum
|
|
import enum
|
|
|
|
+import errno
|
|
import grp
|
|
import grp
|
|
import hashlib
|
|
import hashlib
|
|
import logging
|
|
import logging
|
|
@@ -2283,8 +2284,13 @@ def truncate_and_unlink(path):
|
|
recover. Refer to the "File system interaction" section
|
|
recover. Refer to the "File system interaction" section
|
|
in repository.py for further explanations.
|
|
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)
|
|
os.unlink(path)
|
|
|
|
|
|
|
|
|