Subject: bug#51769: 28.0.60; package-install-file unable to kill temp buffer after installing a file

From: Thanh Vuong <[email-masked]>
Date: Thu, 11 Nov 2021 08:18:57 -0700

Start `emacs -Q`

`M-x`: `package-install-file` choose any proper el file, for example the
test file `simple-single-1.3.el` that comes with Emacs source code.

After the file is installed, Emacs will complain about modified buffer
to be kill: "Buffer simple-single-1.3.el.el has been modified; Kill
anyway? (yes or no)".

The file is not modified and its buffer should be killed properly.

I suspect this commit 606b783acb3388249c38264f8e37e08af832e1ea which
added this line:
`(set-visited-file-name file)`
(https://git.savannah.gnu.org/cgit/emacs.git/tree/lisp/emacs-lisp/package.el?h=master#n2204)
to `package-install-file` causes this regression.

Thanks

In GNU Emacs 28.0.60 (build 1, x86_64-pc-linux-gnu, X toolkit, cairo 
version 1.16.0, Xaw3d scroll bars)
of 2021-10-12 built on x230x
Repository revision: f223ac6ef92b7cf69048c81ff58b5c983c7d25da
Repository branch: emacs-28
Windowing system distributor 'The X.Org Foundation', version 11.0.12011000
System Description: Ubuntu 20.04.3 LTS

Configured using:
'configure --prefix=/home/thanh/emacs28 --with-native-compilation
--with-x-toolkit=lucid --with-xft --without-gconf --without-gsettings
--with-modules --with-rsvg'

Configured features:
CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS HARFBUZZ JPEG JSON LIBOTF
LIBSELINUX LIBXML2 M17N_FLT MODULES NATIVE_COMP NOTIFY INOTIFY PDUMPER
PNG RSVG SECCOMP SOUND THREADS TIFF TOOLKIT_SCROLL_BARS X11 XAW3D XDBE
XIM XPM LUCID ZLIB

Important settings:
value of $LANG: en_CA.UTF-8
value of $XMODIFIERS: @im=ibus
locale-coding-system: utf-8-unix

Major mode: Messages

Minor modes in effect:
tooltip-mode: t
global-eldoc-mode: t
show-paren-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
blink-cursor-mode: t
auto-composition-mode: t
auto-encryption-mode: t
auto-compression-mode: t
buffer-read-only: t
line-number-mode: t
indent-tabs-mode: t
transient-mark-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message rmc puny dired dired-loaddefs
rfc822 mml mml-sec epa derived epg rfc6068 epg-config gnus-util rmail
rmail-loaddefs time-date mm-decode mm-bodies mm-encode mailabbrev
gmm-utils mailheader sendmail mail-utils cus-edit pp cus-start cus-load
wid-edit compile text-property-search comint ansi-color ring find-func
easy-mmode autoload radix-tree lisp-mnt mail-parse rfc2231 rfc2047
rfc2045 mm-util ietf-drums mail-prsvr bug-reference package browse-url
url url-proxy url-privacy url-expand url-methods url-history url-cookie
url-domsuf url-util mailcap url-handlers url-parse auth-source cl-seq
eieio eieio-core cl-macs eieio-loaddefs password-cache json subr-x map
url-vars seq byte-opt gv bytecomp byte-compile cconv cl-loaddefs cl-lib
iso-transl tooltip eldoc paren electric uniquify ediff-hook vc-hooks
lisp-float-type elisp-mode 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 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 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 emoji-zwj charscript
charprop case-table epa-hook jka-cmpr-hook help simple abbrev obarray
cl-preloaded nadvice button loaddefs faces cus-face macroexp files
window text-properties overlay sha1 md5 base64 format env code-pages
mule custom widget hashtable-print-readable backquote threads dbusbind
inotify dynamic-setting font-render-setting cairo x-toolkit x multi-tty
make-network-process native-compile emacs)

Memory information:
((conses 16 112704 8184)
(symbols 48 9769 0)
(strings 32 29822 1891)
(string-bytes 1 979421)
(vectors 16 18098)
(vector-slots 8 366708 11788)
(floats 8 35 16)
(intervals 56 282 0)
(buffers 992 13))