Re: [RFC PATCH v3 1/3] t: document regression git safe.directory when using sudo

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, May 2, 2022 at 2:35 PM Junio C Hamano <gitster@xxxxxxxxx> wrote:
>
> Carlo Marcelo Arenas Belón  <carenas@xxxxxxxxx> writes:
>
> > +     command -v git >u &&
> > +     sudo command -v git >r &&
> > +     test_cmp u r
>
> While this is not as thorough as the "make sure we see the
> environment intact" that I alluded to during the previous review, it
> at least makes sure PATH (which our test framework tweaks) is
> propagated down to "sudo" environment intact, which should be good
> enough to run just "init" and "status".  Keeping things simple is
> good.

Sorry, I should have mentioned that explicitly in my response.

That is not possible.  sudo by design will try to minimize the
environment that root is running on, so the only way to make sure git
still works as expected there, is to add to that environment
everything else we might need.

That is why I have to invent that ugly looking "env" file and the
function to import variables with it, and I was assuming that for it
to be useful in the end we might need to maybe import everything
"GIT*" too, but obviously I didn't want to do that now, and that is
why I only did the branch name (more as an example, than as something
that was strictly needed) since you mentioned that in your review and
I could see how it was related to `git init` being added to the tests
in the next commit.

Guess I botched it in my refactoring anyway, since it also makes sense
for it to be added in the next commit together with `git init`instead
of here.

> may have to exclude this from tests that require specialized
> environment like valgrind tests, but that is not of immediate
> concern.

I didn't test valgrind, but I would assume it is probably broken now,
as well as anything else that relies on extra environmental things.

Carlo




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux