probably fix OSX ipns bug
Jeromy committed
Nov 7, 2014 at 11:35 UTC
2e2d02a741893a276f9f0e4adf5ba0c9de69c80b
3 files changed
+16
-4
fuse/ipns/ipns_test.go
+6
-4
@@ -300,10 +300,12 @@ func TestFastRepublish(t *testing.T) {
300
301
// Test writing a medium sized file one byte at a time
302
func TestMultiWrite(t *testing.T) {
303
- if runtime.GOOS == "darwin" {
304
- link := "https://github.com/jbenet/go-ipfs/issues/147"
305
- t.Skipf("Skipping as is broken in OSX. See %s", link)
306
- }
303
+ /*
304
+ if runtime.GOOS == "darwin" {
305
+ link := "https://github.com/jbenet/go-ipfs/issues/147"
306
+ t.Skipf("Skipping as is broken in OSX. See %s", link)
307
+ }
308
+ */
309
310
_, mnt := setupIpnsTest(t, nil)
311
defer mnt.Close()
fuse/ipns/ipns_unix.go
+3
@@ -232,6 +232,9 @@ func (s *Node) Attr() fuse.Attr {
232
log.Errorf("Error getting size of file: %s", err)
233
size = 0
234
}
235
+ if size == 0 {
236
+ size = s.dagMod.Size()
237
+ }
238
return fuse.Attr{
239
Mode: 0666,
240
Size: size,
unixfs/io/dagmodifier.go
+7
@@ -173,6 +173,13 @@ func (dm *DagModifier) WriteAt(b []byte, offset uint64) (int, error) {
173
return origlen, nil
174
}
175
176
+func (dm *DagModifier) Size() uint64 {
177
+ if dm == nil {
178
+ return 0
179
+ }
180
+ return dm.pbdata.GetFilesize()
181
+}
182
+
183
// splitBytes uses a splitterFunc to turn a large array of bytes
184
// into many smaller arrays of bytes
185
func splitBytes(b []byte, spl chunk.BlockSplitter) [][]byte {