unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Greg Pfeil <greg@technomadic.org>
To: Michael Albinus <michael.albinus@gmx.de>
Cc: 60943@debbugs.gnu.org
Subject: bug#60943: 28.2; ‘tramp-handle-file-regular-p’ misses symlinks
Date: Fri, 20 Jan 2023 07:16:50 -0700	[thread overview]
Message-ID: <5D199613-5B27-48CA-837E-13D6817825AD@technomadic.org> (raw)
In-Reply-To: <877cxhv5iw.fsf@gmx.de>

Ah, I see it’s right there in the docs even! I had just glanced at the impl, saw S_ISREG in there and assumed. Thanks for the clarification.

-- 
Sent from my iPhone

> On Jan 20, 2023, at 03:56, Michael Albinus <michael.albinus@gmx.de> wrote:
> 
> Greg Pfeil <greg@technomadic.org> writes:
> 
> Hi Greg,
> 
>> 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.
> 
> No, neither sockets nor symlinks to directories count as regular
> files. See the Elisp manual (info "(elisp) Kinds of Files")
> 
> A socket is an "other I/O device" according to the description. And
> symlinks are regular files only, if they point to a regular file.
> 
>> 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).
> 
> You can always check yourself in Emacs with a local file. For example,
> if you have a socket like "/run/user/1000/bus":
> 
> --8<---------------cut here---------------start------------->8---
> (file-exists-p (concat (getenv "XDG_RUNTIME_DIR") "/bus"))
> => t
> 
> (file-attribute-modes (file-attributes (concat (getenv "XDG_RUNTIME_DIR") "/bus")))
> => "srw-rw-rw-"
> 
> (file-regular-p (concat (getenv "XDG_RUNTIME_DIR") "/bus"))
> => nil
> --8<---------------cut here---------------end--------------->8---
> 
> Or
> 
> --8<---------------cut here---------------start------------->8---
> (make-directory "/tmp/foo")
> (file-attribute-modes (file-attributes "/tmp/foo"))
> => "drwxr-xr-x"
> 
> (make-symbolic-link "/tmp/foo" "/tmp/bar")
> (file-attribute-modes (file-attributes "/tmp/bar"))
> => "lrwxrwxrwx"
> 
> (file-regular-p "/tmp/bar")
> => nil
> --8<---------------cut here---------------end--------------->8---
> 
> for symbolic links.
> 
> Best regards, Michael.
> 





  reply	other threads:[~2023-01-20 14:16 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-19  6:03 bug#60943: 28.2; ‘tramp-handle-file-regular-p’ misses symlinks Greg Pfeil
2023-01-19 13:12 ` Michael Albinus
2023-01-19 17:55   ` Greg Pfeil
2023-01-20 10:56     ` Michael Albinus
2023-01-20 14:16       ` Greg Pfeil [this message]
2023-01-21 11:13         ` Michael Albinus

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5D199613-5B27-48CA-837E-13D6817825AD@technomadic.org \
    --to=greg@technomadic.org \
    --cc=60943@debbugs.gnu.org \
    --cc=michael.albinus@gmx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).