Version 2 crashes on openSUSE KDE

You means @pjoyez :slight_smile:, who maybe knows what to ask for.

I can reproduce this crash in the latest svn by issuing LANG=it texmacs (or any other two-letter code it seems).

LANG=it_IT texmacs seems to work.

1 Like

Confirmed.

$ LANG=it texmacs
TeXmacs] With linked TrueType support
terminate called after throwing an instance of 'std::runtime_error'
  what():  locale::facet::_S_create_c_locale name not valid
[1]    6410 IOT instruction (core dumped)  LANG=it texmacs

But LANG=it_IT texmacs also doesn’t work for me.

$ LANG=it_IT texmacs                                                                               [11:42:41]
TeXmacs] With linked TrueType support
TeXmacs] system command failed: mktexpk --dpi 600 --bdpi 600 --mag 600/600 --destdir /home/huzf/.TeXmacs/fonts/pk ecss0
terminate called after throwing an instance of 'std::runtime_error'
  what():  locale::facet::_S_create_c_locale name not valid
[1]    6866 IOT instruction (core dumped)  LANG=it_IT texmacs

Errors remain even when I locale-gen corresponding it_IT.UTF-8 UTF-8.

My locale related environment variables do contain an it. Here are all the output of env:

AUDIODRIVER=pulseaudio
COLORFGBG=15;0
COLORTERM=truecolor
CONFIG_SITE=/usr/share/site/x86_64-pc-linux-gnu
CPU=x86_64
CSHEDIT=emacs
DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus
DEBUGINFOD_URLS=https://debuginfod.opensuse.org/
DESKTOP_SESSION=/usr/share/wayland-sessions/plasmawayland
DISPLAY=:1
FROM_HEADER=
G_BROKEN_FILENAMES=1
G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-15,CP1252
HISTSIZE=1111
HOME=/home/lorgar
HOST=localhost.localdomain
HOSTNAME=localhost.localdomain
HOSTTYPE=x86_64
INVOCATION_ID=e83c8115b9634dd49aa35af2950545fc
JAVA_BINDIR=/usr/lib64/jvm/java/bin
JAVA_HOME=/usr/lib64/jvm/java
JAVA_ROOT=/usr/lib64/jvm/java
JDK_HOME=/usr/lib64/jvm/java
JOURNAL_STREAM=8:31747
JRE_HOME=/usr/lib64/jvm/java
KDE_APPLICATIONS_AS_SCOPE=1
KDE_FULL_SESSION=true
KDE_SESSION_UID=1000
KDE_SESSION_VERSION=5
KGLOBALACCELD_PLATFORM=org.kde.kwin
KONSOLE_DBUS_SERVICE=:1.427
KONSOLE_DBUS_SESSION=/Sessions/1
KONSOLE_DBUS_WINDOW=/Windows/1
KONSOLE_VERSION=221203
LANG=en_US.UTF-8
LANGUAGE=en_GB:it
LC_COLLATE=en_GB.UTF-8
LC_CTYPE=en_GB.UTF-8
LC_MEASUREMENT=it_IT.UTF-8
LC_MESSAGES=en_GB.UTF-8
LC_MONETARY=it_IT.UTF-8
LC_NUMERIC=en_GB.UTF-8
LC_PAPER=A4
LC_TIME=en_GB.UTF-8
LESS=-M -I -R
LESSCLOSE=lessclose.sh %s %s
LESSKEY=/usr/etc/lesskey.bin
LESSOPEN=lessopen.sh %s
LESS_ADVANCED_PREPROCESSOR=no
LOGNAME=lorgar
MACHTYPE=x86_64
MAIL=/var/mail/lorgar
MANAGERPID=2142
MANPATH=/home/lorgar/.local/share/man:/usr/local/man:/usr/share/man
MANPATHISSET=yes
MINICOM=-c on
MORE=-sl
OLDPWD=/home/lorgar
OSTYPE=linux-gnu
PAGER=less
PAM_KWALLET5_LOGIN=/run/user/1000/kwallet5.socket
PATH=/home/lorgar/.local/lib/anaconda3/bin:/home/lorgar/.local/lib/anaconda3/condabin:/home/lorgar/.local/bin:/home/lorgar/bin:/usr/local/bin:/usr/bin:/bin:/home/lorgar/.dotnet/tools:/home/lorgar/.local/share/gem/ruby/3.2.0/bin
PLASMA_USE_QT_SCALING=1
PROFILEHOME=
PROFILEREAD=true
PWD=/home/lorgar
PYTHONSTARTUP=/etc/pythonstart
QEMU_AUDIO_DRV=pa
QSG_RENDER_LOOP=basic
QT_AUTO_SCREEN_SCALE_FACTOR=0
QT_WAYLAND_FORCE_DPI=96
SDK_HOME=/usr/lib64/jvm/java
SHELL=/usr/bin/zsh
SHELL_SESSION_ID=176cf3b9dd7d46d4a894a69a78826b4b
SYSTEMD_EXEC_PID=2181
TERM=xterm-256color
USER=lorgar
VENDOR=suse
WAYLAND_DISPLAY=wayland-0
WINDOWID=1
WINDOWMANAGER=/usr/bin/startplasma-x11
XAUTHLOCALHOSTNAME=localhost.localdomain
XAUTHORITY=/run/user/1000/xauth_tYTgDk
XCURSOR_SIZE=24
XCURSOR_THEME=breeze_cursors
XDG_ACTIVATION_TOKEN=kwin-148
XDG_CONFIG_DIRS=/home/lorgar/.config/kdedefaults:/etc/xdg:/usr/local/etc/xdg:/usr/etc/xdg
XDG_CURRENT_DESKTOP=KDE
XDG_DATA_DIRS=/home/lorgar/.local/share/flatpak/exports/share:/var/lib/flatpak/exports/share:/usr/local/share:/usr/share
XDG_RUNTIME_DIR=/run/user/1000
XDG_SEAT=seat0
XDG_SEAT_PATH=/org/freedesktop/DisplayManager/Seat0
XDG_SESSION_CLASS=user
XDG_SESSION_DESKTOP=KDE
XDG_SESSION_ID=4
XDG_SESSION_PATH=/org/freedesktop/DisplayManager/Session1
XDG_SESSION_TYPE=wayland
XDG_VTNR=2
XKB_DEFAULT_LAYOUT=it
XKB_DEFAULT_MODEL=pc105
XKB_DEFAULT_OPTIONS=terminate:ctrl_alt_bksp
XKEYSYMDB=/usr/X11R6/lib/X11/XKeysymDB
XNLSPATH=/usr/share/X11/nls
SHLVL=1
LS_COLORS=no=00:fi=00:di=01;34:ln=00;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=41;33;01:ex=00;32:*.cmd=00;32:*.exe=01;32:*.com=01;32:*.bat=01;32:*.btm=01;32:*.dll=01;32:*.tar=00;31:*.tgz=00;31:*.arc=00;31:*.arj=00;31:*.taz=00;31:*.lha=00;31:*.lz4=00;31:*.lzh=00;31:*.lzma=00;31:*.tlz=00;31:*.txz=00;31:*.tzo=00;31:*.t7z=00;31:*.zip=00;31:*.z=00;31:*.Z=00;31:*.dz=00;31:*.gz=00;31:*.lrz=00;31:*.lz=00;31:*.lzo=00;31:*.xz=00;31:*.zst=00;31:*.tzst=00;31:*.bz2=00;31:*.bz=00;31:*.tbz=00;31:*.tbz2=00;31:*.tz=00;31:*.deb=00;31:*.rpm=00;31:*.jar=00;31:*.war=00;31:*.ear=00;31:*.sar=00;31:*.rar=00;31:*.alz=00;31:*.ace=00;31:*.zoo=00;31:*.cpio=00;31:*.7z=00;31:*.rz=00;31:*.cab=00;31:*.wim=00;31:*.swm=00;31:*.dwm=00;31:*.esd=00;31:*.asf=01;35:*.avi=01;35:*.bmp=01;35:*.cgm=01;35:*.dl=01;35:*.emf=01;35:*.flc=01;35:*.fli=01;35:*.flv=01;35:*.gif=01;35:*.gl=01;35:*.jpeg=01;35:*.jpg=01;35:*.m2v=01;35:*.m4v=01;35:*.mjpeg=01;35:*.mjpg=01;35:*.mkv=01;35:*.mng=01;35:*.mov=01;35:*.mp4=01;35:*.mp4v=01;35:*.mpeg=01;35:*.mpg=01;35:*.nuv=01;35:*.ogm=01;35:*.pbm=01;35:*.pcx=01;35:*.pgm=01;35:*.png=01;35:*.ppm=01;35:*.qt=01;35:*.rm=01;35:*.rmvb=01;35:*.svg=01;35:*.svgz=01;35:*.tga=01;35:*.tif=01;35:*.tiff=01;35:*.vob=01;35:*.webm=01;35:*.webp=01;35:*.wmv=01;35:*.xbm=01;35:*.xcf=01;35:*.xpm=01;35:*.xwd=01;35:*.yuv=01;35:*.ogv=01;35:*.ogx=01;35:*.aiff=00;32:*.ape=00;32:*.aac=00;32:*.au=00;32:*.flac=00;32:*.m4a=00;32:*.mid=00;32:*.midi=00;32:*.mka=00;32:*.mp3=00;32:*.mpc=00;32:*.ogg=00;32:*.ra=00;32:*.voc=00;32:*.wav=00;32:*.wma=00;32:*.wv=00;32:*.oga=00;32:*.opus=00;32:*.spx=00;32:*.xspf=00;32:
LS_OPTIONS=-N --color=tty -T 0
GPG_TTY=/dev/pts/2
XDG_CACHE_HOME=/home/lorgar/.cache
XDG_CONFIG_HOME=/home/lorgar/.config
XDG_DATA_HOME=/home/lorgar/.local/share
XDG_STATE_HOME=/home/lorgar/.local/state
P9K_SSH=0
_P9K_SSH_TTY=/dev/pts/2
_ZL_FZF_FLAG=-e
_ZL_MATCH_MODE=1
CONDA_EXE=/home/lorgar/.local/lib/anaconda3/bin/conda
_CE_M=
_CE_CONDA=
CONDA_PYTHON_EXE=/home/lorgar/.local/lib/anaconda3/bin/python
CONDA_SHLVL=1
CONDA_PREFIX=/home/lorgar/.local/lib/anaconda3
CONDA_DEFAULT_ENV=base
CONDA_PROMPT_MODIFIER=(base)
P9K_TTY=old
_P9K_TTY=/dev/pts/2
_=/usr/bin/env

