git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Philip Oakley <philipoakley@iee.email>
Cc: Johannes Schindelin <johannes.schindelin@gmx.de>,
	Guy Maurel <guy.j@maurel.de>,
	git@vger.kernel.org
Subject: Re: a problem with git describe
Date: Sat, 23 Apr 2022 16:44:57 -0700	[thread overview]
Message-ID: <xmqqk0bf1i12.fsf@gitster.g> (raw)
In-Reply-To: <xmqqczh73hns.fsf@gitster.g> (Junio C. Hamano's message of "Sat, 23 Apr 2022 09:09:59 -0700")

Junio C Hamano <gitster@pobox.com> 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.

 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

  reply	other threads:[~2022-04-23 23:45 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-23  9:12 a problem with git describe Guy Maurel
2022-04-23 11:27 ` Philip Oakley
2022-04-23 16:09   ` Junio C Hamano
2022-04-23 23:44     ` Junio C Hamano [this message]
2022-04-25  2:01       ` Carlo Marcelo Arenas Belón
2022-04-25  5:05         ` SZEDER Gábor
2022-04-25  6:03           ` Carlo Marcelo Arenas Belón
2022-04-25  6:39         ` Junio C Hamano
2022-04-25  7:02           ` Carlo Marcelo Arenas Belón
2022-04-25  8:40             ` Carlo Marcelo Arenas Belón
2022-04-25 15:11               ` Guy Maurel
2022-04-26 15:43               ` Johannes Schindelin
2022-04-26 15:56                 ` rsbecker
2022-04-26 16:35                 ` Carlo Arenas
2022-04-26 16:46                   ` Junio C Hamano
2022-04-26 17:15                     ` Carlo Arenas
2022-04-26 15:45       ` Johannes Schindelin
2022-04-26 16:25         ` Junio C Hamano
2022-04-26  1:52     ` Taylor Blau
2022-04-26 15:41       ` Johannes Schindelin
2022-04-26 15:50         ` Taylor Blau
2022-04-26 15:30     ` Johannes Schindelin
2022-04-26 15:36       ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqqk0bf1i12.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=guy.j@maurel.de \
    --cc=johannes.schindelin@gmx.de \
    --cc=philipoakley@iee.email \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).