Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Segfault running master on NetBSD #17379

Closed
fanquake opened this issue Nov 5, 2019 · 6 comments · Fixed by #22390
Closed

Segfault running master on NetBSD #17379

fanquake opened this issue Nov 5, 2019 · 6 comments · Fixed by #22390

Comments

@fanquake
Copy link
Member

fanquake commented Nov 5, 2019

While testing 17270 I noticed that master (bdda137) does not run on NetBSD. I assume this started after #17085 changed the fallback locale from C to C.UTF-8. There doesn't seem to be a C.UTF-8 locale on NetBSD.

src/bitcoind
terminate called after throwing an instance of 'std::runtime_error'
  what():  locale::facet::_S_create_c_locale name not valid
Abort trap (core dumped)

LC_ALL=C src/bitcoind works, LC_ALL=en_US.UTF-8 src/bitcoind does not.

locale
LANG=""
LC_CTYPE="en_US.UTF-8"
LC_COLLATE="C"
LC_TIME="C"
LC_NUMERIC="C"
LC_MONETARY="C"
LC_MESSAGES="C"
LC_ALL=""
@laanwj
Copy link
Member

laanwj commented Nov 5, 2019

This is an eternal source of problems. I wonder if we can get rid of all locale dependency at some point and just ignore the locale. Probably not as long as we use boost::filesystem … 😢

@practicalswift
Copy link
Contributor

practicalswift commented Nov 5, 2019

@laanwj

Setting aside the boost::filesystem the list of places where we're using locale dependent operations is quite short:

"src/bitcoin-tx.cpp.*stoul"
"src/bitcoin-tx.cpp.*trim_right"
"src/dbwrapper.cpp.*stoul"
"src/dbwrapper.cpp:.*vsnprintf"
"src/httprpc.cpp.*trim"
"src/init.cpp:.*atoi"
"src/qt/rpcconsole.cpp:.*atoi"
"src/rest.cpp:.*strtol"
"src/test/dbwrapper_tests.cpp:.*snprintf"
"src/torcontrol.cpp:.*atoi"
"src/torcontrol.cpp:.*strtol"
"src/util/strencodings.cpp:.*atoi"
"src/util/strencodings.cpp:.*strtol"
"src/util/strencodings.cpp:.*strtoul"
"src/util/strencodings.h:.*atoi"
"src/util/system.cpp:.*atoi"

Perhaps a "good first issue" could be created to tackle the list above? Some of them are really low hanging fruits suitable for new contributors.

@laanwj
Copy link
Member

laanwj commented Nov 5, 2019

I'm all for replacing those, but none of those functions crashes on having a wrong locale configured, that's very much a boost thing.

@kayront
Copy link

kayront commented Mar 21, 2021

FYI, after progress on #21485, bitcoind on SmartOS (Illumos) suffers from the same issue.

terminate called after throwing an instance of 'std::runtime_error'
  what():  locale::facet::_S_create_c_locale name not valid
Abort (core dumped)

@laanwj
Copy link
Member

laanwj commented Mar 22, 2021

@fanquake has been working on replacing boost::filesystem, which should get rid of this issue entirely, maybe help testing #20744.

@kayront
Copy link

kayront commented Mar 24, 2021

@fanquake do you need help testing those changes on SmartOS? I can try to compile your branch.

fanquake added a commit that referenced this issue Sep 9, 2021
fdd7144 system: skip trying to set the locale on NetBSD (fanquake)

Pull request description:

  Just treat it the same as the other BSDs.

  Fixes #17379.

ACKs for top commit:
  laanwj:
    Code review ACK fdd7144
  practicalswift:
    cr ACK fdd7144

Tree-SHA512: 5fe0a66f014279ad2683b548692a36af493377fb92d1f28b15dc4feef871190fe08ef40dcc4f5ba21a525fe365c42fb429fe4be0673a1e96db163af587c23204
sidhujag pushed a commit to syscoin/syscoin that referenced this issue Sep 11, 2021
fdd7144 system: skip trying to set the locale on NetBSD (fanquake)

Pull request description:

  Just treat it the same as the other BSDs.

  Fixes bitcoin#17379.

ACKs for top commit:
  laanwj:
    Code review ACK fdd7144
  practicalswift:
    cr ACK fdd7144

Tree-SHA512: 5fe0a66f014279ad2683b548692a36af493377fb92d1f28b15dc4feef871190fe08ef40dcc4f5ba21a525fe365c42fb429fe4be0673a1e96db163af587c23204
fanquake added a commit to fanquake/bitcoin that referenced this issue Oct 20, 2021
Just treat it the same as the other BSDs.

Fixes bitcoin#17379.

Github-Pull: bitcoin#22390
Rebased-From: fdd7144
fanquake added a commit to fanquake/bitcoin that referenced this issue Oct 21, 2021
Just treat it the same as the other BSDs.

Fixes bitcoin#17379.

Github-Pull: bitcoin#22390
Rebased-From: fdd7144
luke-jr pushed a commit to bitcoinknots/bitcoin that referenced this issue Dec 14, 2021
Just treat it the same as the other BSDs.

Fixes bitcoin#17379.

Github-Pull: bitcoin#22390
Rebased-From: fdd7144
fanquake added a commit to fanquake/bitcoin that referenced this issue Feb 14, 2022
Just treat it the same as the other BSDs.

Fixes bitcoin#17379.

Github-Pull: bitcoin#22390
Rebased-From: fdd7144
fanquake added a commit to fanquake/bitcoin that referenced this issue Feb 15, 2022
Just treat it the same as the other BSDs.

Fixes bitcoin#17379.

Github-Pull: bitcoin#22390
Rebased-From: fdd7144
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this issue Mar 13, 2022
fdd7144 system: skip trying to set the locale on NetBSD (fanquake)

Pull request description:

  Just treat it the same as the other BSDs.

  Fixes bitcoin#17379.

ACKs for top commit:
  laanwj:
    Code review ACK fdd7144
  practicalswift:
    cr ACK fdd7144

Tree-SHA512: 5fe0a66f014279ad2683b548692a36af493377fb92d1f28b15dc4feef871190fe08ef40dcc4f5ba21a525fe365c42fb429fe4be0673a1e96db163af587c23204
@bitcoin bitcoin locked and limited conversation to collaborators Oct 30, 2022
gades pushed a commit to cosanta/cosanta-core that referenced this issue Nov 16, 2023
fdd7144 system: skip trying to set the locale on NetBSD (fanquake)

Pull request description:

  Just treat it the same as the other BSDs.

  Fixes bitcoin#17379.

ACKs for top commit:
  laanwj:
    Code review ACK fdd7144
  practicalswift:
    cr ACK fdd7144

Tree-SHA512: 5fe0a66f014279ad2683b548692a36af493377fb92d1f28b15dc4feef871190fe08ef40dcc4f5ba21a525fe365c42fb429fe4be0673a1e96db163af587c23204
gades pushed a commit to piratecash/pirate that referenced this issue Dec 9, 2023
fdd7144 system: skip trying to set the locale on NetBSD (fanquake)

Pull request description:

  Just treat it the same as the other BSDs.

  Fixes bitcoin#17379.

ACKs for top commit:
  laanwj:
    Code review ACK fdd7144
  practicalswift:
    cr ACK fdd7144

Tree-SHA512: 5fe0a66f014279ad2683b548692a36af493377fb92d1f28b15dc4feef871190fe08ef40dcc4f5ba21a525fe365c42fb429fe4be0673a1e96db163af587c23204
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants
@laanwj @fanquake @practicalswift @kayront and others