Thanks for sharing this. Turns out in your case LC_PAPER is the culprit. Doing LC_PAPER=A4 texmacs also crashes. I don’t quite understand how this works, as LC_PAPER isn’t used anywhere in TeXmacs. According to gdb the crash occurs in get_locale_charset, which calls std::locale::global. Perhaps this function doesn’t like certain values of locale environment variables…

LC_PAPER=A4 itself isn’t a valid locale setting. We can check and make sure variables of each of locale categories valid.
https://man7.org/linux/man-pages/man5/locale.5.html

In 2.1.1 too:

LC_PAPER=A4 texmacs

crashes at opening of the welcome document with the errors

Qt has caught an exception thrown from an event handler. Throwing
exceptions from an event handler is not supported in Qt. You must
reimplement QApplication::notify() and catch all exceptions there.

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

Try Mogan v1.1.1, see https://mogan.app/guide/Install.html#opensuse-obs

If I remember correctly, this is a bug of 2.1.1. Do you have issues with OpenSUSE builds in https://download.opensuse.org/repositories/home:/slowphil:/texmacs-devel/ which are 2.1.2?

Mogan crashes on this as well.

Yes, it crashes too. I will fix it as soon as possible.

$ LC_PAPER=A4 /usr/bin/mogan 
Benchmark 1
832040
Time: 10
Booting TeXmacs kernel functionality
time: 67
memory: 17691560 bytes
------------------------------------------------------
Initialization done
------------------------------------------------------
Benchmark 2
832040
Time: 103
------------------------------------------------------
------------------------------------------------------
Forcing delayed loads
time: 409
memory: 17395376 bytes
------------------------------------------------------
TeXmacs] With linked TrueType support
terminate called after throwing an instance of 'std::runtime_error'
  what():  locale::facet::_S_create_c_locale name not valid
