Subject: bug#78904: 30.1; in a long directory pathname, "Cannot write backup file" is output with a spurious blank line

From: Vincent Lefevre <[email-masked]>
Date: Thu, 26 Jun 2025 10:45:42 +0200

1. mkdir a-very-very-very-very-very-very-long-directory-pathname
2. cd a-very-very-very-very-very-very-long-directory-pathname
3. touch foo
4. emacs -Q --eval '(defun find-backup-file-name (fn) (list "/"))' foo
5. Modify the buffer.
6. Save with C-x C-s

The following is output:

Cannot write backup file; backing up in ~/.emacs.d/%backup%~

but with a spurious blank line below, i.e. the echo area takes 2 lines
instead of a single one.

Note: it seems that what matters is the length of the absolute
directory pathname. In my case, this is

  /home/vinc17/a-very-very-very-very-very-very-long-directory-pathname

This occurs whether Emacs uses its own interface or runs in a terminal.

In GNU Emacs 30.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.49,
 cairo version 1.18.4) of 2025-03-30, modified by Debian built on sbuild
Windowing system distributor 'The X.Org Foundation', version 11.0.12101016
System Description: Debian GNU/Linux 13 (trixie)

Configured using:
 'configure --build x86_64-linux-gnu --prefix=/usr
 --sharedstatedir=/var/lib --libexecdir=/usr/libexec
 --localstatedir=/var/lib --infodir=/usr/share/info
 --mandir=/usr/share/man --with-libsystemd --with-pop=yes
 --enable-locallisppath=/etc/emacs:/usr/local/share/emacs/30.1/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/30.1/site-lisp:/usr/share/emacs/site-lisp
 --with-sound=alsa --without-gconf --with-mailutils --build
 x86_64-linux-gnu --prefix=/usr --sharedstatedir=/var/lib
 --libexecdir=/usr/libexec --localstatedir=/var/lib
 --infodir=/usr/share/info --mandir=/usr/share/man --with-libsystemd
 --with-pop=yes
 --enable-locallisppath=/etc/emacs:/usr/local/share/emacs/30.1/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/30.1/site-lisp:/usr/share/emacs/site-lisp
 --with-sound=alsa --without-gconf --with-mailutils --with-cairo
 --with-x=yes --with-x-toolkit=gtk3 --with-toolkit-scroll-bars
 'CFLAGS=-g -O2 -Werror=implicit-function-declaration
 -ffile-prefix-map=/build/reproducible-path/emacs-30.1+1=.
 -fstack-protector-strong -fstack-clash-protection -Wformat
 -Werror=format-security -fcf-protection -Wall' 'CPPFLAGS=-Wdate-time
 -D_FORTIFY_SOURCE=2' LDFLAGS=-Wl,-z,relro'

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG
LCMS2 LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 M17N_FLT MODULES NATIVE_COMP
NOTIFY INOTIFY PDUMPER PNG RSVG SECCOMP SOUND SQLITE3 THREADS TIFF
TOOLKIT_SCROLL_BARS TREE_SITTER WEBP X11 XDBE XIM XINPUT2 XPM GTK3 ZLIB

Important settings:
  value of $LC_COLLATE: POSIX
  value of $LC_CTYPE: C.UTF-8
  value of $LC_TIME: en_DK.utf8
  value of $LANG: C.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Lisp Interaction

Minor modes in effect:
  display-time-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  minibuffer-regexp-mode: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t

