Pass bilingual_str argument to AbortNode() #18927

pull hebasto wants to merge 4 commits into bitcoin:master from hebasto:200510-abort changing 5 files +28 −38
  1. hebasto commented at 10:12 AM on May 10, 2020: member

    This PR is a followup of #16224, and it adds bilingual_str type argument support to the AbortNode() functions.

  2. hebasto commented at 10:15 AM on May 10, 2020: member

    This PR could be tested with a patch similar to the following:

    diff --git a/src/qt/locale/bitcoin_nl.ts b/src/qt/locale/bitcoin_nl.ts
    index 73c18cd4d..13bda2db2 100644
    --- a/src/qt/locale/bitcoin_nl.ts
    +++ b/src/qt/locale/bitcoin_nl.ts
    @@ -3524,8 +3524,8 @@ Notitie: Omdat de vergoeding per byte wordt gerekend, zal een vergoeding van "10
             <translation>P2P-adressen aan het laden...</translation>
         </message>
         <message>
    -        <source>Error: Disk space is too low!</source>
    -        <translation>Error: Opslagruimte te weinig!</translation>
    +        <source>Disk space is too low!</source>
    +        <translation>Opslagruimte te weinig!</translation>
         </message>
         <message>
             <source>Loading banlist...</source>
    diff --git a/src/validation.cpp b/src/validation.cpp
    index 9034f66e9..c9539c325 100644
    --- a/src/validation.cpp
    +++ b/src/validation.cpp
    @@ -2317,7 +2317,7 @@ bool CChainState::FlushStateToDisk(
             // Write blocks and block index to disk.
             if (fDoFullFlush || fPeriodicWrite) {
                 // Depend on nMinDiskSpace to ensure we can write block index
    -            if (!CheckDiskSpace(GetBlocksDir())) {
    +            if (CheckDiskSpace(GetBlocksDir())) {
                     return AbortNode(state, "Disk space is too low!", _("Disk space is too low!"));
                 }
                 {
    
    $ ./src/qt/bitcoin-qt -testnet -lang=nl
    Error: Disk space is too low!
    Error: Disk space is too low!
    Error: Disk space is too low!
    

    Screenshot from 2020-05-10 12-55-36

    $ tail -4 ~/.bitcoin/testnet3/debug.log 
    2020-05-10T09:55:41Z [shutoff] *** Disk space is too low!
    2020-05-10T09:55:41Z [shutoff] Error: Disk space is too low!
    2020-05-10T09:55:41Z [shutoff] ForceFlushStateToDisk: failed to flush state (Disk space is too low!)
    2020-05-10T09:55:41Z [shutoff] Shutdown: done
    
  3. hebasto force-pushed on May 10, 2020
  4. DrahtBot added the label GUI on May 10, 2020
  5. DrahtBot added the label Utils/log/libs on May 10, 2020
  6. DrahtBot added the label Validation on May 10, 2020
  7. in src/util/translation.h:22 in 1511dd0b1a outdated
      15 | @@ -16,6 +16,11 @@
      16 |  struct bilingual_str {
      17 |      std::string original;
      18 |      std::string translated;
      19 | +
      20 | +    bool empty() const
      21 | +    {
      22 | +        return original.empty() && translated.empty();
    


    MarcoFalke commented at 12:23 PM on May 10, 2020:
            return original.empty();
    

    I think translators should not be able to influence executions paths by blanking messages


    hebasto commented at 12:26 PM on May 10, 2020:

    I think translators should not be able to influence executions paths by blanking messages

    Sure!


    hebasto commented at 12:32 PM on May 10, 2020:
  8. hebasto force-pushed on May 10, 2020
  9. hebasto commented at 12:32 PM on May 10, 2020: member

    Updated 1511dd0b1a44727be652b61256899b0ce8024178 -> 6fad0cf7a9b9492e92f6331db4cd6fcd14977d5e (pr18927.02 -> pr18927.03, diff):

    I think translators should not be able to influence executions paths by blanking messages

  10. DrahtBot commented at 1:37 PM on May 10, 2020: contributor

    <!--e57a25ab6845829454e8d69fc972939a-->

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

    <!--174a7506f384e20aa4161008e828411d-->

    Conflicts

    No conflicts as of last run.

  11. DrahtBot cross-referenced this on May 10, 2020 from issue gui: Do not translate InitWarning messages in debug.log by hebasto
  12. hebasto force-pushed on May 10, 2020
  13. hebasto commented at 2:08 PM on May 10, 2020: member

    Updated 6fad0cf7a9b9492e92f6331db4cd6fcd14977d5e -> 4067da94bbf24c6b2b9d45808ae33dc9e7b9d6d4 (pr18927.03 -> pr18927.04, diff):

    • more uses of bilingual_str::empty()
  14. DrahtBot added the label Needs rebase on May 13, 2020
  15. hebasto force-pushed on May 14, 2020
  16. hebasto commented at 4:53 AM on May 14, 2020: member

    Rebased 4067da94bbf24c6b2b9d45808ae33dc9e7b9d6d4 -> c5e34e58801654028e3039188e2882e25df594a4 (pr18927.04 -> pr18927.05) due to the conflict with #18922.

  17. DrahtBot removed the label Needs rebase on May 14, 2020
  18. fanquake cross-referenced this on May 27, 2020 from issue doc: Separate repository for the gui by MarcoFalke
  19. MarcoFalke commented at 3:26 PM on June 4, 2020: member

    Needs rebase

  20. hebasto force-pushed on Jun 4, 2020
  21. refactor: Use bilingual_str::empty() d1cca129b4
  22. Pass bilingual_str argument to AbortNode() 083daf7fba
  23. Drop MSG_NOPREFIX flag
    Since bilingual_str type is fully supported, the MSG_NOPREFIX flag is no
    longer needed.
    d924f2a596
  24. hebasto force-pushed on Jun 4, 2020
  25. hebasto commented at 3:34 PM on June 4, 2020: member

    @MarcoFalke

    Needs rebase

    Rebased c5e34e58801654028e3039188e2882e25df594a4 -> d924f2a596c8f37deb2dd94069c578244823c31f (pr18927.05 -> pr18927.07).

  26. hebasto closed this on Jun 6, 2020

  27. hebasto reopened this on Jun 6, 2020

  28. hebasto closed this on Jun 6, 2020

  29. hebasto reopened this on Jun 6, 2020

  30. in src/validation.cpp:1665 in d924f2a596 outdated
    1664 |      if (!userMessage.empty()) {
    1665 | -        uiInterface.ThreadSafeMessageBox(Untranslated(userMessage), "", CClientUIInterface::MSG_ERROR | prefix);
    1666 | +        uiInterface.ThreadSafeMessageBox(userMessage, "", CClientUIInterface::MSG_ERROR);
    1667 |      } else {
    1668 | -        uiInterface.ThreadSafeMessageBox(_("Error: A fatal internal error occurred, see debug.log for details"), "", CClientUIInterface::MSG_ERROR | CClientUIInterface::MSG_NOPREFIX);
    1669 | +        uiInterface.ThreadSafeMessageBox(_("A fatal internal error occurred, see debug.log for details"), "", CClientUIInterface::MSG_ERROR);
    


    MarcoFalke commented at 12:24 PM on June 7, 2020:

    Now that the signature is identical to InitError, the call could be simplified to just a call to AbortError, which would be a new alias for InitError?

    constexpr auto AbortError = InitError;
    

    hebasto commented at 6:32 AM on June 8, 2020:

    Now that the signature is identical to InitError...

    Which function signature do you mean?


    MarcoFalke commented at 10:46 AM on June 8, 2020:

    All that InitError does is pass a translated string into ThreadSafeMessageBox, so this line could be replaced by a simple call to InitError, no?

            AbortError(_("A fatal internal error occurred, see debug.log for details"));
    

    hebasto commented at 3:40 PM on June 8, 2020:

    hebasto commented at 3:40 PM on June 8, 2020:
  31. refactor: Add AbortError alias 5527be0627
  32. hebasto commented at 3:40 PM on June 8, 2020: member

    Updated d924f2a596c8f37deb2dd94069c578244823c31f -> 5527be06277647dffe7cda587c4bbfbec2a5c8ca (pr18927.07 -> pr18927.08, diff):

  33. hebasto closed this on Jun 9, 2020

  34. hebasto reopened this on Jun 9, 2020

  35. hebasto closed this on Jun 9, 2020

  36. hebasto reopened this on Jun 9, 2020

  37. MarcoFalke commented at 9:51 PM on June 9, 2020: member

    ACK 5527be06277647dffe7cda587c4bbfbec2a5c8ca 👟

    <details><summary>Show signature and timestamp</summary>

    Signature:

    -----BEGIN PGP SIGNED MESSAGE-----
    Hash: SHA512
    
    ACK 5527be06277647dffe7cda587c4bbfbec2a5c8ca 👟
    -----BEGIN PGP SIGNATURE-----
    
    iQGzBAEBCgAdFiEE+rVPoUahrI9sLGYTzit1aX5ppUgFAlwqrYAACgkQzit1aX5p
    pUi2JQwAwwhgq56EfM6hpOzafEWzJZZinddkJuSLzeiDHy1b7SUgQVooQWpqBqiJ
    KaI87+DzkSGBOu0vqoy2DjuuFcyLpHSdOQ8fAJFOYbfxbx6M37bY7Hch+eeYivjt
    k5gPNiVBPzz6h68fxgPNshwHVR6qWzI5RgOe8/GsYrPbGjh42ueYgVZcHdxgqHEP
    vjHJzkU31LW3Ntqg1P6VuYt8uxGvXiejQOjACs9FxWgtemZMRnvHSrUIGfWNyRPt
    G9Y2ClnpZ5rhy6CW3FlyCPEtY6GofbQ9AUEUo/R6Dxv4xVk9xBw1wJ0vwV7q/clW
    OjTQgr8LK8puSiGHAhc3ee+3n+hsDmIuzfY4xLv3E4Bqe7/jbvlyNzQe/UfAiGSK
    8PqZp0jk+ZG87qZuwNKYytvXDPNOAorN1SO8bIWUlt0cTlfKfQcdHnHAQYMdUxkl
    Xsu5LcmEgyuerJ7pPQCQ5gVYpCScCNjzwvOIKdkggY1zBJNB2YkdP3aKMYU+ezdL
    UbthjJ2Q
    =zsXO
    -----END PGP SIGNATURE-----
    

    Timestamp of file with hash c4a6904cff17d24ba7d628d970246ed0ce8d86a0caa4d68859d702cd905c7c6a -

    </details>

  38. hebasto cross-referenced this on Jun 10, 2020 from issue gui: Translated messages should not be written to debug log (InitError, InitWarning, ...) by MarcoFalke
  39. MarcoFalke merged this on Jun 16, 2020
  40. MarcoFalke closed this on Jun 16, 2020

  41. hebasto deleted the branch on Jun 16, 2020
  42. MarcoFalke cross-referenced this on Jun 16, 2020 from issue refactor: Use AbortError in FatalError by MarcoFalke
  43. MarcoFalke referenced this in commit 39bd9ddb87 on Jun 17, 2020
  44. sidhujag referenced this in commit f3dc64f18d on Jul 7, 2020
  45. Fabcien referenced this in commit 1ec7ba8346 on Dec 11, 2020
  46. bitcoin locked this on Feb 15, 2022

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-05-20 06:54 UTC