#1012457 calibre: segfault on startup for different locales

#1012457#5
Date:
2022-06-07 17:28:10 UTC
From:
To:
  If LC_CTYPE=ro_RO then calibre segfaults on startup
  If LC_CTYPE is unset (or LC_ALL=C) then calibre starts and works normally.

  The culprit seems to be a Python script in oeb/polish
  I've attached an strace of the crash.

The offcial calibre version 5.43.0 does not segfault on the same machine.
This is a debian specific issue.

#1012457#10
Date:
2022-06-08 18:01:30 UTC
From:
To:
-- 
								Regards,
								Emil

#1012457#15
Date:
2022-06-08 18:22:03 UTC
From:
To:
It also reproduce with other non-UTF-8 locales.

1. Edit "/etc/locale.gen" and setup non-UTF-8 locale
2. Use non-UTF-8 locale for Calibre
      $ LANG=ja_JP.EUC-JP calibre
      $ LANG=en_US.ISO-8859-15 calibre
3. Segmentation fault

Current Linux system recommends UTF-8 based locale.
"ro_RO" uses legacy encoding "ISO-8859-2" and it's not recommended for
modern Linux systems.
Use UTF-8 based ro_RO locale "ro_RO.UTF-8" to avoids this bug.

1. Edit "/etc/locale.gen" and adds "ro_RO.UTF-8" locale support.
    Use "dpkg-reconfigure locales" command for easy setup.
    It also drops legacy locale support.
     # dpkg-reconfigure locales
2. Use "ro_RO.UTF-8" for Calibre
     $ LC_CTYPE=ro_RO.UTF-8 calibre
     $ LANG=ro_RO.UTF-8 calibre
3. Works well.

Official calibre uses embedded Python, and not uses system Python.
Embedded Python uses limited locale support, and this avoids locale problems.

#1012457#20
Date:
2022-07-15 12:47:59 UTC
From:
To:
Using  UTF-8 based locale might fixes this problem.