From unknown Wed Aug 20 05:15:35 2025 X-Loop: help-debbugs@gnu.org Subject: bug#49621: 28.0.50; tramp: Remote lock symlink remains after save-buffer 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-GNU-PR-Keywords: To: 49621@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.1626609885776 (code B ref -1); Sun, 18 Jul 2021 12:05:01 +0000 Received: (at submit) by debbugs.gnu.org; 18 Jul 2021 12:04:45 +0000 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 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 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 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 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== User-agent: mu4e 1.4.15; emacs 28.0.50 From: Naofumi Yasufuku Date: Sun, 18 Jul 2021 21:04:29 +0900 Message-ID: <868s23akvm.fsf@yasufuku.dev> MIME-Version: 1.0 Content-Type: text/plain 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-Spam-Score: -1.7 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.7 (--) 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)) From unknown Wed Aug 20 05:15:35 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Naofumi Yasufuku Subject: bug#49621: closed (Re: bug#49621: 28.0.50; tramp: Remote lock symlink remains after save-buffer) Message-ID: References: <87a6mjacnf.fsf@gmx.de> <868s23akvm.fsf@yasufuku.dev> X-Gnu-PR-Message: they-closed 49621 X-Gnu-PR-Package: emacs Reply-To: 49621@debbugs.gnu.org Date: Sun, 18 Jul 2021 19:17:01 +0000 Content-Type: multipart/mixed; boundary="----------=_1626635821-5966-1" This is a multi-part message in MIME format... ------------=_1626635821-5966-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #49621: 28.0.50; tramp: Remote lock symlink remains after save-buffer which was filed against the emacs package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 49621@debbugs.gnu.org. --=20 49621: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D49621 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1626635821-5966-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 49621-done) by debbugs.gnu.org; 18 Jul 2021 19:16:52 +0000 Received: from localhost ([127.0.0.1]:57353 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1m5CHT-0001QF-MK for submit@debbugs.gnu.org; Sun, 18 Jul 2021 15:16:51 -0400 Received: from mout.gmx.net ([212.227.15.19]:36639) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1m5CHQ-0001Jq-VA for 49621-done@debbugs.gnu.org; Sun, 18 Jul 2021 15:16:49 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1626635803; bh=3E1XFTI0F5mEXxjTVNx2lQheUK21KPUcJyY00/b/iGc=; h=X-UI-Sender-Class:From:To:Cc:Subject:References:Date:In-Reply-To; b=GiFC3SN0SQ3BAITV5gqZecEc8a66z0BUWee+6G3rOJLFq9Wi+aKPWFsMgcPAXZbtY nCEFHXLXN52LIBHgor98MVCQmBVLv3emwXLNIRn3YbX1HDjVjMj/+IbE9L5prdQanl tjC0xfukXCceZoL/HOiwGtIdvKni/GHh0QYykmIQ= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from gandalf.gmx.de ([79.140.118.123]) by mail.gmx.net (mrgmx004 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MacOW-1lYpUl2v2w-00c6Df; Sun, 18 Jul 2021 17:02:14 +0200 From: Michael Albinus To: Naofumi Yasufuku Subject: Re: bug#49621: 28.0.50; tramp: Remote lock symlink remains after save-buffer References: <868s23akvm.fsf@yasufuku.dev> Date: Sun, 18 Jul 2021 17:02:12 +0200 In-Reply-To: <868s23akvm.fsf@yasufuku.dev> (Naofumi Yasufuku's message of "Sun, 18 Jul 2021 21:04:29 +0900") Message-ID: <87a6mjacnf.fsf@gmx.de> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Provags-ID: V03:K1:NMO4m5fjJ+dfNGSNGWG8rQJHt/BSxjidfEnwU7/L1hA5ilvlE2s aou/KV1ZNB8ZO5aOeIjLnkGBmgkWzaX3MrJBAy+TNUH281W4ZNkyKALdLDwr51QSjGiUHGR mmIAmm9+lVnRBg0sucN6dsMzTz9QrLgdGeIECAgQXvsDhzmkxUQ0931mqSoBmUnUZbMq2KP 4f01ZtAcqK763BECIoc7A== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:n9tzwgC3MrA=:qiCxeWbptQL4UUrlPtKGNY 9vcIMBu/TarieJ1/0iIU9H/U8981wVKkKwoRV9dHp+QPlOcU0U69aXh/J5UKYA4BjEdjDPYMK NSfbo5jQ1pVLwtJoQXKQqVyyL/pK7hO9A+VH3ef19GUle9Yzx9WyKwmINZKeoxhZhnmbo7ju4 Ox5pWuFCwY7v67dCA0jkIYWGb07l15PAAfAEE8AHmW4zseju/scDQ9SEIiAMct6u9pY1zTp3T 4UfQaCmMGwJf+2Q3oGNrpe1mpbOC/2mvAs1v/U5L1fowSoJ8e+kZhJHJo5BGQE9t+K6oJs3ai 022W46YDCEZ+tmliSvPh1t5K/mKxSuP8ilYs4dBoFSQn+w1B7cErq7DjgzDn3J/+2HqjuVy+e sYdxTa7Lj5kkZzuQTZ9euZXb3riqPSMBGVG/R9RCxRyO32qu4ycWc97MpankG8pu+GREa3b/L EVuYP+MtetXA9ESmjyRDWy06OVZf5q0vt25IpinekhZilWZrcquTXBnGSL/Fqe3697k8gCdlJ PNT/RqMBp8EhCwSV+PfMBJNutTGnr8poW6pNBlUaJZPgdk4Q1teTtW2EXqtAMydzUBzVavVEc t76z5gca7f/z5tROP3CRavp+t1sj90FGP6rXgYhZnn96bP8UmNScnikg+jPv03S7ZPaM8Q51j 7isRzkR7on0KgvccJs9JzD+O1rt57GCeZ8ohT3Eyg1Dxq0mvdy2dKTI9eAQ2q553C55dsaEyH wVmFd2A/nganpx4GqfTU2uWya8Qgj48p/G6xJdlsfC5LIKeqHVDpCQs1HRqFcNmXy4ZVkV246 6QroU8QfXqnvuE0s5d5pTexfpD4qCYSeL3ZQj07Y0TYrdsZZvx7Jhd623TjOnjH5pqCU0od9V 0h4Fi1jPkL+QwTl3gM2OxgOm/gAoYo3lESdX76gJdFP+DEAr1Aq1G3vxW47EbcherKPzHRZfJ qNK4UB6W8g4oKRjuaL8Y6TQgLxBP0KQrZglK7ujwWBn3h1cJNcPbYhK4RE+ZSv5ug5RI34vQ7 rfFuFfcI3fyq4ahn+t1FSjv0WZPPp/Qd4pC3Efvy9krGBXpdWc7AyezbCVmGEKlj2S6DPuju6 olQ+2dc9g4gfuW38YWqYNka0VmBBAo9rHKEJchU/DZUGXayJrWALF8ZTg== X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 49621-done Cc: 49621-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) Version:28.1 Naofumi Yasufuku writes: Hi Naofumi, > `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. Thanks, I've applied the patch to tramp-sh.el in your name. I've applied also similar patches to the other Tramp files, and I've extended the Tramp tests for this case. Closing the bug. > Regards, > --Naofumi Best regards, Michael. ------------=_1626635821-5966-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 18 Jul 2021 12:04:45 +0000 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 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 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 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 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== User-agent: mu4e 1.4.15; emacs 28.0.50 From: Naofumi Yasufuku To: bug-gnu-emacs@gnu.org Subject: 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 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-Spam-Score: -1.7 (-) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.7 (--) 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)) ------------=_1626635821-5966-1-- From unknown Wed Aug 20 05:15:35 2025 X-Loop: help-debbugs@gnu.org Subject: bug#49621: 28.0.50; tramp: Remote lock symlink remains after save-buffer Resent-From: Naofumi Yasufuku Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 19 Jul 2021 00:30:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 49621 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Michael Albinus Cc: 49621-done@debbugs.gnu.org Received: via spool by 49621-done@debbugs.gnu.org id=D49621.162665459220941 (code D ref 49621); Mon, 19 Jul 2021 00:30:02 +0000 Received: (at 49621-done) by debbugs.gnu.org; 19 Jul 2021 00:29:52 +0000 Received: from localhost ([127.0.0.1]:57680 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1m5HAN-0005Rh-UD for submit@debbugs.gnu.org; Sun, 18 Jul 2021 20:29:52 -0400 Received: from relay10.mail.gandi.net ([217.70.178.230]:37363) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1m5HAL-0005RT-8G for 49621-done@debbugs.gnu.org; Sun, 18 Jul 2021 20:29:50 -0400 Received: (Authenticated sender: naofumi@yasufuku.dev) by relay10.mail.gandi.net (Postfix) with ESMTPSA id 6B898240002; Mon, 19 Jul 2021 00:29:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yasufuku.dev; s=gm1; t=1626654582; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=Pa6GjKZlLCG2zOnS2JxBfbJ7PeuwGd2PoUNFvszUQXc=; b=dLfN7TapE68ZxqCkgi5C2ivfbsaufaA3g9JK5lk3Tvk09LUKvfz2oV8JJWXZVqDXPpeF6d UwrKZN+JrM/OQDlfPd/NCLzFwWevGNg3jkMuZ2Cbg9/qDTdobUkW9rA1WJZdDHgBu1UvdW HqpKLXmZjQ0UhvGISKHP982BXcVaSUYDZIpiFb7vJxg9B9Rb1/OrnW5/r+O+9LYA8+QWZL R6hAxEOXfF+uQ1F1lUGPmQYqFFauA2+5cZ1NHzEZ7/ymCW3LNvVj2RhpgldFzNr9uSOvfr 6KenRM01XhFNlaJbxy3fE1r5G1lx2W6G5iu/q66mN5FmhSWsyo6uspbrzkgi4Q== References: <868s23akvm.fsf@yasufuku.dev> <87a6mjacnf.fsf@gmx.de> User-agent: mu4e 1.4.15; emacs 28.0.50 From: Naofumi Yasufuku In-reply-to: <87a6mjacnf.fsf@gmx.de> Date: Mon, 19 Jul 2021 09:29:35 +0900 Message-ID: MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) Michael Albinus writes: >> `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. > > Thanks, I've applied the patch to tramp-sh.el in your name. I've applied also > similar patches to the other Tramp files, and I've extended the Tramp > tests for this case. Closing the bug. > Thank you, Michael. I confirmed that. Regards, --Naofumi