scripted-diff: Remove trailing newlines from one-line log messages #36904

pull maflcko wants to merge 2 commits into bitcoin:master from maflcko:2611-less-trailing-newline changing 59 files +315 −318
  1. maflcko commented at 9:01 PM on November 17, 2026: member

    The log functions sometimes have a trailing newline character. This is perfectly fine, because that char will be stripped again by the log framework. However, it is still confusing:

    • After #35833 embedded newlines are escaped and a single trailing one is excluded. It would be clearer to not have a special carve-out here. Also the carve-out may be missing two-or-more trailing newlines.
    • The trailing newline may incorrectly imply that newlines are supported at all.

    (Just a draft to see how many conflicts there are)

  2. DrahtBot added the label Refactoring on Nov 17, 2026
  3. maflcko marked this as a draft on Nov 17, 2026
  4. DrahtBot commented at 9:01 PM on November 17, 2026: contributor

    <!--e57a25ab6845829454e8d69fc972939a-->

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    <!--006a51241073e994b41acfe9ec718e94-->

    External sites

    <!--021abf342d371248e50ceaed478a90ca-->

    Reviews

    See the guideline and AI policy for information on the review process. A summary of reviews will appear here.

    <!--174a7506f384e20aa4161008e828411d-->

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #36897 <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/36897.svg"></sub> (wallet, migration: Contain all legacy wallet and migration related things in its own subdirectory, namespace, and classes by achow101)
    • #36858 <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/36858.svg"></sub> (refactor: break the blockstorage/validation circular dependency by pzafonte)
    • #36856 <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/36856.svg"></sub> (kernel: add manual pruning by pzafonte)
    • #36820 <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/36820.svg"></sub> (refactor: remove more dead code by fanquake)
    • #36738 <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/36738.svg"></sub> (refactor: move block writes and pruning into BlockManager by pzafonte)
    • #36598 <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/36598.svg"></sub> ([Demo] validation: remove AssumeUTXO by l0rinc)
    • #36586 <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/36586.svg"></sub> (coins: warn of low disk space before chainstate compaction by l0rinc)
    • #36540 <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/36540.svg"></sub> (mempool: remove time-based transaction expiry by ismaelsadeeq)
    • #36434 <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/36434.svg"></sub> (http: support unix sockets by pinheadmz)
    • #36326 <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/36326.svg"></sub> (kernel: Use typed errors for fatal and flush error notifications by arejula27)
    • #36015 <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/36015.svg"></sub> (txorphanage: bound orphan memory by storing transactions serialized by brunoerg)
    • #35998 <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/35998.svg"></sub> (wallet: Handle or explicitly ignore WalletBatch write failures by achow101)
    • #35906 <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/35906.svg"></sub> (First steps towards a stateless, side-effect free validation library by purpleKarrot)
    • #35902 <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/35902.svg"></sub> (zmq: Log bind error at Error level, abort startup on init error by chriszeng1010)
    • #35570 <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/35570.svg"></sub> (refactor: Change some validation.cpp methods to return BlockValidationState by optout21)
    • #35355 <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/35355.svg"></sub> (Use atomics for determining whether trace logging is enabled by ajtowns)
    • #34909 <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/34909.svg"></sub> (wallet, refactor: modularise wallet by extracting out legacy wallet migration by rkrux)
    • #34778 <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/34778.svg"></sub> (logging: rewrite macros to enforce restrictions at compile-time, improve efficiency and usability by ryanofsky)
    • #34400 <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/34400.svg"></sub> (wallet: parallel fast rescan by Eunovo)
    • #34038 <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/34038.svg"></sub> (logging: replace -loglevel with -trace, expose trace logging via RPC by ajtowns)
    • #33324 <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/33324.svg"></sub> (blocks: add resumable reobfuscation for existing block files by l0rinc)
    • #31260 <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/31260.svg"></sub> (scripted-diff: Type-safe settings retrieval by ryanofsky)
    • #30343 <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/30343.svg"></sub> (wallet, logging: Replace WalletLogPrintf() with LogInfo() by ryanofsky)
    • #29256 <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/29256.svg"></sub> (log, refactor: Allow log macros to accept context arguments by ryanofsky)
    • #26022 <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/26022.svg"></sub> (Add util::ResultPtr class by ryanofsky)
    • #25665 <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/25665.svg"></sub> (refactor: Add util::Result failure types and ability to merge result values by ryanofsky)

    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.

    <!--5faf32d7da4f0f540f40219e4f7537a3-->

  5. DrahtBot added the label Needs rebase on Nov 18, 2026
  6. scripted-diff: Remove trailing newlines from one-line log messages
    The replacement skips log messages that contain: " or \
    This keeps the script simple and allows to handle the special cases
    manually.
    
    -BEGIN VERIFY SCRIPT-
    
     sed --in-place --regexp-extended 's/(Log(Debug|Error|Info|Trace|Warning)\([^"]*"[^"\\]*)\\n"([,)])/\1"\3/g' $(
         git grep -l --extended-regexp 'Log(Debug|Error|Info|Trace|Warning)\(' -- \
              './src' \
              ':(exclude)src/init.cpp' \
              ':(exclude)src/net.cpp' \
              ':(exclude)src/net_processing.cpp' \
              ':(exclude)src/blockencodings.cpp' \
              ':(exclude)src/netbase.cpp'
              # Some active files in other PRs are excluded due to code-conflicts
     )
    
    -END VERIFY SCRIPT-
    fafab6ed42
  7. maflcko force-pushed on Nov 18, 2026
  8. maflcko marked this as ready for review on Nov 18, 2026
  9. maflcko commented at 12:49 PM on November 18, 2026: member

    Ok, went ahead to exclude all reviewed pull requests in the scripted-diff. All remaining conflicts don't have any current review, or are waiting to have their reviews addressed in a push anyway.

    Edit: Also pushed a fix to remove the last embedded newlines. Can be tested with something like:

    diff --git a/src/logging.cpp b/src/logging.cpp
    index f5d184ba33..b2b68ba0c3 100644
    --- a/src/logging.cpp
    +++ b/src/logging.cpp
    @@ -343,2 +343,3 @@ namespace BCLog {
                 uint8_t ch = (uint8_t)ch_in;
    + Assert(ch!='\n');
                 if (ch >= 32 && ch != '\x7f') {
    
  10. DrahtBot removed the label Needs rebase on Nov 18, 2026
  11. log: Remove embedded newline from CTransaction::ToString
    The stringify function is only used for debugging and all the newline
    characters are turned into \x0a escapes.
    
    This is fine, but it would be better to just avoid the newlines in the
    first place and use a single line.
    fa885f4e0b

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: 2026-11-19 19:51 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me