2
2
mirror of https://github.com/octoleo/restic.git synced 2024-11-29 08:14:03 +00:00
Commit Graph

140 Commits

Author SHA1 Message Date
Michael Eischer
03aad742d3 fs: add correct vss support to fixpath
Paths that only contain the volume shadow copy snapshot name require
special treatment. These paths must end with a slash for regular file
operations to work.
2024-10-31 22:06:50 +01:00
Michael Eischer
15b7fb784f fs: cleanup fixpath 2024-10-31 21:49:03 +01:00
Michael Eischer
821000cb68
Merge pull request #5097 from MichaelEischer/fix-vss-metadata
backup: read extended metadata from snapshot
2024-10-22 19:23:06 +02:00
greatroar
8f20d5dcd5 fs: Refactor UtimesNano replacements
Previously, nodeRestoreTimestamps would do something like

	if node.Type == restic.NodeTypeSymlink {
	    return nodeRestoreSymlinkTimestamps(...)
	}
	return syscall.UtimesNano(...)

where nodeRestoreSymlinkTimestamps was either a no-op or a
reimplementation of syscall.UtimesNano that handles symlinks, with some
repeated converting between timestamp types. The Linux implementation
was a bit clumsy, requiring three syscalls to set the timestamps.

In this new setup, there is a function utimesNano that has three
implementations:

* on Linux, it's a modified syscall.UtimesNano that uses
  AT_SYMLINK_NOFOLLOW and AT_FDCWD so it can handle any type in a single
  call;
* on other Unix platforms, it just calls the syscall function after
  skipping symlinks;
* on Windows, it's the modified UtimesNano that was previously called
  nodeRestoreSymlinkTimestamps, except with different arguments.
