Re: a problem with git describe

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

 



Hi Junio,

On Sat, 23 Apr 2022, Junio C Hamano wrote:

> Junio C Hamano <gitster@xxxxxxxxx> writes:
>
> > Philip Oakley <philipoakley@iee.email> 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?
> >
> > I wonder if we should loosen "the same owner" check somewhat to
> > cover this situation better.  I expect people also run the
> > installation in repositories they own with "sudo make install",
> > and complaining "euid does not own that repository" when it is
> > merely because they are running as root (and their real identity
> > is still in ruid) feels a bit too strict to be useful.
>
> Actually, not quite.  when "git" runs in "sudo git", the real
> identity has long lost, so the below would not help.  Sigh.

Could you help me understand what is going on exactly? How/when is `git`
running `sudo git`? I thought the problem was that `sudo make install`
transitively runs `git describe` with euid 0, but `getuid()` should still
return the non-admin user's ID, no?

Thanks,
Dscho

>
>  git-compat-util.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git i/git-compat-util.h w/git-compat-util.h
> index 63ba89dd31..90dc1b17cd 100644
> --- i/git-compat-util.h
> +++ w/git-compat-util.h
> @@ -398,7 +398,7 @@ static inline int is_path_owned_by_current_uid(const char *path)
>  	struct stat st;
>  	if (lstat(path, &st))
>  		return 0;
> -	return st.st_uid == geteuid();
> +	return st.st_uid == geteuid() || st.st_uid == getuid();
>  }
>
>  #define is_path_owned_by_current_user is_path_owned_by_current_uid
>




[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