Opened 3 years ago

Last modified 3 years ago

#62231 assigned defect

git 2.30.0_0 [+credential_osxkeychain+diff_highlight+doc+pcre+perl5_28]: port test fails

Reported by: Aloisius (Jordan Mendelson) Owned by: ci42
Priority: Normal Milestone:
Component: ports Version: 2.6.4
Keywords: Cc:
Port: git

Description (last modified by mf2k (Frank Schima))

With a clean installation of MacPorts on an m1 macbook pro, port test git fails on macOS 11.2 20D64 with Xcode 12.4 12D4e.

  1. Installed brand new macports (nothing in /opt)
  2. sudo port selfupdate
  3. sudo port install git
  4. sudo port test git <- this fails

From the port log:

:info:test *** t3305-notes-fanout.sh ***
:info:test ok 1 - tweak test environment
:info:test ok 2 - creating many notes with git-notes
:info:test ok 3 - many notes created correctly with git-notes
:info:test not ok 4 - stable fanout 0 is followed by stable fanout 1
:info:test #    
:info:test #            i=$num_notes &&
:info:test #            fanout=0 &&
:info:test #            while test $i -gt 0
:info:test #            do
:info:test #                    i=$(($i - 1)) &&
:info:test #                    if touched_one_note_with_fanout refs/notes/commits~$i A $fanout
:info:test #                    then
:info:test #                            continue
:info:test #                    elif test $fanout -eq 0
:info:test #                    then
:info:test #                            fanout=1 &&
:info:test #                            if all_notes_have_fanout refs/notes/commits~$i $fanout
:info:test #                            then
:info:test #                                    echo "Fanout 0 -> 1 at refs/notes/commits~$i" &&
:info:test #                                    continue
:info:test #                            fi
:info:test #                    fi &&
:info:test #                    echo "Failed fanout=$fanout check at refs/notes/commits~$i" &&
:info:test #                    git ls-tree -r --name-only refs/notes/commits~$i &&
:info:test #                    return 1
:info:test #            done &&
:info:test #            all_notes_have_fanout refs/notes/commits 1
:info:test #    
:info:test ok 5 - deleting most notes with git-notes
:info:test ok 6 - most notes deleted correctly with git-notes
:info:test ok 7 - stable fanout 1 is followed by stable fanout 0
:info:test # failed 1 among 7 test(s)
:info:test 1..7
:info:test make[2]: *** [t3305-notes-fanout.sh] Error 1
:info:test make[1]: *** [test] Error 2
:info:test make: *** [test] Error 2
:info:test Command failed:  cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_git/git/work/git-2.30.0" && make test CFLAGS="-I. -Wall -O2 -I/opt/local/include -arch arm64" LDFLAGS="-L/opt/local/lib -arch arm64" CC=/usr/bin/clang prefix=/opt/local CURLDIR=/opt/local OPENSSLDIR=/opt/local ICONVDIR=/opt/local PERL_PATH="/opt/local/bin/perl5.28" PYTHON_PATH="/opt/local/bin/python3.8" NO_FINK=1 NO_DARWIN_PORTS=1 NO_R_TO_GCC_LINKER=1 NO_PERL_CPAN_FALLBACK=1 V=1 LIBPCREDIR=/opt/local USE_LIBPCRE2=1 
:info:test Exit code: 2
:error:test Failed to test git: command execution failed

Building directly from source using the system toolchain using this works fine:

$ make V=1 PYTHON_PATH=/usr/bin/python3 PERL_PATH=/usr/bin/perl NO_GETTEXT=1 NO_DARWIN_PORTS=1 NO_FINK=1 test

Attachments (2)

Portfile (2.7 KB) - added by Aloisius (Jordan Mendelson) 3 years ago.
Stripped down portfile for port test git, uses /usr/bin/git to test
main.log (3.8 MB) - added by Aloisius (Jordan Mendelson) 3 years ago.
Log file of port test git failing on a test

Change History (5)

comment:1 Changed 3 years ago by mf2k (Frank Schima)

Cc: ci42 removed
Owner: set to ci42
Status: newassigned

comment:2 Changed 3 years ago by mf2k (Frank Schima)

