{"thread":{"id":"54940","subject":"Bug: permissions problem when recursively cloning from a suid program","startedAt":"2021-01-05T18:16:24Z","lastAt":"2021-01-05T18:16:24Z","messageCount":1,"participants":["southerntofu@thunix.net"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"413475","messageId":"X/Sq38YKmLjY4KmD@thunix.net","threadId":"54940","inReplyTo":null,"subject":"Bug: permissions problem when recursively cloning from a suid program","fromName":"","fromEmail":"southerntofu@thunix.net","sentAt":"2021-01-05T18:07:27Z","receivedAt":"2021-01-05T18:16:24Z","isPatch":false,"sender":{"key":"southerntofu@thunix.net","avatar":null},"body":"What did you do before the bug happened? (Steps to reproduce your issue)\n\nHi, i tried to clone a repository with submodules from a program running with the suid/guid bit set.\n\nWhat did you expect to happen? (Expected behavior)\n\nIt should clone the repository, with the submodules, with permissions from the owner of the suid program.\n\nWhat happened instead? (Actual behavior)\n\ngit fails with a permissions error:\n\n```\nerror: could not lock config file /path/to/.git/config: Permission denied\nfatal: Failed to register url for submodule path\n```\n\nWhat's different between what you expected and what actually happened?\n\nCloning failed when fetching submodules (--recursive). However, it only works without submodules.\n\nAnything else you want to add:\n\nI could reproduce the bug on the next branch. I have a small reproduction case. It's a rust program, but the code is a bit more convoluted so it works without any dependency (just the standard library). Reproduction instructions in the repository:\n\nhttps://tildegit.org/southerntofu/testsuid\n\n[System Info]\ngit version:\ngit version 2.30.0.284.gd98b1dd5ea\ncpu: x86_64\nbuilt from commit: d98b1dd5eaa7327399716162c746c9bd3cac3866\nsizeof-long: 8\nsizeof-size_t: 8\nshell-path: /bin/sh\n[REDACTED]\n$SHELL (typically, interactive shell): /bin/bash\n"}]}