[1]    1117551 IOT instruction (core dumped)  LC_PAPER=A4 /usr/bin/mogan

Here is the ticket: https://gitee.com/XmacsLabs/mogan/issues/I6SB6F

I will release Mogan v1.1.2 rc5 with this bug fixed as soon as possible.

1 Like

I found a nice rant on locales. A broken concept, as we experience painfully in TeXmacs. http://www.call-with-current-continuation.org/rants/locale.txt

1 Like

Here is the fix: https://github.com/XmacsLabs/mogan/pull/557

It takes me about 30 minutes to create the fix.

Mogan v1.1.2 rc5 with the fix is available on Github now.

That is using UTF-8 indifferently, if I understand correctly, thus I am not sure whether it should be like this.

I’m not sure too. I think for Mogan, I can make the decision. But I don’t know why non-UTF 8 is allowed in GNU TeXmacs.

I am not sure whether current environments (such as Windows) are using UTF-8 by default (which should not be the case 30 years ago when TeXmacs was initially programmed). For TeXmacs, I guess it better to use an exception handler to set UTF-8 as fallback.

It’s only by the end of Windows 10 that microsoft made available utf-8 encoding in the OS. So, no, utf-8 is not the default on windows (at least not on all the machines out there). Moreover, AFAIU a program still has a hard time knowing what 8-bit encoding Windows might be using (all the old 8 bit encodings -such as CP-1252- are still available besides utf-8). Actually, unlike other OSes, windows’ code is written for utf-16 (aka wide chars) strings, and for the moment it seems preferable to access it this way.

In practice, TeXmacs’ interface with the OS uses 8-bit (“narrow”) strings, assuming utf-8 encoding. On Windows, a 2-way translation layer adapts between narrow and wide strings (The only portion that escapes this translation is when guile directly accesses OS strings such as environment variables as narrow strings, which can cause issues).

Yes, boost nowide can help solve the problem. And in this case, we have hard coded to UTF-8 on all os except GNU Linux in GNU TeXmacs. I just hard coded it to UTF-8 on GNU/Linux to avoid the crash.

Mogan Editor v1.1.2 is available on OpenSUSE with this bug fixed:
https://mogan.app/guide/Install.html#opensuse-obs