Commit Graph

180 Commits

Author SHA1 Message Date
Kevin Crawley ee1bd8ee15 Added glob/match support to afero 2017-09-01 15:23:52 +10: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
Bjørn Erik Pedersen 9be650865e travis: Bump to Go 1.7.5 and 1.8 2017-02-17 17:41:46 +01:00
Sotirios Mantziaris 72b3142684 Eliminate go vet warnings 2017-01-09 23:53:20 +01:00
Martin Bertschler 90dd71edc4 Merge pull request #113 from moorereason/iss112
Fix data races in MemMapFs.Chmod and Chtimes
2016-12-26 10:19:39 +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
Martin Bertschler 8a1f1350d8 Merge pull request #99 from moorereason/unused
Remove unused code
2016-12-08 19:19:22 +01:00
Martin Bertschler 22793e5c8b Merge pull request #111 from harsimranmaan/gofmt
Keep gofmt happy
2016-12-08 19:17:24 +01:00
Harsimran Singh Maan a1903a1b07
Keep gofmt happy 2016-11-22 22:54:07 -08: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
Travis Yoder 06b7e5f506 Fix typo in RemoveAll code comment 2016-11-09 01:09:53 +01:00
Laurent Charignon 944579a3fc Improve code in Readme
This patch makes the code in readme valid. The previous code had a few typos.
2016-11-09 01:08:59 +01:00
Cameron Moore 7711a1eb64 Move sftpfs to subpackage
* move to sftpfs subpackage

* rename sftp dir to sftpfs
* sftpfs: Add New func and clean up interface

Fixes #97 
Updates #89
2016-11-09 01:07:28 +01:00
Cameron Moore 529281e51b Remove unused code 2016-10-03 22:03:51 -05: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
Martin Bertschler 20500e2abd Merge pull request #93 from moorereason/no-defer-on-err
Immediately check for errors on fs.Open
2016-08-21 10:36:12 +02:00
Martin Bertschler 5596f5f73e Merge pull request #95 from jaqx0r/read-data-race
Fixes a data race caused by not locking the mem.FileData for read access.
2016-08-21 10:28:07 +02:00
Jamie Wilkinson 40ffa2c25c Fixes a data race caused by not locking the mem.FileData for read access. 2016-08-20 23:27:14 +10:00
Bjørn Erik Pedersen b28a7effac Add Go 1.7 to Travis config 2016-08-16 10:07:57 +02:00
Bjørn Erik Pedersen cc9c21814b Bump Travis to Go 1.6.3 2016-07-18 23:47:48 +02:00
Hanno Hecker 9d16de2320 Merge pull request #91 from matthieugrieger/fix-readme-testing-example
Fixed utility function calls in testing example
2016-07-09 19:46:09 +02:00
Cameron Moore 8bf3f8b71f Immediately check for errors on fs.Open
Found with github.com/dominikh/go-staticcheck
2016-07-01 10:44:25 -05:00
Bjørn Erik Pedersen 0979251a4a Replace log.Fatal with log.Panic
Fixes #92
2016-06-27 02:21:49 +02:00
Bjørn Erik Pedersen 1a8ecf8b9d Test on both Linux and OSX 2016-06-06 00:02:38 +02:00
Bjørn Erik Pedersen 6b1e71387a Fix Travis config 2016-06-05 23:53:54 +02:00
Steve Francia e7c8609bb0 Add support for dragonfly and netbsd 2016-06-03 16:31:14 -04:00
Matthieu Grieger ea7b1968a9 Fixed utility function calls in testing example 2016-06-01 21:37:16 -07:00
Bjørn Erik Pedersen f0b36a98d3 Update Travis config 2016-05-08 20:08:58 +02:00
Bjørn Erik Pedersen eb0cc807c2 Fix parent not present on Windows
This will (in some cases?) `syscall.ENOTDIR`.