Load-path shadows:
/usr/share/emacs/site-lisp/llvm-13/llvm-mode hides /usr/share/emacs/site-lisp/llvm-14/llvm-mode
/usr/share/emacs/site-lisp/llvm-13/tablegen-mode hides /usr/share/emacs/site-lisp/llvm-14/tablegen-mode
/usr/share/emacs/site-lisp/llvm-13/emacs hides /usr/share/emacs/site-lisp/llvm-14/emacs
/usr/share/emacs/site-lisp/llvm-13/llvm-mode hides /usr/share/emacs/site-lisp/llvm-15/llvm-mode
/usr/share/emacs/site-lisp/llvm-13/tablegen-mode hides /usr/share/emacs/site-lisp/llvm-15/tablegen-mode
/usr/share/emacs/site-lisp/llvm-13/emacs hides /usr/share/emacs/site-lisp/llvm-15/emacs
/usr/share/emacs/site-lisp/llvm-13/llvm-mode hides /usr/share/emacs/site-lisp/llvm-16/llvm-mode
/usr/share/emacs/site-lisp/llvm-13/tablegen-mode hides /usr/share/emacs/site-lisp/llvm-16/tablegen-mode
/usr/share/emacs/site-lisp/llvm-13/emacs hides /usr/share/emacs/site-lisp/llvm-16/emacs
/usr/share/emacs/site-lisp/llvm-13/llvm-mode hides /usr/share/emacs/site-lisp/llvm-17/llvm-mode
/usr/share/emacs/site-lisp/llvm-13/tablegen-mode hides /usr/share/emacs/site-lisp/llvm-17/tablegen-mode
/usr/share/emacs/site-lisp/llvm-13/emacs hides /usr/share/emacs/site-lisp/llvm-17/emacs
/usr/share/emacs/site-lisp/llvm-13/llvm-mode hides /usr/share/emacs/site-lisp/llvm-18/llvm-mode
/usr/share/emacs/site-lisp/llvm-13/tablegen-mode hides /usr/share/emacs/site-lisp/llvm-18/tablegen-mode
/usr/share/emacs/site-lisp/llvm-13/emacs hides /usr/share/emacs/site-lisp/llvm-18/emacs
/usr/share/emacs/site-lisp/llvm-13/llvm-mode hides /usr/share/emacs/site-lisp/llvm-19/llvm-mode
/usr/share/emacs/site-lisp/llvm-13/tablegen-mode hides /usr/share/emacs/site-lisp/llvm-19/tablegen-mode
/usr/share/emacs/site-lisp/llvm-13/emacs hides /usr/share/emacs/site-lisp/llvm-19/emacs
/usr/share/emacs/site-lisp/elpa/po-mode-0.23.1/po-mode-autoloads hides /usr/share/emacs/site-lisp/elpa-src/po-mode-0.23.1/po-mode-autoloads
/usr/share/emacs/site-lisp/elpa/po-mode-0.23.1/po-mode hides /usr/share/emacs/site-lisp/elpa-src/po-mode-0.23.1/po-mode
/usr/share/emacs/site-lisp/elpa/po-mode-0.23.1/po-mode-pkg hides /usr/share/emacs/site-lisp/elpa-src/po-mode-0.23.1/po-mode-pkg
/usr/share/emacs/site-lisp/flim/sasl hides /usr/share/emacs/30.1/lisp/net/sasl
/usr/share/emacs/site-lisp/latex-cjk-thai/thai-word hides /usr/share/emacs/30.1/lisp/language/thai-word

Features:
(shadow sort mail-extr cl-extra help-mode warnings compile comint
ansi-osc ansi-color ring comp-run comp-common rx emacsbug message
yank-media puny dired dired-loaddefs rfc822 mml mml-sec epa derived epg
rfc6068 epg-config gnus-util text-property-search time-date mm-decode
mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader
sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils
cus-start time cc-styles cc-align cc-engine cc-vars cc-defs w3m-load
mmm-auto mmm-vars mmm-utils mmm-compat cus-edit pp cus-load wid-edit
po-mode-autoloads package browse-url url url-proxy url-privacy
url-expand url-methods url-history url-cookie generate-lisp-file
url-domsuf url-util mailcap url-handlers url-parse auth-source cl-seq
eieio eieio-core cl-macs icons password-cache json subr-x map byte-opt
gv bytecomp byte-compile url-vars cl-loaddefs cl-lib rmc iso-transl
tooltip cconv eldoc paren electric uniquify ediff-hook vc-hooks
lisp-float-type elisp-mode mwheel term/x-win x-win term/common-win x-dnd
touch-screen tool-bar dnd fontset image regexp-opt fringe tabulated-list
replace newcomment text-mode lisp-mode prog-mode register page tab-bar
menu-bar rfn-eshadow isearch easymenu timer select scroll-bar mouse
jit-lock font-lock syntax font-core term/tty-colors frame minibuffer
nadvice seq simple cl-generic indonesian philippine cham georgian
utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean
japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european
ethiopic indian cyrillic chinese composite emoji-zwj charscript charprop
case-table epa-hook jka-cmpr-hook help abbrev obarray oclosure
cl-preloaded button loaddefs theme-loaddefs faces cus-face macroexp
files window text-properties overlay sha1 md5 base64 format env
code-pages mule custom widget keymap hashtable-print-readable backquote
threads dbusbind inotify lcms2 dynamic-setting system-font-setting
font-render-setting cairo gtk x-toolkit xinput2 x multi-tty move-toolbar
make-network-process native-compile emacs)

Memory information:
((conses 16 153724 11952) (symbols 48 11962 0) (strings 32 37588 3766)
 (string-bytes 1 1225292) (vectors 16 19566)
 (vector-slots 8 481647 76139) (floats 8 52 6) (intervals 56 370 0)
 (buffers 992 12))