GNU bug report logs - #60943
28.2; ‘tramp-handle-file-regular-p’ misses symlinks

Previous Next

Package: emacs;

Reported by: Greg Pfeil <greg <at> technomadic.org>

Date: Thu, 19 Jan 2023 08:22:02 UTC

Severity: normal

Found in version 28.2

Fixed in version 29.1

Done: Michael Albinus <michael.albinus <at> gmx.de>

Bug is archived. No further changes may be made.

Full log


Message #11 received at 60943 <at> debbugs.gnu.org (full text, mbox):

From: Greg Pfeil <greg <at> technomadic.org>
To: Michael Albinus <michael.albinus <at> gmx.de>
Cc: 60943 <at> debbugs.gnu.org
Subject: Re: bug#60943: 28.2; ‘tramp-handle-file-regular-p’ misses symlinks
Date: Thu, 19 Jan 2023 10:55:45 -0700
[Message part 1 (text/plain, inline)]
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?

[tramp-file-regular-p.patch (application/octet-stream, attachment)]
[Message part 3 (text/plain, inline)]

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 ‘file-regular-p’ does).


> On Jan 19, 2023, at 06:12, Michael Albinus <michael.albinus <at> gmx.de> wrote:
> 
> Greg Pfeil <greg <at> technomadic.org> writes:
> 
> Hi Greg,
> 
>> I was having an issue where .dir-locals.el on remote machines weren’t getting picked up when they were a symlink. Local symlinks worked fine, and remote non-symlinks also worked.
>> 
>> Digging in, ‘tramp-handle-regular-file-p’ explicitly checks that the first character in ‘file-attribute-mode’ is ?-. However, for symlinks, that character will be ?l.
>> 
>> Modifying ‘dir-locals--all-files’ to check
>> 
>>  (or (file-regular-p f) (file-symlink-p f))
>> 
>> \(which is ostensibly redundant) instead of simply
>> 
>>  (file-regular-p f)
> 
> Indeed, there's a bug. Thanks for the report!
> 
>> fixes the behavior, since TRAMP will now check with both ‘tramp-handle-file-regular-p’ and ‘tramp-handle-file-symlink-p’. The correct fix is to make ‘tramp-handle-file-regular-p’ match the behavior of ‘file-regular-p’.
> 
> The appended patch fixes this. Eli, is it OK to push to the emacs-29 branch?
> 
> Best regards, Michael.
> 
> <Mail Attachment>


This bug report was last modified 2 years and 121 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.