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:

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

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

    0$ tail -4 ~/.bitcoin/testnet3/debug.log 
    12020-05-10T09:55:41Z [shutoff] *** Disk space is too low!
    22020-05-10T09:55:41Z [shutoff] Error: Disk space is too low!
    32020-05-10T09:55:41Z [shutoff] ForceFlushStateToDisk: failed to flush state (Disk space is too low!)
    42020-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:
    0        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: member

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

    Conflicts

    No conflicts as of last run.

  11. hebasto force-pushed on May 10, 2020
  12. 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()
  13. DrahtBot added the label Needs rebase on May 13, 2020
  14. hebasto force-pushed on May 14, 2020
  15. hebasto commented at 4:53 am on May 14, 2020: member
    Rebased 4067da94bbf24c6b2b9d45808ae33dc9e7b9d6d4 -> c5e34e58801654028e3039188e2882e25df594a4 (pr18927.04 -> pr18927.05) due to the conflict with #18922.
  16. DrahtBot removed the label Needs rebase on May 14, 2020
  17. MarcoFalke commented at 3:26 pm on June 4, 2020: member
    Needs rebase
  18. hebasto force-pushed on Jun 4, 2020
  19. refactor: Use bilingual_str::empty() d1cca129b4
  20. Pass bilingual_str argument to AbortNode() 083daf7fba
  21. Drop MSG_NOPREFIX flag
    Since bilingual_str type is fully supported, the MSG_NOPREFIX flag is no
    longer needed.
    d924f2a596
  22. hebasto force-pushed on Jun 4, 2020
  23. hebasto commented at 3:34 pm on June 4, 2020: member

    @MarcoFalke

    Needs rebase

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

  24. hebasto closed this on Jun 6, 2020

  25. hebasto reopened this on Jun 6, 2020

  26. hebasto closed this on Jun 6, 2020

  27. hebasto reopened this on Jun 6, 2020

  28. 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?

    0constexpr 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?

    0        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:
  29. refactor: Add AbortError alias 5527be0627
  30. hebasto commented at 3:40 pm on June 8, 2020: member

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

  31. hebasto closed this on Jun 9, 2020

  32. hebasto reopened this on Jun 9, 2020

  33. hebasto closed this on Jun 9, 2020

  34. hebasto reopened this on Jun 9, 2020

  35. MarcoFalke commented at 9:51 pm on June 9, 2020: member

    ACK 5527be06277647dffe7cda587c4bbfbec2a5c8ca 👟

    Signature:

     0-----BEGIN PGP SIGNED MESSAGE-----
     1Hash: SHA512
     2
     3ACK 5527be06277647dffe7cda587c4bbfbec2a5c8ca 👟
     4-----BEGIN PGP SIGNATURE-----
     5
     6iQGzBAEBCgAdFiEE+rVPoUahrI9sLGYTzit1aX5ppUgFAlwqrYAACgkQzit1aX5p
     7pUi2JQwAwwhgq56EfM6hpOzafEWzJZZinddkJuSLzeiDHy1b7SUgQVooQWpqBqiJ
     8KaI87+DzkSGBOu0vqoy2DjuuFcyLpHSdOQ8fAJFOYbfxbx6M37bY7Hch+eeYivjt
     9k5gPNiVBPzz6h68fxgPNshwHVR6qWzI5RgOe8/GsYrPbGjh42ueYgVZcHdxgqHEP
    10vjHJzkU31LW3Ntqg1P6VuYt8uxGvXiejQOjACs9FxWgtemZMRnvHSrUIGfWNyRPt
    11G9Y2ClnpZ5rhy6CW3FlyCPEtY6GofbQ9AUEUo/R6Dxv4xVk9xBw1wJ0vwV7q/clW
    12OjTQgr8LK8puSiGHAhc3ee+3n+hsDmIuzfY4xLv3E4Bqe7/jbvlyNzQe/UfAiGSK
    138PqZp0jk+ZG87qZuwNKYytvXDPNOAorN1SO8bIWUlt0cTlfKfQcdHnHAQYMdUxkl
    14Xsu5LcmEgyuerJ7pPQCQ5gVYpCScCNjzwvOIKdkggY1zBJNB2YkdP3aKMYU+ezdL
    15UbthjJ2Q
    16=zsXO
    17-----END PGP SIGNATURE-----
    

    Timestamp of file with hash c4a6904cff17d24ba7d628d970246ed0ce8d86a0caa4d68859d702cd905c7c6a -

  36. MarcoFalke merged this on Jun 16, 2020
  37. MarcoFalke closed this on Jun 16, 2020

  38. hebasto deleted the branch on Jun 16, 2020
  39. MarcoFalke referenced this in commit 39bd9ddb87 on Jun 17, 2020
  40. sidhujag referenced this in commit f3dc64f18d on Jul 7, 2020
  41. Fabcien referenced this in commit 1ec7ba8346 on Dec 11, 2020
  42. DrahtBot 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: 2024-07-01 13:12 UTC

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