On branch master
Your branch is ahead of 'origin/master' by 2 commits.
(use "git push" to publish your local commits)
fatal: detected dubious ownership in repository at '/riscos-source'
To add an exception for this directory, call:
git config --global --add safe.directory /riscos-source
fatal: detected dubious ownership in repository at '/riscos-source'
To add an exception for this directory, call:
git config --global --add safe.directory /riscos-source
nothing to commit (use -u to show untracked files)
This has worked reliably until recently. Now, we get the above failure.
If we just run a grep for the st_uid calls, we see the failure case where the uid was 502... and then in the child process it suddenly starts getting returned as 0:
grep st_uid strace.log | grep '"/riscos-source"'
newfstatat(AT_FDCWD, "/riscos-source", {st_dev=makedev(0, 0x27), st_ino=19, st_mode=S_IFDIR|0775, st_nlink=19, st_uid=502, st_gid=502, st_blksize=4096, st_blocks=0, st_size=608, st_atime=1788300992 /* 2026-09-01T23:16:32.175525000+0100 */, st_atime_nsec=175525000, st_mtime=1788300992 /* 2026-09-01T23:16:32.175525000+0100 */, st_mtime_nsec=175525000, st_ctime=1788300992 /* 2026-09-01T23:16:32.175569713+0100 */, st_ctime_nsec=175569713}, 0) = 0
newfstatat(AT_FDCWD, "/riscos-source", {st_dev=makedev(0, 0x27), st_ino=19, st_mode=S_IFDIR|0775, st_nlink=19, st_uid=502, st_gid=502, st_blksize=4096, st_blocks=0, st_size=608, st_atime=1788300992 /* 2026-09-01T23:16:32.175525000+0100 */, st_atime_nsec=175525000, st_mtime=1788300992 /* 2026-09-01T23:16:32.175525000+0100 */, st_mtime_nsec=175525000, st_ctime=1788300992 /* 2026-09-01T23:16:32.175569713+0100 */, st_ctime_nsec=175569713}, 0) = 0
newfstatat(AT_FDCWD, "/riscos-source", {st_dev=makedev(0, 0x27), st_ino=19, st_mode=S_IFDIR|0775, st_nlink=19, st_uid=502, st_gid=502, st_blksize=4096, st_blocks=0, st_size=608, st_atime=1788300992 /* 2026-09-01T23:16:32.175525000+0100 */, st_atime_nsec=175525000, st_mtime=1788300992 /* 2026-09-01T23:16:32.175525000+0100 */, st_mtime_nsec=175525000, st_ctime=1788300992 /* 2026-09-01T23:16:32.175569713+0100 */, st_ctime_nsec=175569713}, AT_SYMLINK_NOFOLLOW) = 0
newfstatat(AT_FDCWD, "/riscos-source", {st_dev=makedev(0, 0x27), st_ino=19, st_mode=S_IFDIR|0775, st_nlink=19, st_uid=502, st_gid=502, st_blksize=4096, st_blocks=0, st_size=608, st_atime=1788300992 /* 2026-09-01T23:16:32.175525000+0100 */, st_atime_nsec=175525000, st_mtime=1788300992 /* 2026-09-01T23:16:32.175525000+0100 */, st_mtime_nsec=175525000, st_ctime=1788300992 /* 2026-09-01T23:16:32.175569713+0100 */, st_ctime_nsec=175569713}, 0) = 0
newfstatat(AT_FDCWD, "/riscos-source", {st_dev=makedev(0, 0x27), st_ino=19, st_mode=S_IFDIR|0775, st_nlink=19, st_uid=502, st_gid=502, st_blksize=4096, st_blocks=0, st_size=608, st_atime=1788300992 /* 2026-09-01T23:16:32.175525000+0100 */, st_atime_nsec=175525000, st_mtime=1788300992 /* 2026-09-01T23:16:32.175525000+0100 */, st_mtime_nsec=175525000, st_ctime=1788300992 /* 2026-09-01T23:16:32.175569713+0100 */, st_ctime_nsec=175569713}, AT_SYMLINK_NOFOLLOW) = 0
[pid 18206] newfstatat(AT_FDCWD, "/riscos-source", {st_dev=makedev(0, 0x27), st_ino=19, st_mode=S_IFDIR|0775, st_nlink=19, st_uid=0, st_gid=0, st_blksize=4096, st_blocks=0, st_size=608, st_atime=1788300992 /* 2026-09-01T23:16:32.175525000+0100 */, st_atime_nsec=175525000, st_mtime=1788300992 /* 2026-09-01T23:16:32.175525000+0100 */, st_mtime_nsec=175525000, st_ctime=1788300992 /* 2026-09-01T23:16:32.175569713+0100 */, st_ctime_nsec=175569713}, 0) = 0
[pid 18206] newfstatat(AT_FDCWD, "/riscos-source", {st_dev=makedev(0, 0x27), st_ino=19, st_mode=S_IFDIR|0775, st_nlink=19, st_uid=0, st_gid=0, st_blksize=4096, st_blocks=0, st_size=608, st_atime=1788300992 /* 2026-09-01T23:16:32.175525000+0100 */, st_atime_nsec=175525000, st_mtime=1788300992 /* 2026-09-01T23:16:32.175525000+0100 */, st_mtime_nsec=175525000, st_ctime=1788300992 /* 2026-09-01T23:16:32.175569713+0100 */, st_ctime_nsec=175569713}, AT_SYMLINK_NOFOLLOW) = 0
I'm not sure that I can give you complete reproduction steps as the environment is a little odd... but I think I have a reproduction that shows it...
On macOS, with a directory (anywhere you like) which is a git repository in place of $PWD/projects/RO/tools/riscos-dumpsprites/
docker run -it --rm -v $PWD/projects/RO/tools/riscos-dumpsprites/:/riscos-source -w /riscos-source --entrypoint /bin/sh -u guest alpine/git
charles@mooncake ~> docker run -it --rm -v $PWD/projects/RO/tools/riscos-dumpsprites/:/riscos-source -w /riscos-source --entrypoint /bin/sh -u guest alpine/git
/riscos-source $ ls
Makefile ci-vars res riscos_dumpsprites tests
PLAN.md project.config riscos-dumpsprites riscos_sprites
README.md pyproject.toml riscos-sprites sprites
/riscos-source $ ls -alh
total 76K
drwxrwxr-x 19 guest users 608 Sep 1 22:16 .
drwxr-xr-x 1 root root 4.0K Sep 1 23:02 ..
drwxrwxr-x 15 guest users 480 Sep 1 22:55 .git
drwxrwxr-x 3 guest users 96 Aug 23 02:11 .github
-rw-rw-r-- 1 guest users 71 Aug 23 02:11 .gitignore
-rw-rw-r-- 1 guest users 1.7K Aug 23 02:11 .gitlab-ci.yml
-rw-rw-r-- 1 guest users 1.9K Aug 23 02:11 Makefile
-rw-rw-r-- 1 guest users 12.8K Aug 23 02:11 PLAN.md
-rw-rw-r-- 1 guest users 6.3K Aug 23 02:11 README.md
-rwxrwxr-x 1 guest users 16.9K Aug 23 02:11 ci-vars
-rw-rw-r-- 1 guest users 74 Aug 23 02:11 project.config
-rw-rw-r-- 1 guest users 907 Aug 23 02:11 pyproject.toml
drwxrwxr-x 7 guest users 224 Aug 31 23:53 res
-rwxrwxr-x 1 guest users 122 Aug 23 02:11 riscos-dumpsprites
-rwxrwxr-x 1 guest users 118 Aug 23 02:11 riscos-sprites
drwxrwxr-x 6 guest users 192 Sep 1 00:27 riscos_dumpsprites
drwxrwxr-x 16 guest users 512 Sep 1 18:15 riscos_sprites
drwxrwxr-x 8 guest users 256 Sep 1 18:15 sprites
drwxrwxr-x 12 guest users 384 Sep 1 18:15 tests
/riscos-source $ git status
fatal: detected dubious ownership in repository at '/riscos-source'
To add an exception for this directory, call:
git config --global --add safe.directory /riscos-source
/riscos-source $ git status
fatal: detected dubious ownership in repository at '/riscos-source'
To add an exception for this directory, call:
git config --global --add safe.directory /riscos-source
/riscos-source $
Bug report
Bug description
Running a
git status -unocommand gives me an error when run inside a docker container:The container has been mounted with
/riscos-sourceas a bind mount to the user's current working directory on macOS. The user's UID is 502 and GID is 512. There is a user 502 in the container which has been created on entry to the container.This has worked reliably until recently. Now, we get the above failure.
Running
strace -f -v -e trace=stat,newfstatat,lstat -- git status -uno 2> tto get a log of what's being done and then looking at this file we see a number of calls which return different st_uid answers.I have attached the strace log 't' as 'strace.log'
strace.log
If we just run a grep for the st_uid calls, we see the failure case where the uid was 502... and then in the child process it suddenly starts getting returned as 0:
Reproduction steps
I'm not sure that I can give you complete reproduction steps as the environment is a little odd... but I think I have a reproduction that shows it...
On macOS, with a directory (anywhere you like) which is a git repository in place of
$PWD/projects/RO/tools/riscos-dumpsprites/docker run -it --rm -v $PWD/projects/RO/tools/riscos-dumpsprites/:/riscos-source -w /riscos-source --entrypoint /bin/sh -u guest alpine/git
Platform
macOS
Version information
Diagnostics ID
No response