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

Re: Unfortunate interaction between git diff-index and fakeroot

From
Junio C Hamano <gitster@pobox.com>
Date
Dec 7, 2017, 15:31 UTC
Message-ID
<xmqqzi6ueern.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<0190ae30-b6c8-2a8b-b1fb-fd9d84e6dfdf@oracle.com>
Elazar Leibovich <elazar.leibovich@oracle.com> writes:
Show 5 quoted lines
> We noticed some unexpected behavior of git, when running git commands under
> fakeroot, and then running another command without fakeroot.
>
> When running, e.g., git status, or git describe --dirty, git can
> update the index file.

Correct. fakeroot would report that the files that are actually owned by the user who is running fakeroot are owned by root; the cached stat information in the index would be "corrected" to say that they are owned by root. So once the index is refreshed like so, things will become consistent.

> The unexpected result is:
>
> "fakeroot git status" updates the index, and the index now says all files
> are owned by uid:0.
You should learn to expect it; that is how fakeroot works.
> "git diff-index --name-only HEAD" is used to test if the git tree is dirty
> without fakeroot, concluding all files have changed, since their owner UID
> is changed.

The lower-level plumbing diff-* commands are meant to be used by scripts that refresh the index once upfront.

If you are using "diff-index" for the "is the tree dirty?" check without running "update-index --refresh", then you are not using the command correctly.

Previous: Elazar LeibovichNext: Elazar Leibovich
Message 2 of 4 in “Unfortunate interaction between git diff-index and fakeroot”
  1. Elazar LeibovichDec 7, 2017
  2. Junio C HamanoDec 7, 2017
  3. Elazar LeibovichDec 8, 2017
  4. Junio C HamanoDec 8, 2017

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.