Skip to content

Trust checks don't work for UNC paths on Windows. #2067

Open
@gulbanana

Description

@gulbanana

Current behavior 😯

In the function is_path_owned_by_current_user at

pub fn is_path_owned_by_current_user(path: &Path) -> io::Result<bool> {
, gitoxide is calling GetNamedSecurityInfoW. This doesn't seem to work for UNC paths - repos located in WSL, or on network drives, or >255 character long paths.

I'm not quite sure what's broken. Maybe SE_FILE_OBJECT only works for regular files, or perhaps the to_wide_path() conversion is doing the wrong thing?

Expected behavior 🤔

Loading the repo, ideally.

Git behavior

It looks like git doesn't work out of the box, but provides an escape hatch:

fatal: detected dubious ownership in repository at '//wsl.localhost/Ubuntu/home/username/repo/.git'
To add an exception for this directory, call:

        git config --global --add safe.directory '%(prefix)///wsl.localhost/Ubuntu/home/username/repo/.git'

Steps to reproduce 🕹

  1. Create a repository using a WSL shell gitoxide, git or anything else.
  2. Open a non-WSL shell and navigate to the directory.
  3. Call any function that checks repo trust (I did this using jj, which uses gitoxide for git repo access).

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-WindowsWindows-specific issuesC-jjAn issue that affects https://github.com/jj-vcs/jjfeedback requestedhelp wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions