Commit Graph

54 Commits

Author SHA1 Message Date
yearnfar 061c13d75b bugfix: RemoveAll
when i RemoveAll lib directory, it also Removed libs directory
2021-11-15 00:13:11 +08:00
Mike Futerko cb1d580bf4 Fix Chown() pull request errors 2020-12-07 15:19:45 +02: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 57ab25aed5 Use more appropriate func name for unrestricted mode changes 2020-07-11 20:42:35 -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
Michail Kargakis 90f4ffe95f
Gofmt the project 2020-04-10 23:59:22 +02:00
Bohdan Lisovskyi 30c3c32863 add chown method 2020-01-22 16:25:31 +02:00
Martin Bertschler 84cf6dc707 set ModeDir on MkDir calls on MemMapFs
closes #118
2017-10-03 23:46:18 +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
Cameron Moore b2ec40fb24 Fix data races in MemMapFs.Chmod and Chtimes
Fixes #112
2016-12-25 23:43:06 -06:00
Martin Bertschler 2f30b2a92c Merge pull request #110 from SonOfBytes/memfs-perm-fix
Set perm in MemMapFS after OpenFile, MkDir and MkDirAll methods called
2016-12-08 19:21:42 +01:00
SonOfBytes b34e0196a7 Update memmap.go
remove unnecessary comment
2016-11-22 16:54:00 +00:00
SonOfBytes 030e8c054a Set Permissions after OpenFile, MkDir and MkDirAll methods called. Added tests to validate. 2016-11-22 16:24:52 +00:00
Cameron Moore 529281e51b Remove unused code 2016-10-03 22:03:51 -05:00
Bjørn Erik Pedersen 0979251a4a Replace log.Fatal with log.Panic
Fixes #92
2016-06-27 02:21:49 +02:00
Steve Francia fe8e895336 Migrate all backends & readme to use constructorish New... 2016-01-11 21:41:03 -05:00
Martin Bertschler 6a67f8a50b Remove FileExists error in MemMapFs.Rename when destination file exists, because os.Rename also doesn't return the error 2016-01-07 11:47:44 +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 a5f01f1106 replace mem.File handles with mem.FileData when mem.FileData is all we need 2016-01-04 00:36:01 +01:00
Martin Bertschler 0321b04b21 fix mem.DirMap and mem.Dir to only use *FileData and not *File handles 2016-01-04 00:18:26 +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 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
Bjørn Erik Pedersen 2101bdf57c Unexport the RWMutex in MemMapFs 2015-12-18 21:26:04 +01:00
Bjørn Erik Pedersen 7e65370ebb Remove unused mutex 2015-12-18 19:49:23 +01:00
Bjørn Erik Pedersen 75b0bd216a Fix data races in MemMapFs
Also simplifiy the lock constructs.

Fixes #44
Fixes #45
2015-12-18 19:20:45 +01:00
Steve Francia 12f79b29b2 Update mem to keep things private 2015-12-10 15:13:36 -05:00
Steve Francia 4b2ab283a0 add debugging method for MemMapFs 2015-12-10 15:13:17 -05:00
Martin Bertschler 37f7afc8d7 Fix artefacts from moving MemMapFs types into subpackage mem 2015-12-10 18:55:43 +01:00
Steve Francia 965d098e7c Moving memory structures and interfaces into sub package 2015-12-10 12:26:38 -05:00
Steve Francia 943d877c43 Fix remaining Windows bugs and tests 2015-12-09 15:37:15 -05:00
Steve Francia daf7a87d8f Make "findParent" work on Windows properly
Fixes #31
2015-12-08 21:48:19 -05:00
Steve Francia f50d862134 Adding "/" to MemMapFS in a cleaner way 2015-12-08 16:24:09 -05:00
Steve Francia a9385f2db9 Removing extra normalize call
(since open already normalizes)
2015-12-08 16:24:09 -05:00
Steve Francia 54ad8f690d MkdirAll should respect permissions (MemMapFS) 2015-12-08 16:24:09 -05:00
Steve Francia 3a224e9827 Normalize Paths so "/boo/" and "/boo" are the same 2015-12-03 09:45:14 -05:00
Steve Francia 75dc847d59 Start MemMapFS with a root directory. 2015-12-02 16:27:14 -05:00
Martin Bertschler 5a59c3f940 properly rename files by changing file.name and newly registering with parent 2015-11-22 14:34:57 +01:00
spf13 3f6f746a75 Treat existing files and directories differently in MemMapFS. 2015-11-16 21:26:16 -05:00
Martin Bertschler 0a58b8245b Fix a bug that happens when the parent is the "." file. 2015-11-07 01:33:53 +01:00
Alex Tomlins 582dcbe54c Support O_TRUNC flag to MemMapFs.OpenFile
To truncate an existing file when opening.
2015-11-05 06:59:56 -05:00
Alex Tomlins 7441922445 Support O_APPEND flag in *MemMapFs.Openfile
To allow opening an existing file in append mode.
2015-11-05 06:59:56 -05:00
Alex Tomlins 47e9336de6 Handle O_CREATE flag to *MemMapFs.OpenFile.
To allow MemMapFs to be used in place of OsFs in tests where this flag
is used to create the file if it doesn't already exist..
2015-11-05 06:59:56 -05:00
Martin Bertschler 10150bfa64 fix Readdir behaviour for n > 0, fix RemoveAll 2015-11-04 20:33:40 +01:00
Martin Bertschler 3de0cfae06 make Readdir and Readdirnames work
+ fix registerWithParent function
+ fix unRegisterWithParent and use it in Remove and RemoveAll
+ fix findParent function
+ add lock free versions of Mkdir and Open for the use during register and unregistering with parent, so that these changes happen atomical
2015-10-17 12:58:11 +02:00
Alex Tomlins 6ced24dbe1 Make MemMapFs.Remove() error for non-existent file
So that it's consistent with the os package.
2015-09-08 08:16:57 -04:00
Alex Tomlins a269144fd6 Fix MemMapFs.Remove() to really delete the file.
It was attempting to delete a file with a hardcoded path of "name" as
opposed to the path in the `name` variable.

Fixing this exposed a deadlock because the function was attempting to
acquire an exclusive lock when it already had a read lock.
2015-09-08 08:16:57 -04:00
Anton Tiurin 5849bf9936 [MemMap] Fix a data race
Signed-off-by: Anton Tiurin <noxiouz@yandex.ru>
2015-09-08 08:15:56 -04:00