From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Naofumi Yasufuku Newsgroups: gmane.emacs.bugs Subject: bug#49621: 28.0.50; tramp: Remote lock symlink remains after save-buffer Date: Sun, 18 Jul 2021 21:04:29 +0900 Message-ID: <868s23akvm.fsf@yasufuku.dev> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="24061"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: mu4e 1.4.15; emacs 28.0.50 To: 49621@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Jul 18 14:05:30 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1m55Y1-00066V-V7 for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 18 Jul 2021 14:05:30 +0200 Original-Received: from localhost ([::1]:43926 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m55Y0-0000wN-Ph for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 18 Jul 2021 08:05:28 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:39602) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m55Xa-0000vt-2K for bug-gnu-emacs@gnu.org; Sun, 18 Jul 2021 08:05:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:43780) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1m55XZ-00060P-Qj for bug-gnu-emacs@gnu.org; Sun, 18 Jul 2021 08:05:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1m55XZ-0000DE-NW for bug-gnu-emacs@gnu.org; Sun, 18 Jul 2021 08:05:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Naofumi Yasufuku Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 18 Jul 2021 12:05:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 49621 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.1626609885776 (code B ref -1); Sun, 18 Jul 2021 12:05:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 18 Jul 2021 12:04:45 +0000 Original-Received: from localhost ([127.0.0.1]:55323 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1m55XJ-0000CR-5Y for submit@debbugs.gnu.org; Sun, 18 Jul 2021 08:04:45 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:59632) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1m55XH-0000CI-6a for submit@debbugs.gnu.org; Sun, 18 Jul 2021 08:04:43 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:39474) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m55XH-0000tC-0f for bug-gnu-emacs@gnu.org; Sun, 18 Jul 2021 08:04:43 -0400 Original-Received: from relay4-d.mail.gandi.net ([217.70.183.196]:37733) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m55XD-0005sP-V1 for bug-gnu-emacs@gnu.org; Sun, 18 Jul 2021 08:04:42 -0400 Original-Received: (Authenticated sender: naofumi@yasufuku.dev) by relay4-d.mail.gandi.net (Postfix) with ESMTPSA id 4C7D3E0008 for ; Sun, 18 Jul 2021 12:04:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yasufuku.dev; s=gm1; t=1626609876; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type; bh=oYGbclFku7SKlsdsFQG87ltFcEkAgcLe745065mgA5M=; b=Lc9wyof3wu1FA3XWKBYCJQGrTLjGRCU4dPhUZWCxS2+zV6CYoVPgkRcvPgxJ4HAcJejKsq ypjpMQkpXEXfpg9iFaKRCe/ED8Gz3qhCueO3zE0InvtUVKnga/jwJFmVRZa0+e4AZl03T7 PxmCrEzblSIoeuWp2BTogF5awZLsXRbeSCdZ4WV7G/lfzoc/SpXfZavtyLtS6SHTb8j6uL 4tdKYRiSm3JUuEDYnA2ulhEeEVqBkOGuRqem66gj2UR+C1J9RJ1LGd1t8fgE5Jt4OhmMvO zuZ+5h9gW9iRMQrOBn4l09KJV9mV38puH8nyoICABYfXDFm4PglhgP48RoLPAQ== Received-SPF: pass client-ip=217.70.183.196; envelope-from=naofumi@yasufuku.dev; helo=relay4-d.mail.gandi.net X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:210168 Archived-At: Remote lock symlink remains even though the locked file is saved by `save-buffer'. NG CASE: 0) emacs -Q 1) C-x C-f /sshx:user@host:~/file 2) type some text (self-insert-command -> lock-file -> tramp-handle-lock-file) 3) C-x C-s (save-buffer -> write-region -> tramp-sh-handle-write-region) 4) lock symlink remains 5) C-x k (kill-buffer) 6) lock symlink remains OK CASE: 0) emacs -Q 1) C-x C-f /sshx:user@host:~/file 2) type some text (self-insert-command -> lock-file -> tramp-handle-lock-file) 3) C-x k (kill-buffer -> unlock-file -> tramp-handle-unlock-file) 4) lock symlink is removed `tramp-sh-handle-write-region' doesn't unlock the file whose lock is already acquired. The following change can solve this problem for sh methods. It seems that all tramp methods have the same problem. -------- diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el index e6bd42a83a..8b4c78fe65 100644 --- a/lisp/net/tramp-sh.el +++ b/lisp/net/tramp-sh.el @@ -3249,7 +3249,7 @@ tramp-sh-handle-write-region (format "File %s exists; overwrite anyway? " filename))))) (tramp-error v 'file-already-exists filename)) - (let (file-locked + (let ((file-locked (eq (file-locked-p lockname) t)) (uid (or (tramp-compat-file-attribute-user-id (file-attributes filename 'integer)) (tramp-get-remote-uid v 'integer))) @@ -3260,7 +3260,7 @@ tramp-sh-handle-write-region ;; Lock file. (when (and (not (auto-save-file-name-p (file-name-nondirectory filename))) (file-remote-p lockname) - (not (eq (file-locked-p lockname) t))) + (not file-locked)) (setq file-locked t) ;; `lock-file' exists since Emacs 28.1. (tramp-compat-funcall 'lock-file lockname)) @@ -3481,7 +3481,7 @@ tramp-sh-handle-write-region (tramp-set-file-uid-gid filename uid gid)) ;; Unlock file. - (when (and file-locked (eq (file-locked-p lockname) t)) + (when file-locked ;; `unlock-file' exists since Emacs 28.1. (tramp-compat-funcall 'unlock-file lockname)) -------- Regards, --Naofumi In GNU Emacs 28.0.50 (build 1, aarch64-unknown-linux-gnu, GTK+ Version 3.24.25, cairo version 1.16.0) of 2021-07-18 built on phoebe Repository revision: 6b802a08cabfb23bdf1f65faa2ee163d3efa820d Repository branch: master Windowing system distributor 'The X.Org Foundation', version 11.0.12101001 System Description: Ubuntu 21.04 Configured using: 'configure --prefix=/home/naofumi/.local/emacs-head --with-mailutils --with-native-compilation --with-xwidgets' Configured features: CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG JSON LCMS2 LIBSELINUX LIBSYSTEMD LIBXML2 MODULES NATIVE_COMP NOTIFY INOTIFY PDUMPER PNG RSVG SECCOMP SOUND THREADS TIFF TOOLKIT_SCROLL_BARS X11 XDBE XIM XPM XWIDGETS GTK3 ZLIB Important settings: value of $LANG: en_US.UTF-8 value of $XMODIFIERS: @im=ibus locale-coding-system: utf-8-unix Major mode: Dired by name Minor modes in effect: company-statistics-mode: t global-company-mode: t company-mode: t yas-global-mode: t yas-minor-mode: t doom-modeline-mode: t which-key-mode: t disable-mouse-global-mode: t key-chord-mode: t shell-dirtrack-mode: t projectile-mode: t global-git-gutter-mode: t ivy-mode: t amx-mode: t pyvenv-tracking-mode: t editorconfig-mode: t gnus-dired-mode: t windmove-mode: t winner-mode: t global-so-long-mode: t global-whitespace-mode: t recentf-mode: t global-auto-revert-mode: t electric-pair-mode: t delete-selection-mode: t show-paren-mode: t savehist-mode: t global-eldoc-mode: t electric-indent-mode: t mouse-wheel-mode: t tab-bar-history-mode: t tab-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 column-number-mode: t line-number-mode: t transient-mark-mode: t Load-path shadows: /home/naofumi/.emacs.d/elpa-28/cmake-mode-20210104.1831/cmake-mode hides /usr/share/emacs/site-lisp/cmake-mode /home/naofumi/.emacs.d/elpa-28/transient-20210701.1116/transient hides /home/naofumi/.local/emacs-head/share/emacs/28.0.50/lisp/transient Features: (mail-extr sort vc-hg vc-git diff-mode vc-bzr vc-dispatcher tramp-cache tramp-sh dired-aux ffap shadow highlight-indent-guides face-remap editorconfig-core editorconfig-core-handle editorconfig-fnmatch emacsbug counsel xdg swiper server skk-cursor ccc skk-sticky skk-dcomp skk-comp skk-look skk-server skk-study skk-hint skk-cus cus-edit pp cus-start cus-load skk-emacs skk-macs skk-vars skk company-statistics company-oddmuse company-keywords company-etags etags fileloop company-gtags company-dabbrev-code company-dabbrev company-files company-clang company-capf company-cmake company-semantic company-template company-bbdb company pcase yasnippet-snippets yasnippet doom-modeline doom-modeline-segments doom-modeline-env doom-modeline-core shrink-path f all-the-icons all-the-icons-faces data-material data-weathericons data-octicons data-fileicons data-faicons data-alltheicons tramp tramp-loaddefs trampver tramp-integration files-x tramp-compat ls-lisp doom-tomorrow-night-theme doom-themes doom-themes-base base16-tomorrow-night-theme base16-theme vlf-setup which-key disable-mouse key-chord shell-pop term shell ehelp win-switch elscreen-gf elscreen projectile grep compile ibuf-ext ibuffer ibuffer-loaddefs git-gutter ivy-xref ivy-migemo two-column ivy-hydra ivy ivy-faces ivy-overlay colir color ace-link avy amx s migemo comp comp-cstr warnings smart-jump-lisp-mode smart-jump-elisp-mode smart-jump xref project cl-extra help-mode hydra lv pyvenv eshell esh-cmd esh-ext esh-opt esh-proc esh-io esh-arg esh-module esh-groups esh-util editorconfig rx mu4e-maildirs-extension dash gnus-dired mu4e desktop frameset mu4e-org mu4e-main mu4e-headers mu4e-view thingatpt gnus-art mm-uu mml2015 mm-view mml-smime smime dig gnus-sum shr kinsoku svg dom gnus-group gnus-undo gnus-start gnus-dbus dbus xml gnus-cloud nnimap nnmail mail-source utf7 netrc nnoo parse-time iso8601 gnus-spec gnus-int gnus-range gnus-win gnus nnheader mu4e-compose mu4e-context mu4e-draft mu4e-actions org-capture org-refile ido rfc2368 smtpmail sendmail mu4e-mark mu4e-message flow-fill mu4e-proc mu4e-utils doc-view jka-compr image-mode exif mu4e-lists ox-gfm ox-md ox-odt rng-loc rng-uri rng-parse rng-match rng-dt rng-util rng-pttrn nxml-parse nxml-ns nxml-enc xmltok nxml-util ox-latex ox-icalendar ox-html table ox-ascii ox-publish ox org-element avl-tree generator org ob ob-tangle ob-ref ob-lob ob-table ob-exp org-macro org-footnote org-src ob-comint org-pcomplete pcomplete comint ansi-color org-list org-faces org-entities noutline outline easy-mmode org-version ob-emacs-lisp ob-core ob-eval org-table ol org-keys org-compat org-macs org-loaddefs format-spec find-func cal-menu calendar cal-loaddefs mule-util hl-line mu4e-vars message rmc puny dired-x dired dired-loaddefs rfc822 mml mml-sec epa derived epg epg-config gnus-util rmail rmail-loaddefs text-property-search time-date mm-decode mm-bodies mm-encode mail-parse rfc2231 rfc2047 rfc2045 mm-util ietf-drums mail-prsvr mailabbrev mail-utils gmm-utils mailheader mu4e-meta auth-source-pass windmove winner ring so-long disp-table whitespace recentf-ext recentf tree-widget wid-edit diminish autorevert filenotify cua-base elec-pair delsel paren savehist japan-util exec-path-from-shell finder-inf advice edmacro kmacro slime-autoloads info 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 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 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 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 xwidget-internal dbusbind inotify lcms2 dynamic-setting system-font-setting font-render-setting cairo move-toolbar gtk x-toolkit x multi-tty make-network-process native-compile emacs) Memory information: ((conses 16 827372 493815) (symbols 48 47126 2) (strings 32 202612 63709) (string-bytes 1 6875606) (vectors 16 90294) (vector-slots 8 2023024 312170) (floats 8 1286 1723) (intervals 56 15402 985) (buffers 992 40))