Show More
@@ -1106,7 +1106,7 b' static PyObject *getfstype(PyObject *sel' | |||||
1106 | memset(&buf, 0, sizeof(buf)); |
|
1106 | memset(&buf, 0, sizeof(buf)); | |
1107 | r = statfs(path, &buf); |
|
1107 | r = statfs(path, &buf); | |
1108 | if (r != 0) |
|
1108 | if (r != 0) | |
1109 | Py_RETURN_NONE; |
|
1109 | return PyErr_SetFromErrno(PyExc_OSError); | |
1110 | return Py_BuildValue("s", describefstype(&buf)); |
|
1110 | return Py_BuildValue("s", describefstype(&buf)); | |
1111 | } |
|
1111 | } | |
1112 | #endif /* defined(HAVE_LINUX_STATFS) || defined(HAVE_BSD_STATFS) */ |
|
1112 | #endif /* defined(HAVE_LINUX_STATFS) || defined(HAVE_BSD_STATFS) */ |
@@ -1089,7 +1089,10 b' def copyfile(src, dest, hardlink=False, ' | |||||
1089 | if hardlink: |
|
1089 | if hardlink: | |
1090 | # Hardlinks are problematic on CIFS (issue4546), do not allow hardlinks |
|
1090 | # Hardlinks are problematic on CIFS (issue4546), do not allow hardlinks | |
1091 | # unless we are confident that dest is on a whitelisted filesystem. |
|
1091 | # unless we are confident that dest is on a whitelisted filesystem. | |
1092 | fstype = getfstype(os.path.dirname(dest)) |
|
1092 | try: | |
|
1093 | fstype = getfstype(os.path.dirname(dest)) | |||
|
1094 | except OSError: | |||
|
1095 | fstype = None | |||
1093 | if fstype not in _hardlinkfswhitelist: |
|
1096 | if fstype not in _hardlinkfswhitelist: | |
1094 | hardlink = False |
|
1097 | hardlink = False | |
1095 | if hardlink: |
|
1098 | if hardlink: | |
@@ -1372,7 +1375,7 b' def fspath(name, root):' | |||||
1372 | def getfstype(dirpath): |
|
1375 | def getfstype(dirpath): | |
1373 | '''Get the filesystem type name from a directory (best-effort) |
|
1376 | '''Get the filesystem type name from a directory (best-effort) | |
1374 |
|
1377 | |||
1375 |
Returns None if we are unsure |
|
1378 | Returns None if we are unsure. Raises OSError on ENOENT, EPERM, etc. | |
1376 | ''' |
|
1379 | ''' | |
1377 | return getattr(osutil, 'getfstype', lambda x: None)(dirpath) |
|
1380 | return getattr(osutil, 'getfstype', lambda x: None)(dirpath) | |
1378 |
|
1381 |
@@ -349,7 +349,10 b' def has_hardlink():' | |||||
349 | @check("hardlink-whitelisted", "hardlinks on whitelisted filesystems") |
|
349 | @check("hardlink-whitelisted", "hardlinks on whitelisted filesystems") | |
350 | def has_hardlink_whitelisted(): |
|
350 | def has_hardlink_whitelisted(): | |
351 | from mercurial import util |
|
351 | from mercurial import util | |
352 | fstype = util.getfstype('.') |
|
352 | try: | |
|
353 | fstype = util.getfstype('.') | |||
|
354 | except OSError: | |||
|
355 | return False | |||
353 | return fstype in util._hardlinkfswhitelist |
|
356 | return fstype in util._hardlinkfswhitelist | |
354 |
|
357 | |||
355 | @check("rmcwd", "can remove current working directory") |
|
358 | @check("rmcwd", "can remove current working directory") |
General Comments 0
You need to be logged in to leave comments.
Login now