Commit Graph

253 Commits

Author SHA1 Message Date
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
Albert Z Wang 3d990a0494 remove debug output 2017-12-12 20:08:50 -05:00
Albert Z Wang 4f332f79e7 clean paths in test comparisons 2017-11-29 14:01:03 -05:00
Albert Z Wang c5621b3590 clean basepath before stripping 2017-11-29 13:56:26 -05:00
Albert Z Wang f12a645649 add tests (thanks to @ts2909)
* copied from 6c031db617
2017-11-29 13:44:12 -05:00
Albert Z Wang 9034a12a59 add BasePathFile to fix File.Name() on BasePathFS 2017-11-29 00:20:21 -05:00
Bjørn Erik Pedersen 8d919cbe7e
Check for ErrNotExist in CopyOnWriteFs.Stat
Fixes #144
2017-11-12 17:05:09 +01:00
Martin Bertschler 5660eeed30 Merge pull request #140 from JosephSalisbury/fix-neuter-accents-godoc
Improves NeuterAccents godoc
2017-10-21 13:08:13 +02:00
Joseph Salisbury 242208d9a2
Improves NeuterAccents godoc 2017-10-13 11:08:46 +01:00
Martin Bertschler e67d870304 Merge pull request #138 from dangerousHobo/patch-1
Fix some code bugs in the README.md.
2017-10-08 20:27:26 +02:00
Martin Bertschler b48f4f807b Merge pull request #139 from snwfdhmp/patch-1
Improve code block styling in README.md
2017-10-08 18:38:47 +02:00
snwfdhmp ea5fe66f02 Minor improvement 2017-10-08 18:09:09 +02:00
Michael John 3e504d357f Fix some code bugs in the README.md. 2017-10-05 21:34:59 -04:00
Martin Bertschler 3de492c3cd Merge pull request #136 from spf13/memfs-fixes
Memfs fixes
2017-10-04 08:48:03 +02:00
Martin Bertschler 0936e8d1b2 Merge pull request #120 from thylong/master
readme: remove inferred type from AppFs declaration.
2017-10-04 01:03:46 +02: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
Martin Bertschler 8a6ade7159 Merge pull request #135 from rodaine/cacheOnRead-NotExistsError
CacheOnReadFS: erroneous NotExists error from MemMapFS layer
2017-10-03 22:45:38 +02:00
Martin Bertschler 44971ef5a2 Merge pull request #134 from corentone/mem-races
mem/file.go - Fix some races in accessing fields of FileData
2017-10-03 22:36:30 +02:00
Corentin Debains d29940f63d mem/file.go - Fix some races in accessing fields of FileData
* Splitting SetModeTime to avoid double locking
* Adding locks all over the place.
2017-09-30 22:59:59 -07:00
Chris Roche 838d6de32d CacheOnReadFS: Use os.IsNotExist to correctly detect cache misses 2017-09-04 20:40:32 -07:00
Chris Roche 655d0bd1f1 CacheOnReadFS: erroneous NotExists error 2017-09-04 20:34:40 -07:00
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
Theotime Leveque 596850cca5 readme: remove inferred type from AppFs declaration. 2017-03-25 18:31:14 -04: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