Commit graph

7033 commits

Author SHA1 Message Date
Alexander Neumann
36ed3add3a add build constraints for windows 2015-08-18 21:40:40 +02:00
Alexander Neumann
47219a790f crypto tests: remove dependency on /dev/urandom 2015-08-18 21:40:40 +02:00
Alexander Neumann
c228a212b0 SetupTarTestFixture: don't depend on "sh" 2015-08-18 21:40:40 +02:00
Alexander Neumann
4f8cc1180d Vagrantfile: Disable default rsync on /vagrant 2015-08-18 21:40:39 +02:00
Alexander Neumann
3ac04257a4 fuse: disable for OpenBSD 2015-08-18 21:40:39 +02:00
Alexander Neumann
a820719c07 Merge pull request #259 from klauspost/windows-support-rebased
Add Windows support
2015-08-18 20:25:58 +02:00
Chapuis Bertil
bc5e0fa68f test the reader obtained with GetReader() 2015-08-18 17:57:06 +02:00
Chapuis Bertil
513be4b8ab test the GetReader() function 2015-08-18 15:15:17 +02:00
Chapuis Bertil
9d1c03f56e Update progress status when necessary 2015-08-18 12:57:05 +02:00
klauspost
8a2d7ff2bc Add default cache location for Windows.
Primary place for Windows cache is %APPDATA%\restic.
If that environment variable isn't set, we create a 'restic'
folder in the 'temp' directory.
2015-08-17 14:17:54 +02:00
klauspost
21ab5a488d Allow filter patterns/paths to be both '/' and os.PathSeparator
This converts filepath.Separator to '/', if it isn't already.
This allows both native paths and patterns, as well as a mix of them.
Added tests.
2015-08-17 11:48:24 +02:00
klauspost
a3570af500 Create separate disEntry.equals for Windows.
Windows does not have UID/GID the same way as unix,
so we don't attempt to compare them.
2015-08-17 11:10:12 +02:00
klauspost
d5dab39a4a Disable FUSE test on Windows. 2015-08-17 11:02:04 +02:00
klauspost
73de59a615 Make check for non-existing paths OS independent. 2015-08-17 11:01:24 +02:00
Alexander Neumann
fbe746c261 locks: fix testing stale locks created on other hosts
Closes #260
2015-08-16 16:24:04 +02:00
Klaus Post
35bd8f80c0 Split out process check as separate function.
This will allow the checks to be changed for different operating systems.

Issue #260 is related to this, but this does not change any current behaviour.
2015-08-16 15:30:36 +02:00
Klaus Post
347e800b4e Set output binary name in a variable. 2015-08-16 14:20:37 +02:00
Klaus Post
d6935d6625 Fix log message
'inode' isn't tested, so we don't want to imply that in the debug message.
2015-08-16 14:16:40 +02:00
Klaus Post
2291e70322 Match ParseInt return type. 2015-08-16 13:36:21 +02:00
Klaus Post
346c0c0c58 Don't panic on mknod on Windows
Instead return an error.
2015-08-16 13:24:21 +02:00
Klaus Post
3f992c3d6e Remove redundant code. 2015-08-16 13:22:27 +02:00
Klaus Post
458e4bb3f7 Remove empty lines. 2015-08-16 13:21:00 +02:00
Klaus Post
e1f6bbac9f Create uid/gid convertion function.
Create separate function to convert user ID / group ID of a user to integer.
Windows is a stub, since this doesn't work on Windows (uid/gid is not a number).
2015-08-16 13:16:02 +02:00
Klaus Post
0e7d0d8dba Create ignoreSigIntProcAttr()
Retrieve the SysProcAttr from a separate function. Completely eliminates syscall from main file.
2015-08-16 12:51:01 +02:00
Klaus Post
520b1b65b0 Create setNewFileMode function.
Create separate files with setNewFileMode to avoid
runtime checks.
2015-08-16 12:39:38 +02:00
Klaus Post
dfe232cf46 Add Windows node support.
The syscall.Stat_t doesn't exist on Windows, so it is replaced by an interface,
which Windows can fill out, and field access is replaced by function calls.

Common Unix functionality is put into "node_unix.go", so there is less boilerplate.

Symlinks are skipped on Windows, since they require admin privileges.
2015-08-14 15:57:47 +02:00
Klaus Post
2e7b40baca Make UID/GID '0' on Windows.
We ignore parser errors on Uid/Gid, since they are not numbers on Windows.

