Commit Graph

27 Commits

Author SHA1 Message Date
KastenMike 94409215e4 fix actual value in test 2022-01-10 12:00:43 +01:00
KastenMike c2c1d1206e add modTime on folder creation 2022-01-10 11:50:49 +01:00
Mike Futerko cb1d580bf4 Fix Chown() pull request errors 2020-12-07 15:19:45 +02:00
LandonTClipp bf960e8dcb Removing use of testify 2020-09-13 14:01:19 -05:00
LandonTClipp cb8b6bc2ff Make MemMapFs implement Lstater 2020-09-07 00:05:27 -05:00
Anish Athalye b598fbbf55 Improve handling of mode bits
- "/" should have mode `os.ModeDir|0755`, not `0000`. Among other
  things, this had resulted in `mode.IsDir()` returning false for root
  prior to this patch.
- `Mkdir`, `MkdirAll`, and `OpenFile` shouldn't be allowed to set
  permissions that are otherwise illegal through `Chmod`. This mirrors
  what Go's `os` package does: it calls `syscallMode(mode)`, which
  effectively clears out the same bits that are disallowed by `Chmod`.
- `MkdirAll` should use the given permissions for all intermediate
  directories that are created, not just for the final directory. Prior
  to this patch, intermediate directories were created with mode bits
  `0000`. Besides the permission bits being wrong, `mode.IsDir()` would
  return false for these directories prior to this patch.
2020-07-15 15:43:42 -04:00
John Starich d443df9ff3 Fix test for Windows 2020-07-11 20:57:46 -05:00
John Starich 7b70cb1dbc Fix MemMapFs.Chmod changing non-perm bits 2020-07-11 18:32:33 -05:00
Francesc Campoy 0b856b1ea9 Add support for os.O_EXCL in afero.MemMapFs 2020-05-29 13:21:39 -07:00
Bjørn Erik Pedersen ec3a3111d1
mem: Make the File return io.ErrUnexpectedEOF
Instead of panic when reading beyond its borders.

This is in line with how the OS File works.

Fixes #152
2017-12-28 12:02:27 +01:00
Martin Bertschler 84cf6dc707 set ModeDir on MkDir calls on MemMapFs
closes #118
2017-10-03 23:46:18 +02:00
Martin Bertschler 473997e418 add test that shows a bug with FileMode not being set for MemMapFs directories, clean up tests 2017-10-03 23:17:35 +02:00
jszwec 36f8810e2e Fix data races in MemMapFs
Concurrent modifications of the file system while calling
ReadDir was causing data races and sometimes panics.
2017-08-25 23:32:52 +02:00
Sotirios Mantziaris 72b3142684 Eliminate go vet warnings 2017-01-09 23:53:20 +01:00
SonOfBytes 030e8c054a Set Permissions after OpenFile, MkDir and MkDirAll methods called. Added tests to validate. 2016-11-22 16:24:52 +00:00
Jamie Wilkinson 52e4a6cfac Fixes a pass-by-value error in FileData.Name()
Fixes a pass-by-value error in FileData.Name() which causes the mutex to be copied, and use that method to retrieve the name of the file from a mem.File.  This really fixes the data race that motivated PR #95. (#96)

I can't explain why moving the lock improves the situation, nor why calling through the accessor Name() instead of locking and reading f.fileData.name is not the same, but go vet indicates that the mutex in fileData was being copied, not preserved.

The reproducing test case upstream is:
check out github.com/google/mtail
make install_deps
go test -race -timeout 1m -v -run TestProcessEvents --count=10000 ./vm

Prior to this change, the test reports a data race 3 times out of 10000, after, 0 times consistently.
2016-09-19 23:01:14 +02:00
Hanno Hecker a5d3e7c8ca fix for OsFs w/ lower timestamp resolution 2016-01-25 14:07:15 -05:00
Steve Francia fe8e895336 Migrate all backends & readme to use constructorish New... 2016-01-11 21:41:03 -05:00
Steve Francia 300870a2d5 pausing during modtime test so darwin passes 2016-01-11 13:42:25 -05:00
Martin Bertschler 9d27152292 try to speed up test on unix systems 2016-01-07 11:52:33 +01:00
Hanno Hecker bb3fe39966 set modtime on any write 2016-01-04 19:34:24 +01:00
Martin Bertschler f0b9fc1bdb Implement and test read only MemMapFs file handles
Fixes #53
2016-01-04 01:54:48 +01:00
Martin Bertschler 7096d68458 mem.File is now mem.FileData and mem.File is a file handle with a pointer to a mem.FileData 2016-01-03 23:59:42 +01:00
Martin Bertschler 7b991cb257 add a test that fails if MemMapFs has the same `at` counter for multiple file objects 2016-01-03 22:11:08 +01:00
Martin Bertschler 98ed0a3409 return improved errors from MemMapFs methods
MemMapFs.Mkdir now returns an error if the file or dir already exists
MemMapFs.Remove now returns an error if the file or dir doesn't exists

fixes #43
2015-12-20 22:09:09 +01:00
Steve Francia 943d877c43 Fix remaining Windows bugs and tests 2015-12-09 15:37:15 -05:00
Steve Francia 3a224e9827 Normalize Paths so "/boo/" and "/boo" are the same 2015-12-03 09:45:14 -05:00