Check std::system for -[alert|block|wallet]notify #15457
pull Sjors wants to merge 3 commits into bitcoin:master from Sjors:2019/02/std__system changing 8 files +51 −0-
Sjors commented at 1:15 pm on February 21, 2019: memberPlatforms such as iOs and Universal Windows Platform do not support launching a process through system().
-
fanquake added the label Build system on Feb 21, 2019
-
Sjors commented at 1:17 pm on February 21, 2019: member
One way to test this is by following the iOs cross-compilation instructions in #12557:
0make clean 1 2./configure 3... 4checking for std::system... yes 5... 6 7make clean 8 9./configure --prefix=`pwd`/depends/aarch64-apple-darwin14 10... 11checking for std::system... no 12...
Note that
./configure
can be a bit stubborn about caching things. -
promag commented at 1:52 pm on February 21, 2019: memberConcept ACK. Could make runCommand noop instead of multiple guards?
-
MarcoFalke commented at 2:26 pm on February 21, 2019: member
ACK c0e9ac7ac15bdfd4caaafe74a7b3796c70177630 (checked that compiling without
HAVE_STD__SYSTEM
and running the tests results in failure of0feature_notifications.py | ✖ Failed | 1 s 1feature_versionbits_warning.py | ✖ Failed | 0 s
This should be fine, since I don’t expect anyone running the functional tests on ios)
-
DrahtBot commented at 2:36 pm on February 21, 2019: member
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
Conflicts
Reviewers, this pull request conflicts with the following ones:
- #13339 (wallet: Replace %w by wallet name in -walletnotify script by promag)
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.
-
promag commented at 2:41 pm on February 21, 2019: member@MarcoFalke looks like
HAVE_STD__SYSTEM
could be added to test/config.ini.in so thatBitcoinTestFramework.skip_if_no_std_system
or something could be added. -
ken2812221 commented at 3:06 pm on February 21, 2019: contributorConcept ACK. Maybe those arguments should be added into
hidden_args
to keep config file portability. -
MarcoFalke commented at 3:09 pm on February 21, 2019: member
- If they are added to hidden args, might as well just make runCommand a noop (since that is doing effectively the same)
BitcoinTestFramework.skip_if_no_std_system
meh. Not sure if this is ever needed unless someone wants to run the functional tests on ios (with a native compile)
-
promag commented at 3:22 pm on February 21, 2019: member@MarcoFalke agree :trollface: I was curious how it currently detects if wallet is enabled.
-
Sjors commented at 5:00 pm on February 21, 2019: member
I can imagine someone running the functional test suite on their machine against bitcoind on the sandboxed device. But that’s likely going to require additional changes to the test framework, so perhaps that’s a better time to design something like
BitcoinTestFramework.skip_if_no_std_system
.As for running the functional tests themselves from the device, that would also require modifications since the test framework relies on launching processes.
I’m not a fan of turning
runCommand
into anoop
. I still need multiple guards to remove it from the help, and I want functions that callrunCommand
to explicitly handle its absence. -
promag commented at 0:31 am on February 22, 2019: member
I still need multiple guards to remove it from the help, and I want functions that call
runCommand
to explicitly handle its absence.:+1:
-
jonasschnelli commented at 6:08 am on February 22, 2019: contributorConcept ACK
-
laanwj commented at 8:28 am on February 22, 2019: memberI can certainly see his being useful in sandboxed environments of various kinds. Vaguely remember a similar thing when trying to get bitcoind to work in CloudABI. utACK
-
in configure.ac:888 in c0e9ac7ac1 outdated
883@@ -884,6 +884,15 @@ if test x$use_reduce_exports = xyes; then 884 [AC_MSG_ERROR([Cannot set default symbol visibility. Use --disable-reduce-exports.])]) 885 fi 886 887+AC_MSG_CHECKING([for std::system]) 888+AC_TRY_LINK( [ #include <cstdlib> ],
fanquake commented at 8:40 am on February 22, 2019:I see these warnings when running
./autogen.sh
:0configure.ac:894: warning: The macro `AC_TRY_LINK' is obsolete. 1configure.ac:894: You should run autoupdate. 2../../lib/autoconf/general.m4:2688: AC_TRY_LINK is expanded from... 3configure.ac:894: the top level 4glibtoolize: putting auxiliary files in AC_CONFIG_AUX_DIR, 'build-aux'. 5...
Sjors commented at 10:57 am on February 22, 2019:I switched to the modernAC_LINK_IFELSE( [ AC_LANG_PROGRAM(
syntax. For some reason I don’t think I got these warnings on macOS.Sjors force-pushed on Feb 22, 2019Sjors force-pushed on Feb 22, 2019Sjors force-pushed on Feb 22, 2019MarcoFalke added the label Needs gitian build on Feb 22, 2019DrahtBot commented at 8:06 am on February 23, 2019: memberGitian builds for commit a094b543324267e6d956bb0df2ede990b90118cb (master):
4b9044e8fe79d1b13b09a0cd9ecdf6d0...
bitcoin-0.17.99-aarch64-linux-gnu-debug.tar.gz60b1aed0443aa669d2540a7f3ece6509...
bitcoin-0.17.99-aarch64-linux-gnu.tar.gzc88154a6d2e21010c3597ad9f9cda765...
bitcoin-0.17.99-arm-linux-gnueabihf-debug.tar.gz4d2d04d6bff1abb848b1ac119d583dd3...
bitcoin-0.17.99-arm-linux-gnueabihf.tar.gzd0d0d91b65f27a9c84c1f69eec818ddc...
bitcoin-0.17.99-i686-pc-linux-gnu-debug.tar.gza14d1682ee7c7381be5bc04d25e34c1d...
bitcoin-0.17.99-i686-pc-linux-gnu.tar.gz53af128c1a7e4ebee1dd9912f0d83d2a...
bitcoin-0.17.99-osx-unsigned.dmg41f8c4e07474793a757736205972fa6e...
bitcoin-0.17.99-osx64.tar.gz27c56b9e49581dc4712dc6ed0e1ac378...
bitcoin-0.17.99-riscv64-linux-gnu-debug.tar.gzd51e754d160a2cd02bd09b6f18db5783...
bitcoin-0.17.99-riscv64-linux-gnu.tar.gz300536370491fa3f09891d65d04fc9be...
bitcoin-0.17.99-win32-debug.zipae65e76c4e1fb330e25c14ca00d7445b...
bitcoin-0.17.99-win32-setup-unsigned.exe3397e970170015ed9fc8c7e9ba9dd1d2...
bitcoin-0.17.99-win32.zip57be74157b50784d573d1df35ae89991...
bitcoin-0.17.99-win64-debug.zipb979c42efaabd2dc15649725339c1df7...
bitcoin-0.17.99-win64-setup-unsigned.exe522ceb0d5d145b2902d472fa5b76a0ff...
bitcoin-0.17.99-win64.zipb8d492f260d24dcdef891af776a6fee8...
bitcoin-0.17.99-x86_64-linux-gnu-debug.tar.gz2e014bb0d925ac5848f47957163e02bc...
bitcoin-0.17.99-x86_64-linux-gnu.tar.gzfba90eefad0062db64329d53c16a9d48...
bitcoin-0.17.99.tar.gz6e78fb7495fa207f037fb1789a9b3821...
bitcoin-linux-0.18-res.yml55f7f2f4f8ed1e8e3738a6ee897a0dff...
bitcoin-linux-build.loge2b5ef093e034f9a3f3826991ab7e027...
bitcoin-osx-0.18-res.ymlc112f6871a528f1639bbc8d8ffaef24e...
bitcoin-osx-build.logddf1401bd2a88d078f0756831403e4d7...
bitcoin-win-0.18-res.ymlbd9ffcbff36d5d84e51c95c83cc6cbdd...
bitcoin-win-build.log
Gitian builds for commit b2eb95baf11dfe1d5c3f54e3fa9225facff0b45b (master and this pull):
3f8c89762707efa30ebe7a05eda9ba2b...
bitcoin-0.17.99-aarch64-linux-gnu-debug.tar.gz49e1fd64503ff61af498efb455f0dd08...
bitcoin-0.17.99-aarch64-linux-gnu.tar.gz4d7d12c70ba6c10125e871c69724a025...
bitcoin-0.17.99-arm-linux-gnueabihf-debug.tar.gzfa4f063951308ac100c1fb0be8947f51...
bitcoin-0.17.99-arm-linux-gnueabihf.tar.gz6e762347eb01457bd2f39989fac92e8c...
bitcoin-0.17.99-i686-pc-linux-gnu-debug.tar.gz5fbf533a6dab0e5f65a9b1b2beb9decb...
bitcoin-0.17.99-i686-pc-linux-gnu.tar.gz6eab5c92bd65e28d498ff17c8c4dc5a5...
bitcoin-0.17.99-osx-unsigned.dmg84c574236a887b9ef2b5365fb40cc893...
bitcoin-0.17.99-osx64.tar.gzdc5b1ecfa5166e84883fca3dcfda6136...
bitcoin-0.17.99-riscv64-linux-gnu-debug.tar.gz9c5ff4234f4c5749a27fc3d26b193fe3...
bitcoin-0.17.99-riscv64-linux-gnu.tar.gz940fed5d4f3fc0f65643bfa5df42abf2...
bitcoin-0.17.99-win32-debug.zip3c89e4ae4442e98ee6c44fc7447d56af...
bitcoin-0.17.99-win32-setup-unsigned.exe67179410836ae46313be14a9db7b6f58...
bitcoin-0.17.99-win32.zip628d9e33fde0eca685443ccece7976a1...
bitcoin-0.17.99-win64-debug.zipee2febc299233707564cf0d5ca976729...
bitcoin-0.17.99-win64-setup-unsigned.exed4b969e0d358b87051896922fe06e6fc...
bitcoin-0.17.99-win64.zip40bbdbfbc134ed25fb86dd13881dc417...
bitcoin-0.17.99-x86_64-linux-gnu-debug.tar.gze168a4cfd966491adaf4936304ea7020...
bitcoin-0.17.99-x86_64-linux-gnu.tar.gz98688e91beb8cf9fc7d8eef2221342ba...
bitcoin-0.17.99.tar.gz47ebfe93e44df63a99bee6d0b1cd65b9...
bitcoin-linux-0.18-res.yml0c33f45fbca7b79b4d300ab5de396833...
bitcoin-linux-build.log892fd119a8121961771f5a3036358d55...
bitcoin-osx-0.18-res.yml80de3b28046cc0c17c01e29be418b544...
bitcoin-osx-build.log208212604c711588c15c3df31bbabd11...
bitcoin-win-0.18-res.yml0b6ace4e85a5cdc5131b8ef230c9c7cb...
bitcoin-win-build.log
DrahtBot removed the label Needs gitian build on Feb 23, 2019in src/init.cpp:583 in d9255a1b5e outdated
579@@ -576,6 +580,7 @@ std::string LicenseInfo() 580 "\n"; 581 } 582 583+#if defined(HAVE_STD__SYSTEM) || defined(WIN32)
laanwj commented at 2:38 pm on March 8, 2019:I think repeating this condition everywhere is error-prone. Can’t we make sureHAVE_STD__SYSTEM
is always set whenWIN32
instead?
Sjors commented at 5:13 pm on March 8, 2019:I changed it to check for eitherstd::system
or::wsystem
, so we can now useHAVE_SYSTEM
.Sjors force-pushed on Mar 8, 2019in src/util/system.h:18 in de0e7298d9 outdated
13@@ -14,6 +14,9 @@ 14 #include <config/bitcoin-config.h> 15 #endif 16 17+/* Define to 1 if std::system or (for Windows) ::wsystem is available */ 18+#define HAVE_SYSTEM HAVE_STD__SYSTEM || HAVE_WSYSTEM
Empact commented at 6:55 pm on March 9, 2019:Should this be happening in configure alone, or here alone?
Sjors commented at 8:21 pm on March 9, 2019:I’ve keptHAVE_STD__SYSTEM
andHAVE_WSYSTEM
separate, because it allows for separate handling of Windows vs. non-Windows.HAVE_SYSTEM
combines the two, for code that doesn’t care.
Empact commented at 8:27 pm on March 9, 2019:All for keeping them separate. I’m more calling out that theHAVE_SYSTEM
definition seems to be happening in configure.ac as well:AC_DEFINE([HAVE_SYSTEM], [HAVE_STD__SYSTEM || HAVE_WSYSTEM], [HAVE_WSYSTEM])
, and that it’s preferable to have one or the other to avoid potential divergence / confusion.
Sjors commented at 9:47 pm on March 9, 2019:Ah oops, I’ll get rid the duplicate.in configure.ac:908 in de0e7298d9 outdated
903+ [ AC_MSG_RESULT(yes); AC_DEFINE(HAVE_WSYSTEM, 1, Define to 1 if you have the `::wsystem' function.)], 904+ [ AC_MSG_RESULT(no) ] 905+) 906+ 907+# Define to 1 if std::system or ::wsystem (Windows) is available 908+AC_DEFINE([HAVE_SYSTEM], [HAVE_STD__SYSTEM || HAVE_WSYSTEM], [HAVE_WSYSTEM])
Empact commented at 8:31 pm on March 9, 2019:HAVE_WSYSTEM
seems unintended as a “description” argument. https://www.gnu.org/software/autoconf/manual/autoconf-2.69/html_node/Defining-Symbols.htmlSjors force-pushed on Mar 14, 2019Sjors force-pushed on Mar 14, 2019Sjors force-pushed on Mar 14, 2019Sjors commented at 5:36 pm on March 14, 2019: memberI tested the Gitian build on Windows and
-walletnotify
still works. I also managed to build using Visual Studio and it also works there.I’m confused why
feature_notifications.py
is failing on AppVeyor. I’m still figuring out how to run the functional tests from the Visual Studio build (something with test/config.ini it seems) to reproduce…My guess is that AppVeyor builds in a way that doesn’t have ::wsystem available (e.g. Universal Windows Platform), which would cause
-walletnotify
to not get compiled in, but also cause the test to fail unless I add some detection to it.Sjors commented at 6:08 pm on March 14, 2019: member@sipsorcery do you know how to run the functional tests on Windows?MarcoFalke commented at 6:37 pm on March 14, 2019: membersipsorcery commented at 6:42 pm on March 14, 2019: member@Sjors yes I can run the functional tests on Windows. If you’re alluding to why the appveyor check failed it’s almost certainly due to the length of time it’s taking rather than the functional test. That’s assuming the test hasn’t changed since I last checked it a week or so ago.
Maybe AppVeyor would bump up the time limit from 60 to 90 minutes for Bitcoin Core if asked.
Sjors commented at 8:11 pm on March 14, 2019: memberOk, it involved some manual work, but I’m able to run to functional tests now.
0[environment] 1SRCDIR=C:\Users\sjors\bitcoin 2BUILDDIR=C:\Users\sjors\bitcoin 3EXEEXT=.exe 4RPCAUTH=C:\Users\sjors\bitcoin\share\rpcauth\rpcauth.py 5 6[components] 7# Which components are enabled. These are commented out by `configure` if they were disabled when running config. 8ENABLE_WALLET=true 9ENABLE_CLI=true 10ENABLE_BITCOIND=true 11ENABLE_ZMQ=true�
And you have copy the exe files:
0mv .\build_msvc\x64\Debug\*.exe .\src
.\test\functional\feature_notifications.py�
passes.By the way, it’s complaining about the bitcoin unicode symbol:
UnicodeEncodeError: 'charmap' codec can't encode character '\u20bf'�
.sipsorcery commented at 8:17 pm on March 14, 2019: memberBy the way, it’s complaining about the bitcoin unicode symbol:
UnicodeEncodeError: 'charmap' codec can't encode character '\u20bf'�
.Powershell: $env:PYTHONUTF8=1 or cmd: set PYTHONUTF8=1
Sjors commented at 8:17 pm on March 14, 2019: memberIf you’re alluding to why the appveyor check failed it’s almost certainly due to the length of time it’s taking rather than the functional test. That’s assuming the test hasn’t changed since I last checked it a week or so ago.
The test that fails is directly related to this PR and I’ve reproduced it on two separate AppVeyor builds (trying the 3rd one now). Bumping to 90 minutes would be great indeed, because whenever the cache is cleared, it only makes it halfway through the function tests. That happened here as well (but the error I’m seeing here was after a rebuild).
Sjors commented at 8:23 pm on March 14, 2019: memberPowershell: $env:PYTHONUTF8=1
That worked, thanks. It seems like sometimes I have to hit a key before the dots start / continue appearing for the test runner.
I’m also missing some dependency for
.find_library ('ssl') or 'libeay32')
(OpenSSL?).Sjors commented at 10:15 am on March 15, 2019: memberI managed to reproduce on my own MSVC setup; I forgot to checkout this branch :-)
It turns out
configure.ac
is ignored, so instead I addedHAVE_SYSTEM
tobuild_msvc/bitcoin_config.h
.Sjors force-pushed on Mar 15, 2019practicalswift commented at 8:57 am on March 21, 2019: contributorFWIW the disassembly of thebitcoind
binary is identical before and after applying this patch on my Ubuntu 18.04 system (as expected).DrahtBot added the label Needs rebase on May 13, 2019[build] detect std::system or ::wsystem c1c91bb78d[build] MSVC: set HAVE_SYSTEM for desktop apps cc3ad56ff2[build]: check std::system for -[alert|block|wallet]notify
Platforms such as iOs do not support launching a process through system().
Sjors force-pushed on Jun 6, 2019DrahtBot removed the label Needs rebase on Jun 6, 2019laanwj commented at 3:29 pm on July 5, 2019: membercode review ACK f874e14cd3c84cd412bd3fb42b3ee1706ca6a267laanwj merged this on Jul 5, 2019laanwj closed this on Jul 5, 2019
laanwj referenced this in commit 8c69fae944 on Jul 5, 2019Sjors deleted the branch on Jul 5, 2019Sjors commented at 4:39 pm on July 5, 2019: memberDuring my rebase of #12557 I noticed this doesn’t actually work as advertised. Created a followup #16344. I think it broke when I refactored fromif defined(HAVE_STD__SYSTEM) || defined(WIN32)
to usingAC_DEFINE([HAVE_SYSTEM], [HAVE_STD__SYSTEM || HAVE_WSYSTEM]
. The latter seems to always defineHAVE_SYSTEM
, so I need to use#IF
instead.sidhujag referenced this in commit a851e931b9 on Jul 6, 2019fanquake referenced this in commit f373beebbc on Jul 7, 2019jasonbcox referenced this in commit 8e243c9eb5 on Aug 4, 2020PastaPastaPasta referenced this in commit 56251ec35d on Oct 22, 2021PastaPastaPasta referenced this in commit 79e5eb8a63 on Oct 22, 2021DrahtBot locked this on Dec 16, 2021
github-metadata-mirror
This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-11-17 15:12 UTC
This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me