UID/GID is usually 'root' on Linux, so I am not sure if 0/0 is a good idea.
Maybe if the type of the fields were changed from uint32 to int, we could set it
to -1 to indicate "no value".
2015-08-14 15:50:14 +02:00
Klaus Post
4dc746dac2 Change repository type detection to first check if path is a directory that exists.
The method of determining if a repository exists doesn't work on Windows, since
the "url.Scheme" will contain the drive letter - "c" in "c:\backup",
so as a first step we check if the URL can be opened as a file,
and if so, we assume it is a 'local' type repository.
2015-08-14 15:39:16 +02:00
Klaus Post
fb3778abb6 Disable mount command on Windows.
FUSE does not support Windows, so we disable it on Windows.
2015-08-14 15:33:11 +02:00
Klaus Post
2dcb527828 Only use Setsid on Unix.
Setsid is not a part of syscall.SysProcAttr on Windows, so we only set that on
systems that have it.
2015-08-14 15:32:07 +02:00
Klaus Post
7c84d810d3 Make sure we can delete files on Windows.
Files must be closed on Windows before they can be deleted.
Therefore we keep track of all open files, and closes them before
we delete them.

Also we don't set finished blobs to read-only on Windows, since
that prevents us from deleting them.
2015-08-14 15:30:36 +02:00
Klaus Post
3804bc7493 Use bigger offset in test to avoid random test failures.
Since Windows cannot to a SIGHUP test to check if a process is live,
the test will fail because the lock isn't detected as stale if a process with
that ID exists. Process IDs are re-used agressively on Windows, so add 500000 makes
the test extremely unlikely (if not impossible) to fail.
2015-08-14 15:19:45 +02:00
Klaus Post
3504ea3992 Skip UID/GID and SIGHUP lock-check on Windows
On Windows, User ID/Group ID is not a number, so we ignore any parsing error
that may come from attempting to convert it to an integer. It will simply be '0'.

Don't defer the process Release until we have checked the error.

Skip the SIGHUP connection attempt on Windows. If the process exists, we assume it is running.
2015-08-14 15:13:11 +02:00
Klaus Post
5d5f3de62f Output EXE file on Windows platform. 2015-08-14 15:08:07 +02:00
Alexander Neumann
dc842ffa09 Add a word about git commits 2015-08-12 20:38:43 +02:00
Alexander Neumann
17ee6b1c4b Merge pull request #251 from restic/fuse-ownership
fuse/mount: Use original UID/GID as owner
2015-07-27 21:39:45 +02:00
Alexander Neumann
d5ce2da2aa fuse test: remove debug output 2015-07-26 20:57:03 +02:00
Alexander Neumann
dde0fd8421 Add option to use root as owner of files/dirs 2015-07-26 20:56:27 +02:00
Alexander Neumann
bdcb2175c5 fuse: show correct uid and gid 2015-07-26 20:02:17 +02:00
Alexander Neumann
05e2afba0b Merge pull request #249 from restic/reduce-fuse-memory-usage
Reduce memory usage for fuse mount
2015-07-26 19:20:13 +02:00
Alexander Neumann
b85927576b Address code review comments 2015-07-26 18:01:20 +02:00
Alexander Neumann
d1629e1e4e fuse: move to top level 2015-07-26 17:20:26 +02:00
Alexander Neumann
bd746a0425 fuse: refactor and add tests for fuse.file 2015-07-26 16:43:42 +02:00
Alexander Neumann
7608610d72 Merge pull request #250 from restic/remove-dead-code
Remove dead code
2015-07-26 15:12:41 +02:00
Alexander Neumann
9753c37e31 Remove dead code
This removes dead code (functions that aren't called) detected with
`deadcode`.
2015-07-26 14:56:34 +02:00
Alexander Neumann
55ddd5317d Reduce memory usage for fuse mount
This changes `repository.LoadBlob()` so that a destination buffer must
be provided, which enables the fuse code to use a buffer from a
`sync.Pool`. In addition, release the buffers when the file is closed.
At the moment, the max memory usage is defined by the max file size that
is read in one go (e.g. with `cat`). It could be further optimized by
implementing a LRU caching scheme.
2015-07-26 14:25:59 +02:00
Alexander Neumann
90ed679e88 Merge pull request #246 from restic/id-as-array
Use array instead of hash for backend.ID
2015-07-25 22:32:58 +02:00
Alexander Neumann
054256468b Fix message display for parent snapshot id 2015-07-25 18:10:23 +02:00
Alexander Neumann
5cdcc99eba Use array instead of hash for backend.ID
Since backend.ID is always a slice of constant length, use an array
instead of a slice. Mostly, arrays behave as slices, except that an
array cannot be nil, so use `*backend.ID` insteaf of `backend.ID` in
places where the absence of an ID is possible (e.g. for the Subtree of a
Node, which may not present when the node is a file node).

This change allows to directly use backend.ID as the the key for a map,
so that arbitrary data structures (e.g. a Set implemented as a
map[backend.ID]struct{}) can easily be formed.
2015-07-25 18:01:57 +02:00
Alexander Neumann
2fa6124545 Merge pull request #245 from restic/fix-224
restore: ignore errors
2015-07-25 13:17:09 +02:00