Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

File contents end at NULL bytes #1

Closed
Cytrian opened this issue Aug 21, 2012 · 3 comments
Closed

File contents end at NULL bytes #1

Cytrian opened this issue Aug 21, 2012 · 3 comments
Assignees
Labels

Comments

@Cytrian
Copy link

Cytrian commented Aug 21, 2012

rfuse-1.0.3
ruby 1.8.7 (2010-08-16 patchlevel 302) [x86_64-linux] on debian squeeze

I'm currently trying to implement a fuse-filesystem in ruby and stubled upon your fine gem.
It work's find most of the time but fails on the file-read-operation, if the contents of the file
contains NULL bytes:

def read(ctx,path,size,offset,fi)
s=IO.read("/tmp/temp.tar",size,offset)
return s
end

The contents end at the first NULL byte. What I wanted to do is some virtual, read/only fs which simulates
TAR archives for subdirectories.

Can you help me?

@ghost ghost assigned lwoggardner Aug 21, 2012
@lwoggardner
Copy link
Owner

This spec passes on both 1.8.7 (p302 and p358) and 1.9.3

      it "should read over null characters in a real file" do
           file_stat.size = 12
           File.open("/tmp/nulltest","w") { |f| f.print "hello\000world\000" }

           mockfs.stub(:getattr).with(anything(),"/testnull").and_return(file_stat)

           mockfs.stub(:read) { |ctx,path,size,offset,ffi|
               IO.read("/tmp/nulltest",size,offset)
           }

           with_fuse(mountpoint,mockfs) do
               File.open("#{mountpoint}/testnull") do |f|
                   val = f.gets
                   val.should == "hello\000world\000"
                   val.size.should == 12
                   puts val
               end
           end
       end

@lwoggardner
Copy link
Owner

so next steps will be some more debugging.

Are you running your fs via RFuse::FuseDelegator? - if so you can run ruby with -debug (or just set $DEBUG = true somewhere). This will output to $stderr the rfuse methods and arguments as they are called.

If you are subclassing RFuse::Fuse directly then I suggest refactoring to use FuseDelegator :-)

Also passing the mount option "-odebug" will cause the Fuse library itself to output debugging statements

If you could do that and attach the output somewhere that will help.

@lwoggardner
Copy link
Owner

Assume issue is resolved as invalid.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants