From: rsbecker@nexbridge.com Date: Thu, 28 Apr 2022 20:43:47 GMT Subject: RE: [PATCH v2 3/3] t: add tests for safe.directory when running with sudo Message-ID: <000801d85b40$ac11ec80$0435c580$@nexbridge.com> In-Reply-To: On April 28, 2022 4:23 PM, Carlo Arenas wrote: >On Thu, Apr 28, 2022 at 12:53 PM wrote: >> /etc/sudoers is not standard although usual. This path should come from a knob >somewhere. We can't run this test on our x86 system anyway - no access to root >or sudo even though it is installed. > >correct and note that the test would succeed if the file doesn't exist because what >we are really interested on, is to make sure that sudo won't mess with our path >when invoking git, and if there is a chance it would (because that setting is enabled >in a different file for >example) then we will just skip these tests. > >Obviously the target I had in mind when I built this test was my own workstation >and our public CI, but feel free to provide a fixup that would also make it work for >your private runs if you are interested in also running this test. > >> Also, /etc/sudoers is typically secured 0600 so the grep will fail >> even if is_root passes > >It won't, because it is running with sudo ;). note that as stated in the commit >message, this requires a fairly open sudo setup (like the one github provides with >their actions). > >> - and I'm worried about the portability of is_root, which is mostly Linux. > >I actually made sure that is_root was posix shell compatible, but got a little carried >away when refactoring it to accomodate for reuse; eitherway it is gone in v3. I tried to find is_root in POSIX but could not. Do you have a reference? It is not in bash 4.3.48, which is on our older system.