I have written a dynamic module which provides a function realpath-truename similar to file-truename, but which uses canonicalize_file_name(3) internally and which doesn't respect file name handlers. It is hosted at the following URL: https://gitlab.com/basil-conto/realpath Repeatedly calling realpath-truename on a directory name in an Emacs started with --module-assertions segfaults in a call to file-name-as-directory. The precise recipe I am using is the following: 0. git clone https://gitlab.com/basil-conto/realpath.git 1. cd realpath 2. make 3. cd /path/to/emacs/src 4. gdb emacs 5. set logging on 6. run -Q --module-assertions 7. (progn (module-load "/path/to/realpath.so") (dotimes (_ 1000) (realpath-truename user-emacs-directory))) C-j 9. bt full I attach the corresponding GDB log. I am not confident that the module is written properly, in particular w.r.t. nonlocal exits, but I don't see what, if anything, I am doing wrong, so any help would be greatly appreciated. Thanks, -- Basil In GNU Emacs 26.1.92 (build 1, x86_64-pc-linux-gnu, X toolkit, Xaw3d scroll bars) of 2019-02-25 built on thunk Repository revision: 1dff09739346037a588a3b9290800c09a9b3409a Windowing system distributor 'The X.Org Foundation', version 11.0.12003000 System Description: Debian GNU/Linux buster/sid Configured using: 'configure 'CC=ccache gcc' 'CFLAGS=-O0 -g3 -ggdb -gdwarf-4 -pipe' --config-cache --prefix=/home/blc/.local --program-suffix=26 --enable-checking=yes,glyphs --enable-check-lisp-object-type --with-mailutils --with-x-toolkit=lucid --with-modules --with-file-notification=yes --with-x' Configured features: XAW3D XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GSETTINGS GLIB NOTIFY ACL LIBSELINUX GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB TOOLKIT_SCROLL_BARS LUCID X11 XDBE XIM MODULES THREADS LIBSYSTEMD LCMS2 Important settings: value of $LANG: en_IE.UTF-8 locale-coding-system: utf-8-unix