Skip to content

Conversation

@TheBlueMatt
Copy link
Contributor

This is a redo of #986, but is based on Boost 1.49 which fixed the underlying issue (mostly).
It also reverts 7b90edb to re-enable URI handling itself.

@Diapolo
Copy link

Diapolo commented Jun 10, 2012

Whenever I proposed to update to Boost 1.49 for the Win-build I got the answer no that is not importand enough ... see #1023, which even hardens the URI handling.

@TheBlueMatt
Copy link
Contributor Author

Dunno, maybe gavin didn't quite understand the phrasing there. To be clear, this simply encourages using a path of boost_1_49_0 instead of boost_1_47_0 when building with a MinGW makefile, if you add your own -I/-L you can still gladly use any boost version you want. It also upgrades gitian build to use 1.49 and patches boost according to a request for testing that a boost developer made at https://svn.boost.org/trac/boost/ticket/5392#comment:29 and that has not gotten any negative confirmations and works as far as I've tested it.

@Diapolo
Copy link

Diapolo commented Jun 10, 2012

I'm with you and I have used boost 1.49 with this mentioned lines enabled for a long time now. I think my pull would perfectly fit on top of what you are doing here, but it seems no one even tried to look at it in detail :-/.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To ensure we use the first available Icon from the executable you could use $INSTDIR\bitcoin-qt.exe,0.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want that, wont not using that let Windows pick the best icon based on size and color-depth?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One windows "icon" embeds multiple sizes/color depths. An executable can embed multiple icons, for example the icons for different file types. However, Bitcoin-qt only has one icon defined in the .rc, so this doesn't matter here.

@gavinandresen
Copy link
Contributor

