Skip to content

Conversation

@hebasto
Copy link
Member

@hebasto hebasto commented May 10, 2020

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

@hebasto
Copy link
Member Author

hebasto commented May 10, 2020

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

@hebasto
Copy link
Member Author

hebasto commented May 10, 2020

Updated 1511dd0 -> 6fad0cf (pr18927.02 -> pr18927.03, diff):

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

@DrahtBot
Copy link
Contributor

DrahtBot commented May 10, 2020

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

Conflicts

No conflicts as of last run.

@hebasto
Copy link
Member Author

hebasto commented May 10, 2020

Updated 6fad0cf -> 4067da9 (pr18927.03 -> pr18927.04, diff):

  • more uses of bilingual_str::empty()

@hebasto
Copy link
Member Author

hebasto commented May 14, 2020

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

@maflcko
Copy link
Member

maflcko commented Jun 4, 2020

Needs rebase

hebasto added 3 commits June 4, 2020 18:32
Since bilingual_str type is fully supported, the MSG_NOPREFIX flag is no
longer needed.
@hebasto
Copy link
Member Author

hebasto commented Jun 4, 2020

@MarcoFalke

Needs rebase

Rebased c5e34e5 -> d924f2a (pr18927.05 -> pr18927.07).

@hebasto hebasto closed this Jun 6, 2020
@hebasto hebasto reopened this Jun 6, 2020
@hebasto hebasto closed this Jun 6, 2020
@hebasto hebasto reopened this Jun 6, 2020
uiInterface.ThreadSafeMessageBox(userMessage, "", CClientUIInterface::MSG_ERROR);
} else {
uiInterface.ThreadSafeMessageBox(_("Error: A fatal internal error occurred, see debug.log for details"), "", CClientUIInterface::MSG_ERROR | CClientUIInterface::MSG_NOPREFIX);
uiInterface.ThreadSafeMessageBox(_("A fatal internal error occurred, see debug.log for details"), "", CClientUIInterface::MSG_ERROR);
Copy link
Member

Choose a reason for hiding this comment

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

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;

Copy link
Member Author

Choose a reason for hiding this comment

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

Now that the signature is identical to InitError...

Which function signature do you mean?

Copy link
Member Author

Choose a reason for hiding this comment

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

uiInterface.ThreadSafeMessageBox(userMessage, "", CClientUIInterface::MSG_ERROR);
} else {
uiInterface.ThreadSafeMessageBox(_("Error: A fatal internal error occurred, see debug.log for details"), "", CClientUIInterface::MSG_ERROR | CClientUIInterface::MSG_NOPREFIX);
uiInterface.ThreadSafeMessageBox(_("A fatal internal error occurred, see debug.log for details"), "", CClientUIInterface::MSG_ERROR);
Copy link
Member

Choose a reason for hiding this comment

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

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

Suggested change
uiInterface.ThreadSafeMessageBox(_("A fatal internal error occurred, see debug.log for details"), "", CClientUIInterface::MSG_ERROR);
AbortError(_("A fatal internal error occurred, see debug.log for details"));

Copy link
Member Author

Choose a reason for hiding this comment

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

@hebasto
Copy link
Member Author

hebasto commented Jun 8, 2020

@hebasto hebasto closed this Jun 9, 2020
@hebasto hebasto reopened this Jun 9, 2020
@hebasto hebasto closed this Jun 9, 2020
@hebasto hebasto reopened this Jun 9, 2020
@maflcko
Copy link
Member

maflcko commented Jun 9, 2020

ACK 5527be0 👟

Show signature and timestamp

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 -

@maflcko maflcko merged commit 4b30c41 into bitcoin:master Jun 16, 2020
@hebasto hebasto deleted the 200510-abort branch June 16, 2020 13:55
maflcko pushed a commit that referenced this pull request Jun 17, 2020
fa02b47 refactor: Use AbortError in FatalError (MarcoFalke)

Pull request description:

  `FatalError` has been copied from `AbortNode`, so the two should use the same style to avoid confusion.

  Follow-up to #18927

ACKs for top commit:
  hebasto:
    ACK fa02b47, I have reviewed the code and it looks OK, I agree it can be merged.

Tree-SHA512: 2cf6d18a6ffb5c2e5cf54f0a072a7cef6dc7e924152b2fee44e6ff2c6c53bad962afd364eda30d8a73883d656429ea68391090e6a27057e69eaefd7c4dad0a33
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request Jul 7, 2020
5527be0 refactor: Add AbortError alias (Hennadii Stepanov)
d924f2a Drop MSG_NOPREFIX flag (Hennadii Stepanov)
083daf7 Pass bilingual_str argument to AbortNode() (Hennadii Stepanov)
d1cca12 refactor: Use bilingual_str::empty() (Hennadii Stepanov)

Pull request description:

  This PR is a [followup](bitcoin#16218 (comment)) of bitcoin#16224, and it adds `bilingual_str` type argument support to the `AbortNode()` functions.

ACKs for top commit:
  MarcoFalke:
    ACK 5527be0 👟

Tree-SHA512: bf8b15b14912b1f672e6e588fffa1e6eb6f00b4b23d15d0ced7f18fbdf76919244427feb7217007fe29617049308e13def893a03a87358db819cca9692f59905
Fabcien pushed a commit to Bitcoin-ABC/bitcoin-abc that referenced this pull request Dec 11, 2020
Summary:
```
This PR is a followup of #16224, and it adds bilingual_str type argument
support to the AbortNode() functions.
```

Backport of core [[bitcoin/bitcoin#18927 | PR18927]].

Depends on D8648.

Test Plan:
  ninja all check-all

Reviewers: #bitcoin_abc, jasonbcox

Reviewed By: #bitcoin_abc, jasonbcox

Differential Revision: https://reviews.bitcoinabc.org/D8649
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Feb 15, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants