-
Notifications
You must be signed in to change notification settings - Fork 37.7k
test: Drop x
modifier in fsbridge::fopen
call for MinGW builds
#29357
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. Code CoverageFor detailed information about the code coverage, see the test coverage report. ReviewsSee the guideline for information on the review process.
If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update. |
No? According to the link you provided:
|
Can you explain why this change makes sense? |
The added assertion makes the issue with the unsupported
|
It is already explicit and will fail on master without the first commit:
|
fa02938
to
bb79fd6
Compare
🚧 At least one of the CI tasks failed. Make sure to run all tests locally, according to the Possibly this is due to a silent merge conflict (the changes in this pull request being Leave a comment here, if you need help tracking down a confusing failure. |
Concept NACK. I don't think we should remove test coverage from all other platforms, just to accomodate Windows. In the worse case this should just have a Windows paths with the modified modifiers, with documentation explaining why? |
It is not about Windows as a platform. It is about Windows users who download the Bitcoin Core release binaries. We should not treat them in a discriminatory way. UPD. There are no cases where the "wbx" mode is used in the non-testing code, right? |
On the master branch the test passes on my system (Ubuntu 22.04):
|
Can you add exact steps to reproduce? How is it possible that the file is a nullptr and the |
I don't see how fixing the tests in the way I've suggested would be discriminatory. It would make them work on Windows while retaining the current test for all other platforms. |
|
bb79fd6
to
9c1042a
Compare
Thank you! Your suggestion has been implemented. |
9c1042a
to
d4690e4
Compare
x
modifier in fsbridge::fopen
callx
modifier in fsbridge::fopen
call for MinGW builds
It prints "No errors detected", which means that the test passed. I also tried this locally, and the file is not a nullptr. |
I agree. That is how it works on Linux in the Wine environment. On Windows, being linked to |
Yes, either the file is a nullptr, in which case the test already fails, or it is not, in which case the test passes. In any case, the added assert in the dropped commit isn't needed here or elsewhere, and doesn't change the outcome here. |
You are right. That commit was my mistake. FWIW, the |
src/test/streams_tests.cpp
Outdated
// function. It is possible to link to the new UCRT library instead. | ||
// However, the most easiest way to do it is to use a new GCC with | ||
// the -mcrtdll=ucrt option, which has been available since the commit | ||
// https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=453cb585f0f8673a5d69d1b420ffd4b3f53aca00 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this comment could just be something like Our usage of mingw-w64 and the msvcrt runtime does not support the x modifier for the _wfopen()
. The other info seems a bit overkiil, I'm also not sure if it's correct. From a quick look, if you choose the runtime you want, when you compile mingw-w64, there's no need for any GCC flag.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The other info seems a bit overkiil, I'm also not sure if it's correct. From a quick look, if you choose the runtime you want, when you compile mingw-w64, there's no need for any GCC flag.
If the new runtime can be linked in guix builds, I'd say it would be better to use it, instead of patching the code. Or is there some downside I am missing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the new runtime is available in guix, I'd say it would be better to just use it, instead of patching the code. Or is there some downside I am missing?
I agree that we should move to the new runtime. I assume the downside is possibly dropping support for Windows 7, but I don't see why that would be a problem.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to the docs, if it is missing, it can be installed via "Windows Update": https://devblogs.microsoft.com/cppblog/introducing-the-universal-crt/ . IIUC it is shipped by default on Windows 10.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if you choose the runtime you want, when you compile mingw-w64
Yes, there is --with-default-msvcrt=ucrt
configuration option.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yea. So I don't see why anything GCC related is required, or needs to be mentioned here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The following patch
--- a/contrib/guix/manifest.scm
+++ b/contrib/guix/manifest.scm
@@ -108,6 +108,16 @@ desirable for building Bitcoin Core release binaries."
base-libc
base-gcc))
+
+(define-public mingw-w64-x86_64-winpthreads-ucrt
+ (package
+ (inherit mingw-w64-x86_64-winpthreads)
+ (arguments
+ (substitute-keyword-arguments (package-arguments mingw-w64-x86_64-winpthreads)
+ ((#:configure-flags flags)
+ `(append ,flags
+ '("--with-default-msvcrt=ucrt")))))))
+
(define (gcc-mingw-patches gcc)
(package-with-extra-patches gcc
(search-our-patches "gcc-remap-guix-store.patch"
@@ -116,7 +126,7 @@ desirable for building Bitcoin Core release binaries."
(define (make-mingw-pthreads-cross-toolchain target)
"Create a cross-compilation toolchain package for TARGET"
(let* ((xbinutils (cross-binutils target))
- (pthreads-xlibc mingw-w64-x86_64-winpthreads)
+ (pthreads-xlibc mingw-w64-x86_64-winpthreads-ucrt)
(pthreads-xgcc (cross-gcc target
#:xgcc (gcc-mingw-patches mingw-w64-base-gcc)
#:xbinutils xbinutils
results in an error:
x86_64-w64-mingw32-ld: src/.libs/libwinpthread_la-thread.o: in function `pthread_create_wrapper':
/tmp/guix-build-mingw-w64-x86_64-winpthreads-11.0.1.drv-0/mingw-w64-v11.0.1/mingw-w64-libraries/winpthreads/src/thread.c:1518: undefined reference to `__intrinsic_setjmpex'
collect2: error: ld returned 1 exit status
Any ideas how to resolve it?
So it reports an error but the unit tests don't fail? Is this another (different bug)? |
We use the
So, the UPD. I've made a notice about a potential code change. |
I haven't reviewed this in detail, but it seems good enough for a temporary workaround. lgtm ACK d4690e4 |
I think the documentation should still be adjusted (#29357 (comment)). No point merging what I still think are incorrect docs, especially if the change is going to be backported. In any case, our unit test code also seems like the wrong place to put overly verbose documentaiton about GCC configuration options and the various windows runtimes. |
The MinGW-w64 toolchain links executables to the old msvcrt C Runtime Library that does not support the `x` modifier for the _wfopen() function.
d4690e4
to
d2fe905
Compare
Sorry, it skipped my attention. Fixed now. |
ACK d2fe905 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK d2fe905 - the plan here should still be to migrate to the newer windows runtime.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The MinGW-w64 toolchain links executables to the old msvcrt C Runtime Library that does not support the `x` modifier for the _wfopen() function. Github-Pull: bitcoin#29357 Rebased-From: d2fe905
Backported for 26.x in #29509. |
c68d4d0 [doc] update manual pages for v26.1rc2 (glozow) bd715bf [build] bump version to v26.1rc2 (glozow) b6d006d update release notes 26.1 (glozow) fce992b fuzz: restrict fopencookie usage to Linux & FreeBSD (fanquake) 40c56a4 test: make sure keypool sizes do not change on `getrawchangeaddress`/`getnewaddress` failures (UdjinM6) 7c82b27 wallet: Avoid updating `ReserveDestination::nIndex` when `GetReservedDestination` fails (UdjinM6) b5419ce p2p: Don't consider blocks mutated if they don't connect to known prev block (Greg Sanders) 0535c25 [test] IsBlockMutated unit tests (dergoegge) 8141498 [validation] Cache merkle root and witness commitment checks (dergoegge) 0c5c596 [test] Add regression test for #27608 (dergoegge) 2473635 [net processing] Don't process mutated blocks (dergoegge) 50c0b61 [validation] Merkle root malleation should be caught by IsBlockMutated (dergoegge) aff368f [validation] Introduce IsBlockMutated (dergoegge) 076c67c [refactor] Cleanup merkle root checks (dergoegge) 97a1d0a [validation] Isolate merkle root checks (dergoegge) 4ac0eb5 test: Drop `x` modifier in `fsbridge::fopen` call for mingw builds (Hennadii Stepanov) Pull request description: Includes: - #29357 - #29412 - #29524 - #29510 - #29529 Also does: - update to release notes - bump to rc2 - manpages - (no changes to bitcoin.conf) ACKs for top commit: achow101: ACK c68d4d0 Tree-SHA512: 2f8c3dd705e3f9f33403b3cc17e8006510ff827d7dbd609b09732a1669964e9b001cfecdc63d8d8daeb8f39c652e1e4ad0aac873d44d259c21803de85688ed2b
The MinGW-w64 toolchain links executables to the old msvcrt C Runtime Library that does not support the
x
modifier for the_wfopen()
function.Fixes #29014.