Fixes #86
2016-04-27 09:25:23 +02:00
Martin Bertschler 5dbffb6d3a Merge pull request #83 from francoishill/master
Add `FullBaseFsPath` utility method
2016-04-20 15:12:21 +02:00
Martin Bertschler 12baa8a6f2 Merge branch with fix for OpenFile behaviour in CopyOnWriteFs' 2016-04-20 14:37:44 +02:00
Martin Bertschler 8404a5e8bf don't return error in CopyOnWriteFs OpenFile if it is a not exist error
fixes #78
2016-04-20 14:30:10 +02:00
Francois Hill (fhill-wks) 3c4cfa198e Add `FullBaseFsPath` utility method
This method resolves the "Full" path of the `BasePathFs`. It also resolves for nested BasePaths.
Unit tests were also added
2016-04-20 14:12:23 +02:00
Martin Bertschler 0718c080db Merge pull request #82 from go-zero-boilerplate/master
Revert previous fullPath changes - add tests for nested BasePaths
2016-04-20 13:31:01 +02:00
Francois Hill (home win10) 7b5e657cdb Revert the previous `fullPath` changes and add tests for "nested" `BasePath`'s 2016-04-20 03:23:58 +02:00
paul gruenbacher beda367433 test to replicate stat error 2016-04-18 19:25:52 -04:00
Martin Bertschler a80ea58826 Merge pull request #80 from go-zero-boilerplate/master
Closes spf13/afero#79
2016-04-18 21:37:44 +02:00
Francois Hill (dell laptop) 8e75131a67 Closes spf13/afero#79
Amendment to previous commit, fixed the related test
2016-04-18 20:17:01 +02:00
Francois Hill (dell laptop) 139c7715f0 Closes spf13/afero#79
Rather keep the `RealPath` behaviour as originally implemented. Added a new method `fullPath` which is used by all other methods like `MkDir`.
2016-04-18 20:14:10 +02:00
Francois Hill (dell laptop) 9a1fcfb267 Closes spf13/afero#79
Added fix to support "nested" `BasePathFs`. Unit-tests are also included.
2016-04-18 19:29:19 +02:00
Bjørn Erik Pedersen 2f194a29d5 Add FileContainsAnyBytes 2016-02-17 11:33:17 +01:00
Bjørn Erik Pedersen 469e5f14dc Add tests for readerContains 2016-02-17 11:05:13 +01:00
bep ddb4d0857d Improve absolute file paths handling in BasePathFs
A common mistake in using the BasePathFs is to give it a real
OS absolute file path instead of a virtual one relative to the virtual base.

This commit adds some tests and returns an error on Windows in this case.

On Unix we have to train the users to do a better job.

See https://github.com/spf13/hugo/issues/1800
2016-02-15 19:09:17 +01:00
bep 3c51231761 Fix broken Windows tests
@spf13 having a CI on Windows is only useful if you actually look at the
build output.
2016-02-15 12:13:46 +01:00
Bjørn Erik Pedersen 28789ef4b7 Add missing copyright to util.go
Using "The Hugo Authors" inside Hugo is fine, since the Git history shows the origin of the code.

By moving the code from Hugo to Afero (deleting the original), that history is lost -- or very hard to track.
2016-02-13 18:09:23 +01:00
Lenilson J. Dias 7e073c0c70 Fix syscall.EBADFD at FreeBSD
Solve this: https://github.com/spf13/afero/issues/68

      go get github.com/spf13/afero
      # github.com/spf13/afero
      gocode/src/github.com/spf13/afero/const_win_unix.go:22: undefined: syscall.EBADFD
2016-02-03 11:50:36 -02:00
Hanno Hecker 4c1d2aade6 Merge pull request #67 from tatsushid/fix/copyonwritefs-patherr-handling
Fix CopyOnWriteFs Stat to handle *os.PathError
2016-02-01 18:04:30 +01:00
Tatsushi Demachi 3bf3fe3a71 Fix CopyOnWriteFs Stat to handle *os.PathError
CopyOnWriteFs Stat function only checks its base file system's file or
directory when its layer file system returns Stat error but if the layer
file system type is OsFs, it returns *os.PathError not syscall.ENOENT so
in this case, the base file system's file or directory is never checked.

This fixes the behavior above by expanding *os.PathError and repacking
the error code if the error type is *os.PathError.
2016-01-31 23:16:38 +09:00