git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: a problem with git describe

From
Taylor Blau <me@ttaylorr.com>
Date
Apr 26, 2022, 01:52 UTC
Message-ID
<YmdQcrl/uu7HFBlc@nand.local>
In-Reply-To
<xmqqczh73hns.fsf@gitster.g>
On Sat, Apr 23, 2022 at 09:09:59AM -0700, Junio C Hamano wrote:
Show 18 quoted lines
> 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.

I was thinking about this today and realized that my original train of thought along the lines of "ignore the new safety check when the current user has higher permissions than the user who owns the repository we're working in" was misguided.

What about loosening the check in a different way? Instead of causing Git to abort early, what if we:

  - skipped reading the repository's configuration and hooks (unless
    safe.directory includes $CWD)
  - emit a warning (which goes away when safe.directory contains $CWD)
  - otherwise continue executing as normal

That would unbreak the case of $(git describe ...) in our Makefile in this instance, without opening ourselves up to execution-via-config.

Though I think we'd have to be slightly more careful than that, since we definitely _do_ want to read repository format extensions.

I'm hesitant to recommend reading some parts of the configuration without others, though this is slightly different than that. Instead of saying "read every entry of config except core.editor, core.pager, core.alternateRefsCommand, core.fsmonitor" and so on, this says "when operating in a repository not owned by the current user (or the repository is in our global safe.directory list) only read repository format extensions, but ignore everything else in config and hooks".

> Dscho, what do you think?

I'd be curious to hear what Johannes thinks of your original mail as well as my own.

Thanks, Taylor

Previous: Junio C HamanoNext: Johannes Schindelin
Message 19 of 23 in “a problem with git describe”
  1. Guy MaurelApr 23, 2022
  2. Philip OakleyApr 23, 2022
  3. Junio C HamanoApr 23, 2022
  4. Junio C HamanoApr 23, 2022
  5. Carlo Marcelo Arenas BelónApr 25, 2022
  6. SZEDER GáborApr 25, 2022
  7. Carlo Marcelo Arenas BelónApr 25, 2022
  8. Junio C HamanoApr 25, 2022
  9. Carlo Marcelo Arenas BelónApr 25, 2022
  10. Carlo Marcelo Arenas BelónApr 25, 2022
  11. Guy MaurelApr 25, 2022
  12. Johannes SchindelinApr 26, 2022
  13. rsbecker@nexbridge.comApr 26, 2022
  14. Carlo ArenasApr 26, 2022
  15. Junio C HamanoApr 26, 2022
  16. Carlo ArenasApr 26, 2022
  17. Johannes SchindelinApr 26, 2022
  18. Junio C HamanoApr 26, 2022
  19. Taylor BlauApr 26, 2022
  20. Johannes SchindelinApr 26, 2022
  21. Taylor BlauApr 26, 2022
  22. Johannes SchindelinApr 26, 2022
  23. Junio C HamanoApr 26, 2022

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.