2024-10-19 12:04:09 +02:00
greatroar
f967a33ccc fs: Use AT_FDCWD in Linux nodeRestoreSymlinkTimestamps
There's no need to open the containing directory. This is exactly what
syscall.UtimesNano does, except for the AT_SYMLINK_NOFOLLOW flag.
2024-10-19 11:29:35 +02:00
Michael Eischer
ca79cb92e3 fs/vss: test that vss functions actually read from snapshot 2024-10-18 21:43:46 +02:00
Michael Eischer
352605d9f0 fs: remove file.Name() from interface
The only user was archiver.fileSaver.
2024-10-18 21:43:23 +02:00
Michael Eischer
b988754a6d fs/vss: reuse functions from underlying FS
OpenFile, Stat and Lstat should reuse the underlying FS implementation
to avoid diverging behavior.
2024-10-18 19:30:05 +02:00
Michael Eischer
60960d2405 fs/vss: properly create node from vss path
Previously, NodeFromFileInfo used the original file path to create the
node, which also meant that extended metadata was read from there
instead of within the vss snapshot.
2024-10-18 19:27:44 +02:00
Michael Eischer
75711446e1 fs: move NodeFromFileInfo into FS interface 2024-10-16 21:17:21 +02:00
Michael Eischer
e91a456656
Merge pull request #5061 from MichaelEischer/fix-timestamp-restore-windows
fs: fix restoring timestamps on older Windows versions for long paths
2024-10-16 20:47:17 +02:00
greatroar
2b609d3e77 errors, fs: Replace CombineErrors with stdlib Join
This does not produce exactly the same messages, as it inserts newlines
instead of "; ". But given how long our error messages can be, that
might be a good thing.
2024-10-05 10:56:40 +02:00
greatroar
19653f9e06 fs: Simplify NodeCreateAt 2024-10-05 10:56:39 +02:00
greatroar
e10e2bb50f fs: Include filename in mknod errors 2024-10-05 10:56:39 +02:00
Michael Eischer
4469fe1575 fs: fix restoring timestamps on Windows for long paths 2024-09-15 18:28:11 +02:00
Michael Eischer
34fe73ea42 fs: retry preallocate on Linux if interrupted by signal 2024-09-07 16:39:40 +02:00
Michael Eischer
9a6059eb71
Merge pull request #5032 from dropbigfish/master
chore: fix some function name comments
2024-09-01 21:52:26 +00:00
dropbigfish
6f9513d88c chore: fix some function names
Signed-off-by: dropbigfish <fillfish@foxmail.com>
2024-09-01 00:54:39 +08:00
Michael Eischer
b91ef3f1ff fs: remove dead code 2024-08-31 18:40:36 +02:00
Michael Eischer
e2bce1b9ee fs: move WindowsAttributes definition back to restic package 2024-08-31 18:40:36 +02:00
Michael Eischer
ebdd946ac1 fs: unexport nodeRestoreTimestamps 2024-08-31 18:40:36 +02:00
Michael Eischer
2aa1e2615b fs: fix comments 2024-08-31 18:40:36 +02:00
Michael Eischer
6c16733dfd fs: remove unused methods from File interface 2024-08-31 18:40:36 +02:00
Michael Eischer
f0329bb4e6 fs: replace statT with ExtendedFileInfo 2024-08-31 18:40:36 +02:00
Michael Eischer
6d3a5260d3 fs: unexport a several windows functions 2024-08-31 18:40:36 +02:00
Michael Eischer
cf051e777a fs: remove Readdir method from File interface 2024-08-31 18:20:41 +02:00
Michael Eischer
cc7f99125a minimize usage of internal/fs in tests 2024-08-31 18:20:41 +02:00
Michael Eischer
65a7157383 mount: use os instead of fs package 2024-08-31 18:20:41 +02:00
Michael Eischer
24f4e780f1 backend: consistently use os package for filesystem access
The go std library should be good enough to manage the files in the
backend and cache folders.
2024-08-31 18:20:40 +02:00
Michael Eischer
ca1e5e10b6 add proper constants for node type 2024-08-31 18:20:01 +02:00
Michael Eischer
7bb92dc7bd archiver: use ExtendedStat from FS interface
With this change, NodeFromFileInfo is the last function that bypasses
the FS interface in the archiver.
2024-08-31 18:05:09 +02:00
Michael Eischer
e79dca644e fs: unexport DeviceID 2024-08-31 18:04:53 +02:00
Michael Eischer
f9dbcd2531 backup: convert reject funcs to use FS interface
Depending on parameters the paths in a snapshot do not directly
correspond to real paths on the filesystem. Therefore, reject funcs must
use the FS interface to work correctly.
2024-08-31 18:03:02 +02:00
Michael Eischer
507842b614 fs: remove Open method from FS interface 2024-08-31 17:37:25 +02:00
Michael Eischer
263709da8c fs: unexport isListxattrPermissionError 2024-08-31 17:37:25 +02:00
Michael Eischer
80ed863aab repository: remove redundant cleanup code
The temp files used by the packer manager are either delete after
creation (unix) or marked as delete on close (windows). Thus, no
explicit cleanup is necessary.
2024-08-31 17:37:25 +02:00
Michael Eischer
0ddb4441d7 fs: clean up helper functions 2024-08-31 17:37:25 +02:00
Michael Eischer
b9b32e5647 restic: extract Node filesystem code to fs package 2024-08-31 17:37:25 +02:00
Michael Eischer
5644079707 restic: prepare extraction of fs code from Node 2024-08-31 17:37:25 +02:00
Michael Eischer
9c70794886 fs: fix error handling for retried get/set of security descriptor
The retry code path did not filter `ERROR_NOT_SUPPORTED`. Just call the
original function a second time to correctly follow the low privilege
code path.
2024-08-26 19:36:43 +02:00
Michael Eischer
6fbfccc2d3 fs: fix race condition in get/set security descriptor
Calling `Load()` twice for an atomic variable can return different
values each time. This resulted in trying to read the security
descriptor with high privileges, but then not entering the code path to
switch to low privileges when another thread has already done so
concurrently.
2024-08-26 19:31:21 +02:00
aneesh-n
19f487750e
Add test cases and handle volume GUID paths
Gracefully handle errors while checking for EA and add debug logs.
2024-08-11 19:25:58 -06:00
aneesh-n
1d392a36f9
Fix extended attributes handling for VSS snapshots 2024-08-11 01:23:47 -06:00
aneesh-n
18e9d71d7a
Fix review comments 2024-08-10 10:38:04 -06:00
aneesh-n
9dedba6dfc
Address review comments 2024-08-04 10:23:39 -06:00
aneesh-n
8c8a066c0e
Correct the bitmask for fileSupportsExtendedAttributes and add link 2024-08-03 18:06:47 -06:00
aneesh-n
56113a8da7
Skip EA processing for volumes that do not support EA 2024-08-03 16:03:30 -06:00
textaligncenter
d8ea178e69 fix panic in fs_reader 2024-08-03 19:08:04 +00:00
Michael Eischer
62c4a5e9a0 fs: fix long path handling for ResetPermissions, ClearAttributes and security descriptors 2024-07-29 20:10:58 +02:00
Michael Eischer
1369658a32 archiver: extract Readdirnames to fs package 2024-07-05 21:03:34 +02:00