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

Re: `make profile-install` fails in 2.9.3

From
Thomas Gummerer <t.gummerer@gmail.com>
Date
Sep 1, 2016, 20:07 UTC
Message-ID
<20160901200700.GA8254@hank>
In-Reply-To
<CAA6PgK7C18F1WGyZMTEUAWEVsUWqiZND5Ne_0SH-rUEm8u5dNg@mail.gmail.com>
[+cc Edward Thomson, Ingo Brückl]
Hi,
On 09/01, Jan Keromnes wrote:
[.. snip the parts others are more qualified to answer ..]
> 
> Related problem: `t3700-add.sh` currently fails in 2.9.3. I can
> provide more debug information if you don't already know this problem.

I noticed this problem as well, when I'm compiling with USE_NSEC = 1 in my config.mak.

Tracking this problem down a bit, it happens because the --chmod=[+-]x option introduced in 4e55ed32 ("add: add --chmod=+x / --chmod=-x options") only works if the file on disk is modified. When the test was changed to work on one single file, instead of doing chmod=+x on one file and chmod=-x on another file in b38ab197c ("t3700: merge two tests into one"), this test started breaking when the mtime of the file and the index file weren't the same (in other words, if the file was not racily clean and thus was not smudged).

When the file is racily clean, git detects that the contents changed, and everything is happy, but if it isn't, git incorectly thinks the file wasn't modified (which it wasn't, but from gits view it should be viewed as modified because the mode does not match up anymore).

One possible fix for the test is to smudge the entry as showed below, though I'm not sure it's the right fix. The other way I can think of is to change the file in the index regardless of whether the file was changed in some other way before issuing the git add command, as that might fit the user expectation better. Thoughts?

diff --git a/read-cache.c b/read-cache.c
index 491e52d..f2e7986 100644
--- a/read-cache.c
+++ b/read-cache.c
@@ -656,11 +656,13 @@ int add_to_index(struct index_state *istate, const char *path, struct stat *st,
 	else
 		ce->ce_flags |= CE_INTENT_TO_ADD;
 
-	if (S_ISREG(st_mode) && force_mode)
+	if (S_ISREG(st_mode) && force_mode) {
 		ce->ce_mode = create_ce_mode(force_mode);
-	else if (trust_executable_bit && has_symlinks)
+		ce->ce_stat_data.sd_size = 0;
+	} else if (trust_executable_bit && has_symlinks) {
 		ce->ce_mode = create_ce_mode(st_mode);
-	else {
+	} else {
 		/* If there is an existing entry, pick the mode bits and type
 		 * from it, otherwise assume unexecutable regular file.
 		 */

								           



> Thanks,
> Jan Keromnes
> 
> ---
> 
> Steps to reproduce:
> 
>     curl https://www.kernel.org/pub/software/scm/git/git-2.9.3.tar.xz | tar xJ \
>      && cd git-2.9.3 \
>      && make prefix=/usr profile-install install-man -j18
> 
> Expected result:
> 
>     - runs all tests to get a profile (ignoring occasional failures)
>     - rebuilds Git with the profile
>     - installs Git
> 
> Actual result:
> 
>     - runs all tests to get a profile
>     - at least one test fails, interrupting the whole process
>     - Git is not installed
> 
> Failure log:
> 
>     # failed 1 among 40 test(s)
>     1..40
>     Makefile:43: recipe for target 't3700-add.sh' failed
>     make[3]: *** [t3700-add.sh] Error 1
>     make[3]: Leaving directory '/tmp/git/git-2.9.3/t'
>     Makefile:36: recipe for target 'test' failed
>     make[2]: Leaving directory '/tmp/git/git-2.9.3/t'
>     make[2]: *** [test] Error 2
>     Makefile:2221: recipe for target 'test' failed
>     make[1]: *** [test] Error 2
>     make[1]: Leaving directory '/tmp/git/git-2.9.3'
>     Makefile:1633: recipe for target 'profile' failed
>     make: *** [profile] Error 2
>     The command '/bin/sh -c mkdir /tmp/git  && cd /tmp/git  && curl
> https://www.kernel.org/pub/software/scm/git/git-2.9.3.tar.xz | tar xJ
> && cd git-2.9.3  && make prefix=/usr profile-install install-man -j18
> && rm -rf /tmp/git' returned a non-zero code: 2
-- 
Thomas
Previous: Dennis KaarsemakerNext: Jeff King
Message 3 of 40 in “`make profile-install` fails in 2.9.3”
  1. Jan KeromnesSep 1, 2016
  2. Dennis KaarsemakerSep 1, 2016
  3. Thomas GummererSep 1, 2016
  4. Jeff KingSep 1, 2016
  5. Junio C HamanoSep 1, 2016
  6. Jeff KingSep 1, 2016
  7. Junio C HamanoSep 1, 2016
  8. 0/4 git add --chmod: always change the fileThomas Gummerer, Sep 4, 2016
  9. 1/4 add: document the chmod optionThomas Gummerer, Sep 4, 2016
  10. Johannes SchindelinSep 5, 2016
  11. Thomas GummererSep 5, 2016
  12. Junio C HamanoSep 7, 2016
  13. 3/4 read-cache: introduce chmod_index_entryThomas Gummerer, Sep 4, 2016
  14. 2/4 update-index: use the same structure for chmod as addThomas Gummerer, Sep 4, 2016
  15. 4/4 add: modify already added files when --chmod is givenThomas Gummerer, Sep 4, 2016
  16. 0/4 git add --chmod: always change the fileThomas Gummerer, Sep 11, 2016
  17. 1/4 add: document the chmod optionThomas Gummerer, Sep 11, 2016
  18. 2/4 update-index: use the same structure for chmod as addThomas Gummerer, Sep 11, 2016
  19. Junio C HamanoSep 11, 2016
  20. Thomas GummererSep 12, 2016
  21. 3/4 read-cache: introduce chmod_index_entryThomas Gummerer, Sep 11, 2016
  22. 4/4 add: modify already added files when --chmod is givenThomas Gummerer, Sep 11, 2016
  23. 0/4 git add --chmod: always change the fileThomas Gummerer, Sep 12, 2016
  24. 1/4 add: document the chmod optionThomas Gummerer, Sep 12, 2016
  25. 2/4 update-index: use the same structure for chmod as addThomas Gummerer, Sep 12, 2016
  26. Junio C HamanoSep 12, 2016
  27. 3/4 read-cache: introduce chmod_index_entryThomas Gummerer, Sep 12, 2016
  28. 4/4 add: modify already added files when --chmod is givenThomas Gummerer, Sep 12, 2016
  29. Junio C HamanoSep 12, 2016
  30. 0/4 git add --chmod: always change the fileThomas Gummerer, Sep 14, 2016
  31. 1/4 add: document the chmod optionThomas Gummerer, Sep 14, 2016
  32. 2/4 update-index: add test for chmod flagsThomas Gummerer, Sep 14, 2016
  33. 3/4 read-cache: introduce chmod_index_entryThomas Gummerer, Sep 14, 2016
  34. Junio C HamanoSep 14, 2016
  35. Junio C HamanoSep 14, 2016
  36. Thomas GummererSep 15, 2016
  37. 4/4 add: modify already added files when --chmod is givenThomas Gummerer, Sep 14, 2016
  38. Junio C HamanoSep 14, 2016
  39. René ScharfeAug 7, 2017
  40. Thomas GummererAug 12, 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.