From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Greg Pfeil Newsgroups: gmane.emacs.bugs Subject: bug#60943: 28.2; =?UTF-8?Q?=E2=80=98tramp-handle-file-regular-p=E2=80=99?= misses symlinks Date: Thu, 19 Jan 2023 10:55:45 -0700 Message-ID: <8B66E6A4-13D0-49B1-B2B5-52A561960C39@technomadic.org> References: <87fsc6llc7.fsf@gmx.de> Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.300.101.1.3\)) Content-Type: multipart/mixed; boundary="Apple-Mail=_4B72425E-0A69-442B-A8CA-BDA9CED6C968" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="6972"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 60943@debbugs.gnu.org To: Michael Albinus Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Jan 19 18:57:18 2023 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 1pIZA5-0001aA-BH for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 19 Jan 2023 18:57:17 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pIZ9r-0001KL-Tx; Thu, 19 Jan 2023 12:57:03 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pIZ9q-0001K0-MI for bug-gnu-emacs@gnu.org; Thu, 19 Jan 2023 12:57:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pIZ9q-0007H4-EQ for bug-gnu-emacs@gnu.org; Thu, 19 Jan 2023 12:57:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pIZ9q-000417-7H for bug-gnu-emacs@gnu.org; Thu, 19 Jan 2023 12:57:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Greg Pfeil Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 19 Jan 2023 17:57:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 60943 X-GNU-PR-Package: emacs Original-Received: via spool by 60943-submit@debbugs.gnu.org id=B60943.167415096315371 (code B ref 60943); Thu, 19 Jan 2023 17:57:02 +0000 Original-Received: (at 60943) by debbugs.gnu.org; 19 Jan 2023 17:56:03 +0000 Original-Received: from localhost ([127.0.0.1]:44693 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pIZ8s-0003zq-OY for submit@debbugs.gnu.org; Thu, 19 Jan 2023 12:56:03 -0500 Original-Received: from purple.birch.relay.mailchannels.net ([23.83.209.150]:7413) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pIZ8q-0003zO-B6 for 60943@debbugs.gnu.org; Thu, 19 Jan 2023 12:56:01 -0500 X-Sender-Id: dreamhost|x-authsender|greg@technomadic.org Original-Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id 779FA41481; Thu, 19 Jan 2023 17:55:58 +0000 (UTC) Original-Received: from pdx1-sub0-mail-a223.dreamhost.com (unknown [127.0.0.6]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id 0409F4147A; Thu, 19 Jan 2023 17:55:57 +0000 (UTC) ARC-Seal: i=1; s=arc-2022; d=mailchannels.net; t=1674150958; a=rsa-sha256; cv=none; b=uhbPEHLtxl3RV55Y/DhAstWl1NfBBqp4dP1wmQ5P0Ey/aCny8zYmIXdiFb7/yofOF9mXt5 wJp2GJFxihk+YlTu1+8pa3B45fSsE6tMAHs7C3TvC9CjERF1bm1rlEs8y0FIFzQAB03fF4 VAOoSyljty/9uH8CmMoBVl6TK3JVErSQYL4TyXmksiDYgWFwea/141AEzvrOxWOWMNY73u 9CIBsa4eersU9uukCWBFAZGdmCeNWMr8vSWzEZJZ5ZtwgbfEfkcYM1aax//+LSmfNQM937 7cXYQewNw8aOpAhG/UU+/lfshWX4wXtvmveUo//mXeJq15rmXSBQyL7MhuKDLA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=mailchannels.net; s=arc-2022; t=1674150958; 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:dkim-signature; bh=o+IrQfAeQsgrzvWyu7bc//2AX70HkFVgZzFsI2ZfAsY=; b=k+sGqZjC/S7Em06StMv5b2imMgCR+FVdBiIfGrYONjP6GONawPorviga8GvI9yAlU/3tmd 5Va40Yg4c6nbNl85RV0uuzIP4NmvLbLXI8f+hGwoLSVPfLuDW95jbVIcdrrwNz5cL8Tfi5 X1aErC4LtUxiKXw7Iwzq1owL1uiRO2SZvLLzUKX1fF/ZyNLZXMr6Fa3ec/dyiT+aqLwiHj PIoZwPzgLcTIB6c/1MNl+o5pElAu9UcR5LB5K/V250Lpb0GCzhBU98HvUU1TjDuEPz+Uey qzz47BDKnaJ791mPz4mmfUCfBTYA6uHjXxMYlfa+QZxuumCW3ngR7T7gCYxtjA== ARC-Authentication-Results: i=1; rspamd-6f569fcb69-4vtzg; auth=pass smtp.auth=dreamhost smtp.mailfrom=greg@technomadic.org X-Sender-Id: dreamhost|x-authsender|greg@technomadic.org X-MC-Relay: Neutral X-MailChannels-SenderId: dreamhost|x-authsender|greg@technomadic.org X-MailChannels-Auth-Id: dreamhost X-Left-Occur: 75856d372393134e_1674150958266_3586673404 X-MC-Loop-Signature: 1674150958265:1465454709 X-MC-Ingress-Time: 1674150958265 Original-Received: from pdx1-sub0-mail-a223.dreamhost.com (pop.dreamhost.com [64.90.62.162]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384) by 100.116.179.96 (trex/6.7.1); Thu, 19 Jan 2023 17:55:58 +0000 Original-Received: from smtpclient.apple (c-76-120-72-225.hsd1.co.comcast.net [76.120.72.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: greg@technomadic.org) by pdx1-sub0-mail-a223.dreamhost.com (Postfix) with ESMTPSA id 4NyVfj0rhNz4h; Thu, 19 Jan 2023 09:55:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=technomadic.org; s=dreamhost; t=1674150957; bh=o+IrQfAeQsgrzvWyu7bc//2AX70HkFVgZzFsI2ZfAsY=; h=From:Content-Type:Subject:Date:Cc:To; b=xRsCsDyX37hm/w0BgYE6ZQV4fM7cfw/xj4e0Pn6UAbk8JD75dI43V57sw5n+Cs7kF +oMOorOYHI+nra8Hvbu7USX6ad5A7B7qYYRHoy86h+D9lH+wLZ902TMEuu529Gos6k j1gtP7UZi8HwOIER/hZpJ5panQKC5Twq2pxRDXTqabanPzxWYlINZhGj2IczoL3/PY lYhRawr5VHTTm5Ncn/Io28ucU8qZSyxVCiNUM2UTg0/NflGri+KDbRxzJ6qemsTtAo InbA3cTcTVHkSI5ZJ2TAQecJME5dyDnd1iLwqUm5acWhWerSk1lCOBzvZj7RGOLxBy vjBBvqGXCpdKQ== In-Reply-To: <87fsc6llc7.fsf@gmx.de> X-Mailer: Apple Mail (2.3731.300.101.1.3) 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-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:253721 Archived-At: --Apple-Mail=_4B72425E-0A69-442B-A8CA-BDA9CED6C968 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii I think sockets (where the 0th char is ?s) are also considered regular = files. Also, I think that patch checks whether the truename is a regular = file, but I believe /all/ symlinks are considered regular. How about this version? --Apple-Mail=_4B72425E-0A69-442B-A8CA-BDA9CED6C968 Content-Disposition: attachment; filename=tramp-file-regular-p.patch Content-Type: application/octet-stream; x-unix-mode=0644; name="tramp-file-regular-p.patch" Content-Transfer-Encoding: 7bit diff --git a/lisp/tramp.el b/lisp/tramp.el index 351def66..82fa2b61 100644 --- a/lisp/tramp.el +++ b/lisp/tramp.el @@ -4039,7 +4039,7 @@ Let-bind it when necessary.") ;; Sometimes, `file-attributes' does not return a proper value ;; even if `file-exists-p' does. (when-let ((attr (file-attributes filename))) - (eq ?- (aref (file-attribute-modes attr) 0))))) + (memq (aref (tramp-compat-file-attribute-modes attr) 0) '(?- ?l ?s))))) (defun tramp-handle-file-remote-p (filename &optional identification connected) "Like `file-remote-p' for Tramp files." --Apple-Mail=_4B72425E-0A69-442B-A8CA-BDA9CED6C968 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 It just changes the equality check to check for the set of valid values. = If we had the mode as a number, we could just check the one bit for = regular files (which I think is what =E2=80=98file-regular-p=E2=80=99 = does). > On Jan 19, 2023, at 06:12, Michael Albinus = wrote: >=20 > Greg Pfeil writes: >=20 > Hi Greg, >=20 >> I was having an issue where .dir-locals.el on remote machines = weren=E2=80=99t getting picked up when they were a symlink. Local = symlinks worked fine, and remote non-symlinks also worked. >>=20 >> Digging in, =E2=80=98tramp-handle-regular-file-p=E2=80=99 explicitly = checks that the first character in =E2=80=98file-attribute-mode=E2=80=99 = is ?-. However, for symlinks, that character will be ?l. >>=20 >> Modifying =E2=80=98dir-locals--all-files=E2=80=99 to check >>=20 >> (or (file-regular-p f) (file-symlink-p f)) >>=20 >> \(which is ostensibly redundant) instead of simply >>=20 >> (file-regular-p f) >=20 > Indeed, there's a bug. Thanks for the report! >=20 >> fixes the behavior, since TRAMP will now check with both = =E2=80=98tramp-handle-file-regular-p=E2=80=99 and = =E2=80=98tramp-handle-file-symlink-p=E2=80=99. The correct fix is to = make =E2=80=98tramp-handle-file-regular-p=E2=80=99 match the behavior of = =E2=80=98file-regular-p=E2=80=99. >=20 > The appended patch fixes this. Eli, is it OK to push to the emacs-29 = branch? >=20 > Best regards, Michael. >=20 > --Apple-Mail=_4B72425E-0A69-442B-A8CA-BDA9CED6C968--