Code Monkey home page Code Monkey logo

Comments (5)

hanwen avatar hanwen commented on June 18, 2024

try using the debug functionality to see which call exactly gets EPERM. I suspect you either didn't implement SetAttr or something is wrong with your Access implementation.

from go-fuse.

mxq-151 avatar mxq-151 commented on June 18, 2024

the debug message as below

2023-01-17 21:11:42.407925 I | rx 6: GETATTR n1 {Fh 0}
2023-01-17 21:11:42.417914 I | tx 6: OK, {tA=1s {M040777 SZ=4096 L=3 0:0 B865536 i0:1 A 1672905996.913452 M 1673853159.412717 C 1673853159.412717}}
2023-01-17 21:11:42.418091 I | rx 8: GETXATTR n1 {sz 4096} ["system.posix_acl_access"] 24b
2023-01-17 21:11:42.418214 I | tx 8: 38=function not implemented
2023-01-17 21:11:42.418276 I | rx 10: LOOKUP n1 ["test.txt"] 9b
2023-01-17 21:11:42.420844 I | tx 10: OK, {n502 g1 tE=1s tA=1s {M0100664 SZ=0 L=1 1000:1000 B0
65536 i0:502 A 1673689003.279131 M 1673689003.279131 C 1673689003.279131}}
2023-01-17 21:11:42.421099 I | rx 12: GETATTR n502 {Fh 0}
2023-01-17 21:11:42.422654 I | tx 12: OK, {tA=1s {M0100664 SZ=0 L=1 1000:1000 B0*65536 i0:502 A 1673689003.279131 M 1673689003.279131 C 1673689003.279131}}

i am sure our app have been implement SetAttr method,Certain configurations limit functionality?

from go-fuse.

mxq-151 avatar mxq-151 commented on June 18, 2024
package main

import (
        "context"
        "flag"
        "fmt"
        "github.com/hanwen/go-fuse/v2/fs"
        "github.com/hanwen/go-fuse/v2/fuse"
        "log"
        "syscall"
)

type HelloRoot struct {
        fs.Inode
}

func (r *HelloRoot) OnAdd(ctx context.Context) {
        ch := r.NewPersistentInode(
                ctx, &fs.MemRegularFile{
                        Data: []byte("file.txt"),
                        Attr: fuse.Attr{
                                Mode: 0644,
                        },
                }, fs.StableAttr{Ino: 2})
        r.AddChild("file.txt", ch, false)
}

func (r *HelloRoot) Getattr(ctx context.Context, fh fs.FileHandle, out *fuse.AttrOut) syscall.Errno {
        out.Mode = 0755
        fmt.Printf(".....lllllll------\n")
        return 0
}

func (r *HelloRoot) SetAttr(cancel <-chan struct{}, in *fuse.SetAttrIn, out *fuse.AttrOut) fuse.Status {
        out.Mode = 777
        fmt.Printf("...asdfasdfasdfasd....\n")
        return 0
}

var _ = (fs.NodeGetattrer)((*HelloRoot)(nil))
var _ = (fs.NodeOnAdder)((*HelloRoot)(nil))

func main() {
        flag.Parse()
        if len(flag.Args()) < 1 {
                log.Fatal("Usage:\n  hello MOUNTPOINT")
        }
        opts := &fs.Options{}
        opts.Debug = true
        server, err := fs.Mount(flag.Arg(0), &HelloRoot{}, opts)
        if err != nil {
                log.Fatalf("Mount fail: %v\n", err)
        }
        server.Wait()
}

i use hello app in example,but with implements SetAttr,but SetAttr can not be called, although execute chown command without any error

from go-fuse.

rfjakob avatar rfjakob commented on June 18, 2024

Please compare with the loopback example (see below). I think you are missing root permissions somewhere.

--- 1st terminal ---

$ cd go-fuse/example/loopback

$ go build

$ mkdir a b

$ sudo ./loopback b a
Mounted!

--- 2nd terminal -----

$ sudo -s

# cd go-fuse/example/loopback/b

# touch test.txt

# ls -l
total 0
-rw-r--r--. 1 root root 0 18. Jan 08:15 test.txt

# chown jakob test.txt

# ls -l
total 0
-rw-r--r--. 1 jakob root 0 18. Jan 08:15 test.txt

from go-fuse.

mxq-151 avatar mxq-151 commented on June 18, 2024

sudo -s

thx for your help,i got this problem fix

from go-fuse.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.