GNU bug report logs - #35171
26.1; file-locked-p does not respect file-name-coding-system

Previous Next

Package: emacs;

Reported by: Olli Helenius <liff <at> iki.fi>

Date: Sat, 6 Apr 2019 14:36:01 UTC

Severity: normal

Found in version 26.1

Fixed in version 27.1

Done: Glenn Morris <rgm <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 35171 in the body.
You can then email your comments to 35171 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#35171; Package emacs. (Sat, 06 Apr 2019 14:36:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Olli Helenius <liff <at> iki.fi>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sat, 06 Apr 2019 14:36:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Olli Helenius <liff <at> iki.fi>
To: bug-gnu-emacs <at> gnu.org
Subject: 26.1; file-locked-p does not respect file-name-coding-system
Date: Sat, 6 Apr 2019 13:17:17 +0300 (EEST)
The ‘file-locked-p’ function does not call ‘ENCODE_FILE’ on its argument
and thus can end up looking for a different file name than that which
was generated by ‘lock-buffer’.  Below is an Elisp expression that
demonstrates the issue.

;; Returns string "file-locked-p buggy" if the result of file-locked-p
;; is `nil' even when the buffer should be locked.
(let ((file-name-coding-system 'latin-1-unix)
      (create-lockfiles t))
  (let ((file (make-temp-file "file-locked-p-éö-" nil ".txt" "test"))
	(result nil))
    (unwind-protect
	(progn
	  (find-file-existing file)
	  (insert "modification")
          (lock-buffer)
	  (if (eq nil (file-locked-p file))
	      (setq result "file-locked-p buggy")
	    (setq result "file-locked-p ok"))
	  (save-buffer)
	  (kill-buffer)
	  result)
      (delete-file file nil))))

See also:
  http://git.savannah.gnu.org/cgit/emacs.git/tree/src/filelock.c?h=emacs-26.1#n680
  http://git.savannah.gnu.org/cgit/emacs.git/tree/src/filelock.c?h=emacs-26.1#n829

In GNU Emacs 26.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.5)
 of 2019-04-05 built on localhost
Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.
Mark set [3 times]
current-kill: Kill ring is empty
Making completion list...

Configured using:
 'configure
 --prefix=/nix/store/1yj0jrwh9yr2h81nl50c88lqn254ylil-emacs-26.1
 --with-modules --with-x-toolkit=gtk3 --with-xft
 CFLAGS=-DMAC_OS_X_VERSION_MAX_ALLOWED=101200'

Configured features:
XPM JPEG TIFF GIF PNG RSVG SOUND DBUS GSETTINGS NOTIFY LIBSELINUX GNUTLS
LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB TOOLKIT_SCROLL_BARS GTK3 X11
MODULES THREADS LIBSYSTEMD

Important settings:
  value of $EMACSLOADPATH: /nix/store/553k4fjrf5d523zrjvm7jmw6zx23cbmf-emacs-packages-deps/share/emacs/site-lisp:
  value of $LANG: fi_FI.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Lisp Interaction

Minor modes in effect:
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Load-path shadows:
/nix/store/553k4fjrf5d523zrjvm7jmw6zx23cbmf-emacs-packages-deps/share/emacs/site-lisp/elpa/treemacs-20181223.519/treemacs-evil hides /nix/store/553k4fjrf5d523zrjvm7jmw6zx23cbmf-emacs-packages-deps/share/emacs/site-lisp/elpa/treemacs-evil-20181227.747/treemacs-evil
/nix/store/553k4fjrf5d523zrjvm7jmw6zx23cbmf-emacs-packages-deps/share/emacs/site-lisp/elpa/treemacs-20181223.519/treemacs-projectile hides /nix/store/553k4fjrf5d523zrjvm7jmw6zx23cbmf-emacs-packages-deps/share/emacs/site-lisp/elpa/treemacs-projectile-20181227.747/treemacs-projectile
/nix/store/553k4fjrf5d523zrjvm7jmw6zx23cbmf-emacs-packages-deps/share/emacs/site-lisp/elpa/seq-2.20/seq hides /nix/store/1yj0jrwh9yr2h81nl50c88lqn254ylil-emacs-26.1/share/emacs/26.1/lisp/emacs-lisp/seq
/nix/store/553k4fjrf5d523zrjvm7jmw6zx23cbmf-emacs-packages-deps/share/emacs/site-lisp/elpa/let-alist-1.0.5/let-alist hides /nix/store/1yj0jrwh9yr2h81nl50c88lqn254ylil-emacs-26.1/share/emacs/26.1/lisp/emacs-lisp/let-alist

Features:
(shadow sort mail-extr emacsbug message rmc puny seq seq-25 byte-opt gv
bytecomp byte-compile cconv cl-loaddefs cl-lib dired dired-loaddefs
format-spec rfc822 mml easymenu mml-sec password-cache epa derived epg
epg-config gnus-util rmail rmail-loaddefs mm-decode mm-bodies mm-encode
mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047
rfc2045 ietf-drums mm-util mail-prsvr mail-utils term/xterm xterm
time-date elec-pair mule-util tooltip eldoc electric uniquify ediff-hook
vc-hooks lisp-float-type mwheel term/x-win x-win term/common-win x-dnd
tool-bar dnd fontset image regexp-opt fringe tabulated-list replace
newcomment text-mode elisp-mode lisp-mode prog-mode register page
menu-bar rfn-eshadow isearch timer select scroll-bar mouse jit-lock
font-lock syntax facemenu font-core term/tty-colors frame cl-generic
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 charscript charprop
case-table epa-hook jka-cmpr-hook help simple abbrev obarray minibuffer
cl-preloaded nadvice loaddefs button faces cus-face macroexp files
text-properties overlay sha1 md5 base64 format env code-pages mule
custom widget hashtable-print-readable backquote dbusbind inotify
dynamic-setting system-font-setting font-render-setting move-toolbar gtk
x-toolkit x multi-tty make-network-process emacs)

Memory information:
((conses 16 100753 4370)
 (symbols 48 20340 1)
 (miscs 40 41 143)
 (strings 32 28643 993)
 (string-bytes 1 782458)
 (vectors 16 12695)
 (vector-slots 8 452201 6174)
 (floats 8 55 766)
 (intervals 56 276 8)
 (buffers 992 13))




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#35171; Package emacs. (Sat, 06 Apr 2019 14:56:01 GMT) Full text and rfc822 format available.

Message #8 received at 35171 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Olli Helenius <liff <at> iki.fi>
Cc: 35171 <at> debbugs.gnu.org
Subject: Re: bug#35171: 26.1;
 file-locked-p does not respect file-name-coding-system
Date: Sat, 06 Apr 2019 17:55:24 +0300
> Date: Sat, 6 Apr 2019 13:17:17 +0300 (EEST)
> From: Olli Helenius <liff <at> iki.fi>
> 
> The ‘file-locked-p’ function does not call ‘ENCODE_FILE’ on its argument
> and thus can end up looking for a different file name than that which
> was generated by ‘lock-buffer’.  Below is an Elisp expression that
> demonstrates the issue.

Thanks, fixed on the master branch.




bug marked as fixed in version 27.1, send any further explanations to 35171 <at> debbugs.gnu.org and Olli Helenius <liff <at> iki.fi> Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Sat, 06 Apr 2019 21:57:01 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 05 May 2019 11:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 6 years and 140 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.