Subject: Re: a problem with git describe

From: Junio C Hamano <[email-masked]>
Date: Tue, 26 Apr 2022 08:36:59 -0700

Johannes Schindelin <[email-masked]> writes:

> On Sat, 23 Apr 2022, Junio C Hamano wrote:
>
>> Philip Oakley <[email-masked]> writes:
>>
>> >> guy@renard ~/Software/uncrustify $ sudo git describe --always --dirty
>> > ...
>> > There has also been added an escape hatch of allowing "*" for the
>> > permitted safe directories. but do check the updated manuals, and the
>> > git mailing list archive (update the search in the above link).
>>
>> In this particular case, I do not think '*' is needed, but you need
>> to be careful here.  Whose configuration are you suggesting to add
>> such an entry?  Yourself?  ~root/.gitconfig?
>
> One relatively simple work-around might be to call `sudo chown root .`
> before running `sudo make install`, but of course this would require the
> `rm -rf` to be run via `sudo`, too.

chown root may make it owned by nobody4, though ;-)

> Do we want to make use of the environment variable `SUDO_UID` that is set
> by `sudo`?

"run this command under 'sudo'" would be a social engineering attack
we do not want to defend against, so I am OK with that, but then
allowing

    sudo "GIT_SAFE_DIRECTORIES=. make install"

does not look too bad, either.