Giter Site home page Giter Site logo

Comments (3)

TheJonny avatar TheJonny commented on May 23, 2024

here an strace.

strace.log

the only EACCES occurs in line 2947, followed by printing the error message:

2947 openat(AT_FDCWD, "/srv", O_RDONLY|O_CLOEXEC) = -1 EACCES (Permission denied)
2948 write(2, "cd: Permission denied: '/srv'\n", 30) = 30

from fish-shell.

TheJonny avatar TheJonny commented on May 23, 2024

builtins/cd.rs calls fds::wopen_dir, which calls fds::open_dir, which sets O_RDONLY. changing it to O_PATH works for me on Linux, but is neither portable nor correct for a function called open_dir

But it looks like open_dir is only used in cd and in the parser to initialize LibraryData::cwd_fd.
It also seems like cwd_fd is never read (grep does not find usages, and it still builds when changing it to pub(crate) in struct LibraryData.)

so can we just remove the functions, skip the filedescriptor and directly chdir? this would be portable to platforms without O_PATH (like it seems, macos) or O_SEARCH (all platforms, even if this is specified by posix)

from fish-shell.

TheJonny avatar TheJonny commented on May 23, 2024

If we want to keep cwd_fd, we can first chdir and then open(".", ...) (as done in the Parser's constructor).
As cwd_fd is an Option, this would be ok to fail.

The flag can be O_SEARCH, O_SEARCH or O_RDONLY, whatever is supported on the platform.

from fish-shell.

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.