I think this feature is big enough it needs a test plan (see https://secure.bettermeans.com/projects/4180/wiki/Raw_Transaction_RPC_Test_Plan for an example of what I'm thinking). Also, since it opens up potential security holes, writing a tool to throw "fuzzed" input at it and verifying that nothing bad happens would make me happy.

@TheBlueMatt
Copy link
Contributor Author

To test:

  1. launch Bitcoin-Qt with a bitcoin: URI to make sure it opens URIs provided at initial start.
    Result should be opening directly to the send dialog with the content of the provided URI.
  2. while [ true ]; do ./release/bitcoin-qt.exe bitcoin:1JBMattRztKDF2KRS3vhjJXA7h47NEsn2c; done
    Ensure only one URI is added per second to the send dialog (note that any more sent to Bitcoin will result in an error locking datadir as the new client attempts to load normally, this is an unavoidable result of the IPC mechanism), Bitcoin-Qt isn't using an unreasonable amount of CPU, and switching to the send dialog and scrolling to the bottom each time a new URI is added.
  3. With the listening bitcoin-Qt running, kill Windows without shutting it down, start again and ensure that the same results.
  4. Click the Send button and with the Send Dialog box up, attempt to open new URIs. Those URIs should be ignored until the send has finished.

To Fuzz with printable characters and URIs up to size 300: (note that anything larger than 256 will attempt to launch Bitcoin and give an error that it cannot obtain a datadir lock).
while [ true ]; do ./release/bitcoin-qt.exe bitcoin:tr -dc "[:print:]" < /dev/urandom | head -c $[ $RANDOM % 300 ]; sleep 1; done
To Fuzz with control characters and URIs up to size 300: (note that anything larger than 256 will attempt to launch Bitcoin and give an error that it cannot obtain a datadir lock).
while [ true ]; do ./release/bitcoin-qt.exe bitcoin:tr -dc "[:cntrl:]" < /dev/urandom | head -c $[ $RANDOM % 300 ]; sleep 1; done

@laanwj
Copy link
Member

laanwj commented Jun 13, 2012

It would be nice to get URL support back in once and for all. If that means requiring boost 1.49 on windows that's fine with me. But it's too bad it still needs the monkey patch to be stable :/ Won't the upstream boost developers integrate it?

Anything larger than 256 will attempt to launch bitcoin

Is that desired behavior? I'd prefer showing an error message about a too-long URL, then quitting. Maybe for a later pull.

@Diapolo
Copy link

Diapolo commented Jun 13, 2012

@laanwj I consider this pull as a base for further updates to the URI handling code, even if not all parts of my re-work pull #1023 are considered good or mergable, I'm fine with a cherry picking or splitting them. But I think this pull needs to get in ASAP and if we need a patched boost 1.49 on Windows that's ok.

@laanwj
Copy link
Member

laanwj commented Jun 13, 2012

I agree with merging this ASAP.

Feels like a deja-vu, but can we detect the patched boost 1.49 somehow, compile time? It would be nice if it failed if one tried to build on windows with URL support without the patched boost. Otherwise, someone building bitcoin manually on windows might run into the mysterious crashes again.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This enables it for MAC_OSX too, is that intended?
I remember boost interprocess had/has another problem on mac: it took 100% CPU time.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This simply attempts to open the message_queue, which will fail as we never set up the message_queue listener in ipcInit on OSX. There is no point having an ugly ifdef here, especially since we are never gonna get called with a bitcoin: URI on osx on the command line unless a user does it manually.

@Diapolo
Copy link

Diapolo commented Jun 13, 2012

@laanwj I guess we need no detection for the Windows users, we just need an official dependency package, which includes the used version of Boost and its libs.

@laanwj
Copy link
Member

laanwj commented Jun 13, 2012

Agreed, but not everyone will be using that, if you build from source you could insist to build everything from source. It's easy to miss.

@Diapolo
Copy link

Diapolo commented Jun 13, 2012

Why not #if !defined(BOOST_INTERPROCESS_HAS_WINDOWS_KERNEL_BOOTTIME) || !defined(BOOST_INTERPROCESS_HAS_KERNEL_BOOTTIME) and throw an error. It should be insinde an #ifdef WIN32, too or use defined(WIN32) as addition argument.

@TheBlueMatt
Copy link
Contributor Author

In terms of erroring if we dont detect BOOST_... flags specified, Id really prefer not to. I dont want to follow boost and remove the checks if boost upgrades and complicate them with complicated boost version checks. Anyone who is building bitcoin for Windows should be reading and creating executables by closely following the gitian commands. Especially note that we add the mthreads/-fexceptions flags in the qt gitian descriptor, not in Bitcoin itself.

@laanwj
Copy link
Member

laanwj commented Jun 13, 2012

-mthreads/-fexceptions doesn't apply to people building on windows. It's a cross-compile specific issue.

Another idea (better than failing) would be to make URL support a build option in bitcoin-qt.pro, which is disabled by default on Windows. Then document it as "Enable this only with a patched Boost >=1.49 (link to patch), otherwise you may experience random crashes at startup".

@TheBlueMatt
Copy link
Contributor Author

And AFAIK, most people who compile bitcoin for windows do cross compile. I know several people recently have been on #bitcoin-dev asking how to build it, and ended up giving up and cross compiling in an Ubuntu VM.

@Diapolo
Copy link

Diapolo commented Jun 13, 2012

At least I build it native on Windows ;).

@TheBlueMatt
Copy link
Contributor Author

Added a
#if defined(WIN32) && (!defined(BOOST_INTERPROCESS_HAS_WINDOWS_KERNEL_BOOTTIME) || !defined(BOOST_INTERPROCESS_HAS_KERNEL_BOOTTIME) || BOOST_VERSION < 104900)
#warning

@Diapolo
Copy link

Diapolo commented Jun 15, 2012

That's a good thing, even if it does not look very nice ;).

@laanwj
Copy link
Member

laanwj commented Jun 16, 2012

I don't think looking nice is important in any way here. It is a complex logical expression because we need a complex logical expression.

ACK

@sipa
Copy link
Member

sipa commented Jun 16, 2012

I think it is important that this functionality gets added soon. I haven't checked or tested the code though.

@gavinandresen gavinandresen merged commit ad5f29b into bitcoin:master Jul 5, 2012
suprnurd pushed a commit to chaincoin-legacy/chaincoin that referenced this pull request Dec 5, 2017
* split CDarksendPool