Description: modified (diff)

Changed 3 years ago by Aloisius (Jordan Mendelson)

Attachment: Portfile added

Stripped down portfile for port test git, uses /usr/bin/git to test

Changed 3 years ago by Aloisius (Jordan Mendelson)

Attachment: main.log added

Log file of port test git failing on a test

comment:3 Changed 3 years ago by Aloisius (Jordan Mendelson)

This appears to be some issue that only seems to only happen when running tests via port test. port test fails if I force it to use /usr/bin/git instead of the one being built to run the tests against. Running the tests manually from the build dir outside of port test works fine however.

Attached is a stripped down Portfile that is only useful for running port test git that uses the version in /usr/bin/git. It runs a single test: t/t7063-status-untracked-cache.sh. The main.log from the run is also attached.

:info:test not ok 6 - status second time (fully populated cache)
:info:test #    
:info:test #            avoid_racy &&
:info:test #            : >../trace &&
:info:test #            GIT_TRACE_UNTRACKED_STATS="$TRASH_DIRECTORY/trace" \
:info:test #            git status --porcelain >../actual &&
:info:test #            iuc status --porcelain >../status.iuc &&
:info:test #            test_cmp ../status.expect ../status.iuc &&
:info:test #            test_cmp ../status.expect ../actual &&
:info:test #            cat >../trace.expect <<EOF &&
:info:test #    node creation: 0
:info:test #    gitignore invalidation: 0
:info:test #    directory invalidation: 0
:info:test #    opendir: 0
:info:test #    EOF
:info:test #            test_cmp ../trace.expect ../trace
:info:test #    
:info:test make: *** [t7063-status-untracked-cache.sh] Error 1

The 6th test fails because the modification time of the test worktree directory is changed sometime during/after the 5th test runs which causes git to report that a directory had changed when it was not expected to. This only happens when running under port test.

$ cd git-2.30.0/t/trash\ directory.t7063-status-untracked-cache&& find worktree -exec ~/bin/mtime '{}' \; |sort -n |tail -15

1612669617.401108161: worktree/one
1612669617.401156160: worktree/two
1612669617.401196368: worktree/three
1612669617.401238368: worktree/done/one
1612669617.401241368: worktree/done
1612669617.401275117: worktree/dtwo/two
1612669617.401277951: worktree/dtwo
1612669617.401319617: worktree/dthree/three
1612669617.401322492: worktree/dthree
1612669617.409509364: worktree/.git/objects
1612669617.409997150: worktree/.git/objects/e6
1612669617.410382563: worktree/.git/info/exclude
1612669619.881632275: worktree/.git/index
1612669619.938537713: worktree/.git
1612669619.941513265: worktree

That last entry's mtime should be two seconds prior which is what happens if you run the test manually from the port's build dir:

$ sudo -u macports make t7063-status-untracked-cache.sh -C t GIT_TEST_OPTS="-v -d -x -i -r 1,2,3,4,5" GIT_TEST_INSTALLED="/usr/bin"
$ cd t/trash\ directory.t7063-status-untracked-cache&& find worktree -exec ~/bin/mtime '{}' \; |sort -n |tail -15
1612670454.530433683: worktree/one
1612670454.530481932: worktree/two
1612670454.530524431: worktree/three
1612670454.530528931: worktree
1612670454.530562764: worktree/done/one
1612670454.530565931: worktree/done
1612670454.530598305: worktree/dtwo/two
1612670454.530601472: worktree/dtwo
1612670454.530634680: worktree/dthree/three
1612670454.530637680: worktree/dthree
1612670454.538098303: worktree/.git/objects
1612670454.538595169: worktree/.git/objects/e6
1612670454.538964538: worktree/.git/info/exclude
1612670455.612867296: worktree/.git/index
1612670455.670378567: worktree/.git

Conceivably, this could cause corruption if git is called from port. Strangely, there is a function in git specifically to detect this kind of behavior, but it did not detect it (builtin/update-index.c:test_if_untracked_cache_is_supported()).

Last edited 3 years ago by Aloisius (Jordan Mendelson) (previous) (diff)
Note: See TracTickets for help on using tickets.