1.7.1: self test failures on Cygwin
Reproduction steps
$ wget https://github.com/libgit2/libgit2/archive/refs/tags/v1.7.1.tar.gz
$ tar xf v1.7.1.tar.gz
$ cd libgit2-1.7.1
$ cmake -G Ninja -DBUILD_CLI:BOOL=OFF -DBUILD_EXAMPLES:BOOL=ON -DREGEX_BACKEND:STRING=pcre2 -DUSE_SSH:BOOL=ON .
$ ninja
$ ninja test
https://github.com/cygwin/scallywag/actions/runs/6831370933/job/18580898875
Expected behavior
All test pass
Actual behavior
Test project /cygdrive/d/a/scallywag/playground/libgit2-1.7.1-1.x86_64/build
Start 1: offline
1/12 Test #1: offline ..........................***Failed 453.91 sec
Start 2: invasive
2/12 Test #2: invasive .........................***Failed 1.52 sec
Start 3: online
3/12 Test #3: online ........................... Passed 39.53 sec
Start 4: online_customcert
4/12 Test #4: online_customcert ................ Passed 2.41 sec
Start 5: gitdaemon
5/12 Test #5: gitdaemon ........................ Passed 6.19 sec
Start 6: gitdaemon_namespace
6/12 Test #6: gitdaemon_namespace .............. Passed 0.11 sec
Start 7: gitdaemon_sha256
7/12 Test #7: gitdaemon_sha256 ................. Passed 0.11 sec
Start 8: ssh
8/12 Test #8: ssh .............................. Passed 7.01 sec
Start 9: proxy
9/12 Test #9: proxy ............................ Passed 5.20 sec
Start 10: auth_clone
10/12 Test #10: auth_clone ....................... Passed 1.76 sec
Start 11: auth_clone_and_push
11/12 Test #11: auth_clone_and_push .............. Passed 6.11 sec
Start 12: util
12/12 Test #12: util .............................***Failed 1.05 sec
75% tests passed, 3 tests failed out of 12
Total Test time (real) = 524.93 sec
The following tests FAILED:
1 - offline (Failed)
2 - invasive (Failed)
12 - util (Failed)
Errors while running CTest
Output from these tests are in: /cygdrive/d/a/scallywag/playground/libgit2-1.7.1-1.x86_64/build/Testing/Temporary/LastTest.log
1/12 Test: offline
1) Failure:
checkout::conflict::name_mangled_file_exists_in_workdir [/cygdrive/d/a/scallywag/playground/libgit2-1.7.1-1.x86_64/src/libgit2-1.7.1/tests/libgit2/checkout/conflict.c:160]
OID mismatch: &expected != &actual
"b42712cfe99a1a500b2a51fe984e0b8a7702ba11" != "a3102456e459e506a2e51646d2ffdbe5785fb5ca"
2) Failure:
iterator::index::case_folding [/cygdrive/d/a/scallywag/playground/libgit2-1.7.1-1.x86_64/src/libgit2-1.7.1/tests/libgit2/iterator/index.c:51]
String mismatch: expected_names[count] != entry->path
'B' != 'a' (at byte 0)
3) Failure:
iterator::workdir::skips_unreadable_dirs [/cygdrive/d/a/scallywag/playground/libgit2-1.7.1-1.x86_64/src/libgit2-1.7.1/tests/libgit2/iterator/workdir.c:704]
String mismatch: "c/foo" != e->path
'c/foo' != 'b/problem' (at byte 0)
4) Failure:
repo::init::unwriteable_directory [/cygdrive/d/a/scallywag/playground/libgit2-1.7.1-1.x86_64/src/libgit2-1.7.1/tests/libgit2/repo/init.c:688]
Function call succeeded: git_repository_init(&repo, "unwriteable/repo", 0)
no error, expected non-zero return
5) Failure:
status::worktree::whole_repository [/cygdrive/d/a/scallywag/playground/libgit2-1.7.1-1.x86_64/src/libgit2-1.7.1/tests/libgit2/status/worktree.c:41]
counts.expected_entry_count != counts.entry_count
16 != 21
6) Failure:
status::worktree::show_index_and_workdir [/cygdrive/d/a/scallywag/playground/libgit2-1.7.1-1.x86_64/src/libgit2-1.7.1/tests/libgit2/status/worktree.c:69]
counts.expected_entry_count != counts.entry_count
16 != 21
7) Failure:
status::worktree::show_workdir_only [/cygdrive/d/a/scallywag/playground/libgit2-1.7.1-1.x86_64/src/libgit2-1.7.1/tests/libgit2/status/worktree.c:71]
0 != counts.wrong_sorted_path
0 != 13
8) Failure:
status::worktree::swap_subdir_and_file [/cygdrive/d/a/scallywag/playground/libgit2-1.7.1-1.x86_64/src/libgit2-1.7.1/tests/libgit2/status/worktree.c:182]
counts.expected_entry_count != counts.entry_count
22 != 27
9) Failure:
status::worktree::swap_subdir_with_recurse_and_pathspec [/cygdrive/d/a/scallywag/playground/libgit2-1.7.1-1.x86_64/src/libgit2-1.7.1/tests/libgit2/status/worktree.c:216]
counts.expected_entry_count != counts.entry_count
23 != 28
10) Failure:
status::worktree::conflict_has_no_oid [/cygdrive/d/a/scallywag/playground/libgit2-1.7.1-1.x86_64/src/libgit2-1.7.1/tests/libgit2/status/worktree.c:764]
16 != git_status_list_entrycount(statuslist)
16 != 22
11) Failure:
status::worktree::update_stat_cache_0 [/cygdrive/d/a/scallywag/playground/libgit2-1.7.1-1.x86_64/src/libgit2-1.7.1/tests/libgit2/status/worktree.c:1034]
entry_count0 != max_i
16 != 21
12) Failure:
status::worktree::unreadable [/cygdrive/d/a/scallywag/playground/libgit2-1.7.1-1.x86_64/src/libgit2-1.7.1/tests/libgit2/status/worktree.c:1118]
0 != counts.wrong_status_flags_count
0 != 1
2/12 Test: invasive
1) Failure:
repo::init::unwriteable_directory [/cygdrive/d/a/scallywag/playground/libgit2-1.7.1-1.x86_64/src/libgit2-1.7.1/tests/libgit2/repo/init.c:688]
Function call succeeded: git_repository_init(&repo, "unwriteable/repo", 0)
no error, expected non-zero return
12/12 Test: util
1) Failure:
path::validate_current_user_ownership [/cygdrive/d/a/scallywag/playground/libgit2-1.7.1-1.x86_64/src/libgit2-1.7.1/tests/util/path.c:764]
is_cur != (geteuid() == 0)
1 != 0
2) Failure:
string::strcasecmp [/cygdrive/d/a/scallywag/playground/libgit2-1.7.1-1.x86_64/src/libgit2-1.7.1/tests/util/string.c:114]
Expression is not true: strcasecmp("rt\303\202of", "rt dev\302\266h") > 0
Version of libgit2 (release number or SHA1)
1.7.1
Operating system(s) tested
Cygwin (x86-64)
Interesting. Did prior versions work? Can you give some more details about your environment? I'm not very familiar with the state of the art with Cygwin.
There is a bunch of warning: array subscript has type ‘char’ from the character classification calls.
That may cause any character with a value over 127 to be misclassified.
We should probably cast them explicitly to unsigned char before passing them on to isspace/isalnum/isdigit to make sure that they don't get sign-extended.
It could explain the last failure in strcasecmp.
Did prior versions work?
Sorry, I have not checked with other versions.
Can you give some more details about your environment?
The test is done with job.build.runs-on: windows-latest in GitHub Actions.
gcc version
$ gcc -v --version
Using built-in specs.
COLLECT_AS_OPTIONS='--version'
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-pc-cygwin/11/lto-wrapper.exe
gcc (GCC) 11.4.0
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Target: x86_64-pc-cygwin
Configured with: /mnt/share/cygpkgs/gcc/gcc.x86_64/src/gcc-11.4.0/configure --srcdir=/mnt/share/cygpkgs/gcc/gcc.x86_64/src/gcc-11.4.0 --prefix=/usr --exec-prefix=/usr --localstatedir=/var --sysconfdir=/etc --docdir=/usr/share/doc/gcc --htmldir=/usr/share/doc/gcc/html -C --build=x86_64-pc-cygwin --host=x86_64-pc-cygwin --target=x86_64-pc-cygwin --without-libiconv-prefix --without-libintl-prefix --libexecdir=/usr/lib --with-gcc-major-version-only --enable-shared --enable-shared-libgcc --enable-static --enable-version-specific-runtime-libs --enable-bootstrap --enable-__cxa_atexit --with-dwarf2 --with-tune=generic --enable-languages=ada,c,c++,d,fortran,lto,objc,obj-c++,jit --enable-graphite --enable-threads=posix --enable-libatomic --enable-libgomp --enable-libquadmath --enable-libquadmath-support --disable-libssp --enable-libada --disable-symvers --disable-multilib --with-gnu-ld --with-gnu-as --with-cloog-include=/usr/include/cloog-isl --without-libiconv-prefix --without-libintl-prefix --with-system-zlib --enable-linker-build-id --with-default-libstdcxx-abi=gcc4-compatible --enable-libstdcxx-filesystem-ts
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 11.4.0 (GCC)
COLLECT_GCC_OPTIONS='-v' '--version' '-mtune=generic' '-march=x86-64' '-dumpdir' 'a-'
/usr/lib/gcc/x86_64-pc-cygwin/11/cc1.exe -quiet -v -idirafter /usr/lib/gcc/x86_64-pc-cygwin/11/../../../../lib/../include/w32api -idirafter /usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/lib/../lib/../../include/w32api help-dummy -quiet -dumpdir a- -dumpbase help-dummy -mtune=generic -march=x86-64 -version --version -o /tmp/ccvC1eR6.s
GNU C17 (GCC) version 11.4.0 (x86_64-pc-cygwin)
compiled by GNU C version 11.4.0, GMP version 6.2.1, MPFR version 4.2.0-p9, MPC version 1.3.1, isl version isl-0.26-GMP
warning: GMP header version 6.2.1 differs from library version 6.3.0.
warning: MPFR header version 4.2.0-p9 differs from library version 4.2.1.
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
COLLECT_GCC_OPTIONS='-v' '--version' '-mtune=generic' '-march=x86-64' '-dumpdir' 'a-'
/usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/as.exe -v --version -o /tmp/ccFWirEy.o /tmp/ccvC1eR6.s
GNU assembler version 2.41 (x86_64-pc-cygwin) using BFD version (GNU Binutils) 2.41
GNU assembler (GNU Binutils) 2.41
Copyright (C) 2023 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License version 3 or later.
This program has absolutely no warranty.
This assembler was configured for a target of `x86_64-pc-cygwin'.
COMPILER_PATH=/usr/lib/gcc/x86_64-pc-cygwin/11/:/usr/lib/gcc/x86_64-pc-cygwin/11/:/usr/lib/gcc/x86_64-pc-cygwin/:/usr/lib/gcc/x86_64-pc-cygwin/11/:/usr/lib/gcc/x86_64-pc-cygwin/:/usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/
LIBRARY_PATH=/usr/lib/gcc/x86_64-pc-cygwin/11/:/usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/lib/../lib/:/usr/lib/gcc/x86_64-pc-cygwin/11/../../../../lib/:/lib/../lib/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/lib/:/usr/lib/gcc/x86_64-pc-cygwin/11/../../../:/lib/:/usr/lib/
COLLECT_GCC_OPTIONS='-v' '--version' '-mtune=generic' '-march=x86-64' '-dumpdir' 'a.'
/usr/lib/gcc/x86_64-pc-cygwin/11/collect2.exe -plugin /usr/lib/gcc/x86_64-pc-cygwin/11/cyglto_plugin.dll -plugin-opt=/usr/lib/gcc/x86_64-pc-cygwin/11/lto-wrapper.exe -plugin-opt=-fresolution=/tmp/ccdEMf4m.res -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lcygwin -plugin-opt=-pass-through=-ladvapi32 -plugin-opt=-pass-through=-lshell32 -plugin-opt=-pass-through=-luser32 -plugin-opt=-pass-through=-lkernel32 -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc --build-id -m i386pep --wrap _Znwm --wrap _Znam --wrap _ZdlPv --wrap _ZdaPv --wrap _ZnwmRKSt9nothrow_t --wrap _ZnamRKSt9nothrow_t --wrap _ZdlPvRKSt9nothrow_t --wrap _ZdaPvRKSt9nothrow_t -Bdynamic --dll-search-prefix=cyg --tsaware --version /usr/lib/gcc/x86_64-pc-cygwin/11/../../../../lib/crt0.o /usr/lib/gcc/x86_64-pc-cygwin/11/crtbegin.o -L/usr/lib/gcc/x86_64-pc-cygwin/11 -L/usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/lib/../lib -L/usr/lib/gcc/x86_64-pc-cygwin/11/../../../../lib -L/lib/../lib -L/usr/lib/../lib -L/usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/lib -L/usr/lib/gcc/x86_64-pc-cygwin/11/../../.. /tmp/ccFWirEy.o -lgcc_s -lgcc -lcygwin -ladvapi32 -lshell32 -luser32 -lkernel32 -lgcc_s -lgcc /usr/lib/gcc/x86_64-pc-cygwin/11/../../../../lib/default-manifest.o /usr/lib/gcc/x86_64-pc-cygwin/11/crtend.o
collect2 version 11.4.0
/usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld -plugin /usr/lib/gcc/x86_64-pc-cygwin/11/cyglto_plugin.dll -plugin-opt=/usr/lib/gcc/x86_64-pc-cygwin/11/lto-wrapper.exe -plugin-opt=-fresolution=/tmp/ccdEMf4m.res -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lcygwin -plugin-opt=-pass-through=-ladvapi32 -plugin-opt=-pass-through=-lshell32 -plugin-opt=-pass-through=-luser32 -plugin-opt=-pass-through=-lkernel32 -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc --build-id -m i386pep --wrap _Znwm --wrap _Znam --wrap _ZdlPv --wrap _ZdaPv --wrap _ZnwmRKSt9nothrow_t --wrap _ZnamRKSt9nothrow_t --wrap _ZdlPvRKSt9nothrow_t --wrap _ZdaPvRKSt9nothrow_t -Bdynamic --dll-search-prefix=cyg --tsaware --version /usr/lib/gcc/x86_64-pc-cygwin/11/../../../../lib/crt0.o /usr/lib/gcc/x86_64-pc-cygwin/11/crtbegin.o -L/usr/lib/gcc/x86_64-pc-cygwin/11 -L/usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/lib/../lib -L/usr/lib/gcc/x86_64-pc-cygwin/11/../../../../lib -L/lib/../lib -L/usr/lib/../lib -L/usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/lib -L/usr/lib/gcc/x86_64-pc-cygwin/11/../../.. /tmp/ccFWirEy.o -lgcc_s -lgcc -lcygwin -ladvapi32 -lshell32 -luser32 -lkernel32 -lgcc_s -lgcc /usr/lib/gcc/x86_64-pc-cygwin/11/../../../../lib/default-manifest.o /usr/lib/gcc/x86_64-pc-cygwin/11/crtend.o
GNU ld (GNU Binutils) 2.41
Copyright (C) 2023 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License version 3 or (at your option) a later version.
This program has absolutely no warranty.
COLLECT_GCC_OPTIONS='-v' '--version' '-mtune=generic' '-march=x86-64' '-dumpdir' 'a.'
Could you compile with #6679 and see if any of the tests passes?
Version of libgit2 (release number or SHA1)
- https://github.com/boretrk/libgit2/tree/ctype
- https://github.com/boretrk/libgit2/commit/dd5e276379952a91660c4fb060622b2bc5977dc5
CI result
- https://github.com/cygwin/scallywag/actions/runs/7227721959/job/19696000973
Actual Behavior
1/12 Test: offline
1) Failure:
filter::systemattrs::reads_system_attributes [/cygdrive/d/a/scallywag/playground/libgit2-1.8.0-1.x86_64/src/libgit2/tests/libgit2/filter/systemattrs.c:13]
Function call failed: unlink("crlf/.gitattributes")
2) Failure:
filter::systemattrs::reads_system_attributes [/cygdrive/d/a/scallywag/playground/libgit2-1.8.0-1.x86_64/src/libgit2/tests/libgit2/filter/systemattrs.c:31]
Function call failed: unlink(system_attr_path.ptr)
2/12 Test: invasive
1) Failure:
repo::init::unwriteable_directory [/cygdrive/d/a/scallywag/playground/libgit2-1.8.0-1.x86_64/src/libgit2/tests/libgit2/repo/init.c:688]
Function call succeeded: git_repository_init(&repo, "unwriteable/repo", 0)
error 0 - no error
12/12 Test: util
1) Failure:
path::validate_current_user_ownership [/cygdrive/d/a/scallywag/playground/libgit2-1.8.0-1.x86_64/src/libgit2/tests/util/path.c:764]
is_cur != (geteuid() == 0)
1 != 0
2) Failure:
string::strcasecmp [/cygdrive/d/a/scallywag/playground/libgit2-1.8.0-1.x86_64/src/libgit2/tests/util/string.c:114]
Expression is not true: strcasecmp("rt\303\202of", "rt dev\302\266h") > 0
OK, I missed one isprint() in the pr, but I don't see that it would be cause any of the remaining failures.
I don't really know why we are testing for sign in strcasecmp since its a posix-function that we don't overload. (There is a p_strcasecmp define that we don't use.) From https://pubs.opengroup.org/onlinepubs/9699919799/
When the LC_CTYPE category of the locale being used is from the POSIX locale, these functions shall behave as if the strings had been converted to lowercase and then a byte comparison performed. Otherwise, the results are unspecified.
But I don't see anything that requires the byte to be signed/unsigned. IMO that test is wrong here.
Functions that cares about signedness of strcasecmp with non-ascii characters will behave differently on systems where char is signed I suppose, but for that we have git__strcasecmp() that does unsigned compare.
The rest of the fails feels a lot like Windows filesystem not behaving as one one expect from a POSIX system. We have p_unlink() in src/util/win_32/posix_w32.c that makes repeated attempts for some reason. But since you are using cygwin I assume that the posix functions are being used and the cygwin implementation of unlink might not do that.
I noticed that one of the cmakelists have a if(WIN32 AND NOT CYGWIN)
I didn't see if those were set for you but they probably should be.
So maybe try with cmake -DWIN32 -DCYGWIN just in case those aren't automatically detected?
cmake built for cygwin has the following settings
$ cat CMakeLists.txt
project(EXAMPLE)
get_cmake_property(_variableNames VARIABLES)
list (SORT _variableNames)
foreach (_variableName CYGWIN WIN32)
message(STATUS "${_variableName}=${${_variableName}}")
endforeach()
$ cmake -Wno-dev .
CMake Warning at /usr/share/cmake-3.25.3/Modules/Platform/CYGWIN.cmake:15 (message):
CMake no longer defines WIN32 on Cygwin!
(1) If you are just trying to build this project, ignore this warning or
quiet it by setting CMAKE_LEGACY_CYGWIN_WIN32=0 in your environment or in
the CMake cache. If later configuration or build errors occur then this
project may have been written under the assumption that Cygwin is WIN32.
In that case, set CMAKE_LEGACY_CYGWIN_WIN32=1 instead.
(2) If you are developing this project, add the line
set(CMAKE_LEGACY_CYGWIN_WIN32 0) # Remove when CMake >= 2.8.4 is required
at the top of your top-level CMakeLists.txt file or set the minimum
required version of CMake to 2.8.4 or higher. Then teach your project to
build on Cygwin without WIN32.
Call Stack (most recent call first):
/usr/share/cmake-3.25.3/Modules/CMakeSystemSpecificInformation.cmake:45 (include)
CMakeLists.txt:1 (project)
-- CYGWIN=1
-- WIN32=0
-- Configuring done
-- Generating done
-- Build files have been written to: /tmp/cmake
$
-DWIN32, which causes a conflict with w32api and makes it difficult to compile.
/usr/include/w32api/winsock2.h:1035:34: error: conflicting types for ‘setsockopt’; have ‘int(SOCKET, int, int, const char *, int)’ {aka ‘int(long long unsigned int, int, int, const char *, int)’}
1035 | WINSOCK_API_LINKAGE int WSAAPI setsockopt(SOCKET s,int level,int optname,const char *optval,int optlen);
| ^~~~~~~~~~
As some time has passed since the last report, HEAD was tested again.
Version of libgit2 (release number or SHA1)
- https://github.com/libgit2/libgit2/commit/8535fdb9cbad8fcd15ee4022ed29c4138547e22d
Actual Behavior
1/12 Test: offline
1) Failure:
checkout::conflict::name_mangled_file_exists_in_workdir [/tmp/libgit2/tests/libgit2/checkout/conflict.c:160]
OID mismatch: &expected != &actual
"b42712cfe99a1a500b2a51fe984e0b8a7702ba11" != "a3102456e459e506a2e51646d2ffdbe5785fb5ca"
2) Failure:
status::worktree::whole_repository [/tmp/libgit2/tests/libgit2/status/worktree.c:41]
counts.expected_entry_count != counts.entry_count
16 != 21
3) Failure:
status::worktree::show_index_and_workdir [/tmp/libgit2/tests/libgit2/status/worktree.c:69]
counts.expected_entry_count != counts.entry_count
16 != 21
4) Failure:
status::worktree::show_workdir_only [/tmp/libgit2/tests/libgit2/status/worktree.c:71]
0 != counts.wrong_sorted_path
0 != 13
5) Failure:
status::worktree::swap_subdir_and_file [/tmp/libgit2/tests/libgit2/status/worktree.c:182]
counts.expected_entry_count != counts.entry_count
22 != 27
6) Failure:
status::worktree::swap_subdir_with_recurse_and_pathspec [/tmp/libgit2/tests/libgit2/status/worktree.c:216]
counts.expected_entry_count != counts.entry_count
23 != 28
7) Failure:
status::worktree::filemode_non755 [/tmp/libgit2/tests/libgit2/status/worktree.c:645]
0 != counts.wrong_status_flags_count
0 != 1
8) Failure:
status::worktree::conflict_has_no_oid [/tmp/libgit2/tests/libgit2/status/worktree.c:764]
16 != git_status_list_entrycount(statuslist)
16 != 22
9) Failure:
status::worktree::update_stat_cache_0 [/tmp/libgit2/tests/libgit2/status/worktree.c:1034]
entry_count0 != max_i
16 != 21
10) Failure:
status::worktree::unreadable [/tmp/libgit2/tests/libgit2/status/worktree.c:1118]
0 != counts.wrong_status_flags_count
0 != 1
12/12 Testing: util
1) Failure:
path::validate_current_user_ownership [/tmp/libgit2/tests/util/path.c:764]
is_cur != (geteuid() == 0)
1 != 0