unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#64821: 30.0.50; write-region errs when overwriting an already open file
@ 2023-07-24  7:12 Ihor Radchenko
  2023-07-24 15:11 ` Eli Zaretskii
  2023-07-27 15:07 ` Mattias Engdegård
  0 siblings, 2 replies; 12+ messages in thread
From: Ihor Radchenko @ 2023-07-24  7:12 UTC (permalink / raw)
  To: 64821

Consider the following reproducer:

1. emacs -Q
2. Evaluate the following in scratch buffer

(with-temp-buffer
  (insert "test")
  (write-region nil nil "/tmp/1.txt"))

3. Open /tmp/1.txt
4. Evaluate the above sexp multiple times
5. Observe

Debugger entered--Lisp error: (wrong-type-argument stringp nil)
  expand-file-name(nil)
  userlock--check-content-unchanged("/tmp/1.txt")
  userlock--ask-user-about-supersession-threat("/tmp/1.txt")
  write-region(nil nil "/tmp/1.txt")
  (progn (insert "test") (write-region nil nil "/tmp/1.txt"))
  (unwind-protect (progn (insert "test") (write-region nil nil "/tmp/1.txt")) (and (buffer-name temp-buffer) (kill-buffer temp-buffer)))
  (save-current-buffer (set-buffer temp-buffer) (unwind-protect (progn (insert "test") (write-region nil nil "/tmp/1.txt")) (and (buffer-name temp-buffer) (kill-buffer temp-buffer))))
  (let ((temp-buffer (generate-new-buffer " *temp*" t))) (save-current-buffer (set-buffer temp-buffer) (unwind-protect (progn (insert "test") (write-region nil nil "/tmp/1.txt")) (and (buffer-name temp-buffer) (kill-buffer temp-buffer)))))
  (progn (let ((temp-buffer (generate-new-buffer " *temp*" t))) (save-current-buffer (set-buffer temp-buffer) (unwind-protect (progn (insert "test") (write-region nil nil "/tmp/1.txt")) (and (buffer-name temp-buffer) (kill-buffer temp-buffer))))))
  elisp--eval-last-sexp(nil)
  eval-last-sexp(nil)
  funcall-interactively(eval-last-sexp nil)
  command-execute(eval-last-sexp)

Expected: No error is thrown.

In GNU Emacs 30.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version
 3.24.38, cairo version 1.17.8) of 2023-07-21 built on localhost
Repository revision: 7f77120683d6f150e61e11b41d75ba16ee5210a4
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12101008
System Description: Gentoo Linux


-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>





^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2023-07-28 12:08 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-24  7:12 bug#64821: 30.0.50; write-region errs when overwriting an already open file Ihor Radchenko
2023-07-24 15:11 ` Eli Zaretskii
2023-07-25  8:16   ` Ihor Radchenko
2023-07-25 12:19     ` Eli Zaretskii
2023-07-27 15:07 ` Mattias Engdegård
2023-07-27 16:31   ` Eli Zaretskii
2023-07-27 17:47     ` Mattias Engdegård
2023-07-27 19:02       ` Eli Zaretskii
2023-07-27 19:49         ` Mattias Engdegård
2023-07-28  6:40           ` Eli Zaretskii
2023-07-28  9:01             ` Mattias Engdegård
2023-07-28 12:08               ` Eli Zaretskii

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).