* split DoAutomaticDenominating

* CMasternode* -> masternode_info_t

* move some globals into CPrivateSendClient

* addressed PR comments
lateminer pushed a commit to lateminer/bitcoin that referenced this pull request Jan 22, 2019
lateminer pushed a commit to lateminer/bitcoin that referenced this pull request May 6, 2020
…n sets of strings

c3dc816 [Core] LogAcceptCategory: use uint32_t rather than sets of strings (random-zebra)

Pull request description:

  implemented on top of:
  - [x] bitcoin#1449

  from bitcoin#9424

  > This changes the logging categories to boolean flags instead of strings.
  This simplifies the acceptance testing by avoiding accessing a scoped static thread local pointer to a thread local set of strings. It eliminates the only use of boost::thread_specific_ptr outside of lockorder debugging.
  This change allows log entries to be directed to multiple categories and makes it easy to change the logging flags at runtime (e.g. via an RPC, though that isn't done by this commit.)
  It also eliminates the fDebug global.
  Configuration of unknown logging categories now produces a warning.

  We add 4 more debug categories:
  - BCLog::STAKING
  - BCLog::MASTERNODE (which includes previous "masternode" and "mnpayments" categories)
  - BCLog::MNBUDGET
  - BCLog::LEGACYZC

ACKs for top commit:
  Fuzzbawls:
    ACK c3dc816

Tree-SHA512: 0c2ffc30df5b4239396c6f2ef6c551bbca5696aa1087b5e12a206fc9b1def9ef6cd9c6f6c0cbbb8da0d667e782848a884514de21609714668d0b5ad87eca8e56
lateminer pushed a commit to lateminer/bitcoin that referenced this pull request May 6, 2020
0a85445 [Core] Add -debugexclude option (random-zebra)

Pull request description:

  Implemented on top of:
  - [x] bitcoin#1449
  - [x] bitcoin#1437

  Backports bitcoin#10123

  > setting `-debug` can lead to very noisy debug.logs with subcomponents filling up the log file. See for example https://travis-ci.org/bitcoin/bitcoin/jobs/216767286 where there are hundreds of libevent debug logs.

  This commit adds an option to exclude certain components from debug logging. The usage is:
  ```
  pivxd -debug -debugexclude=<component1> -debugexclude=<component2> ...
  ```

  This finally reduces spammy logs in the functional tests debug, due to libevent and leveldb (bitcoin#10124 was already included backporting the test suite).

ACKs for top commit:
  furszy:
    Code looking good, utACK 0a85445 .
  Fuzzbawls:
    ACK 0a85445

Tree-SHA512: 6ccbe275ab11f3e1739ed117e49db0a2e56db345287cddc7cc18fc1131d7800d0f08a7e93005f70cf45ed8e340580f91c3017532bd2ea28fedb5735409ae068b
lateminer pushed a commit to lateminer/bitcoin that referenced this pull request May 6, 2020
d16b7b2 Buffer log messages and explicitly open logs (random-zebra)

Pull request description:

  implemented on top of
  - [x] bitcoin#1449
  - [x] bitcoin#1437
  - [x] bitcoin#1439

  Backports bitcoin#6149

  > Prevents stomping on debug logs in datadirs that are locked by other
  instances and lost parameter interaction messages that can get wiped by
  ShrinkDebugFile().
  The log is now opened explicitly and all emitted messages are buffered
  until this open occurs.  The version message and log cut have also been
  moved to the earliest possible sensible location.

ACKs for top commit:
  furszy:
    utACK d16b7b2
  Fuzzbawls:
    ACK d16b7b2

Tree-SHA512: f3f859181499661641df1ccf118fdb583517c3f4104313df4c200471436e2c456bd9d15164215cfde274b235afdd2afe19a186c214d3c06461f0e3a03bd944b8
lateminer pushed a commit to lateminer/bitcoin that referenced this pull request May 6, 2020
f66e50e [Doc] Add logging RPC to release notes (random-zebra)
bf55911 allow libevent logging to be updated during runtime (random-zebra)
ec43b51 Set BCLog::LIBEVENT correctly for old libevent versions. (random-zebra)
cbaf724 [rpc] Add logging rpc (random-zebra)

Pull request description:

  Implemented on top of:
  - [x] bitcoin#1449
  - [x] bitcoin#1437
  - [x] bitcoin#1439
  - [x] bitcoin#1450

  Backports bitcoin#10150

  > Adds an RPC to get/set active logging categories.
  First commit allows all categories except libevent to be reconfigured during runtime.
  Second commit modifies InitHTTPServer() to allow leveldb logging to be reconfigured during runtime.

ACKs for top commit:
  furszy:
    Really nice 👍 , ACK f66e50e .
  Fuzzbawls:
    ACK f66e50e

Tree-SHA512: 7b735628d341fb8661eb76f57dadc78e69ea63c62edb778450b3d9e3b7137ce06e08ceab835967b923401a9687e5b2605722a9f256e6ed85fc372a0e46086b8f
lateminer pushed a commit to lateminer/bitcoin that referenced this pull request May 6, 2020
882ef90 [Doc] Update release notes for `-debuglogfile` (random-zebra)
3d5ad7f test: Add tests for `-debuglogfile` with subdirs (random-zebra)
2c2e36d test: Add test for `-debuglogfile` (random-zebra)
b44a324 Add `-debuglogfile` option (random-zebra)

Pull request description:

  Implemented on top of
  - [x] bitcoin#1449
  - [x] bitcoin#1437
  - [x] bitcoin#1439
  - [x] bitcoin#1450
  - [x] bitcoin#1451

  Only last 4 commits are relevant to this PR.
  Backports bitcoin#11781

  > This patch adds an option to configure the name and/or directory of the debug log file.</br></br>
  The user can specify either a relative path, in which case the path is relative to the (network specific) data directory. They can also specify an absolute path to put the log anywhere else in the file system.

  Functional test included.

ACKs for top commit:
  Fuzzbawls:
    ACK 882ef90
  furszy:
    utACK 882ef90

Tree-SHA512: 02a0e6487683e5111765af7296ef7ce035372febf037268d99d29b4c4a2f74bcc40f46a0f5b1bacddc2249c2a7e40255555e83ca9d51bf71d9e054c6e85765cc
lateminer pushed a commit to lateminer/bitcoin that referenced this pull request May 6, 2020
5c8e968 [Trivial] Document logtimemicros flag in the help (random-zebra)
4daa10a util: Store debug log file path in BCLog::Logger member. (random-zebra)
2f03e85 scripted-diff: Rename BCLog::Logger member variables. (random-zebra)
303700e util: Refactor GetLogCategory. (random-zebra)
0ae18c0 util: Encapsulate logCategories within BCLog::Logger. (random-zebra)
a2fb3fd util: Move debug file management functions into Logger. (random-zebra)
5a42d82 util: Establish global logger object. (random-zebra)
15c0da4 [Refactor] Complete boost::filesystem namespace in util (random-zebra)
81ddbf4 MOVEONLY: Move logging code from util.{h,cpp} to new files. (random-zebra)

Pull request description:

  Implemented on top of:
  - [x] bitcoin#1449
  - [x] bitcoin#1437
  - [x] bitcoin#1439
  - [x] bitcoin#1450
  - [x] bitcoin#1451
  - [x] bitcoin#1455

  This creates a new class BCLog::Logger to encapsulate all global logging configuration and state.

  Adapted from
  - bitcoin#13021
  - bitcoin#12954

ACKs for top commit:
  Fuzzbawls:
    ACK 5c8e968
  furszy:
    utACK 5c8e968

Tree-SHA512: 0b10a031dd7e32b48485236fbdd8249d011049e6f99e1df145b7dea4cab9e6e67e19d1bb13ff48e99eb2487a8399bbb8298fe851ad8873416fc1053aee0379bc
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Sep 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants