unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Michael Albinus <michael.albinus@gmx.de>
To: Greg Pfeil <greg@technomadic.org>
Cc: 60943@debbugs.gnu.org
Subject: bug#60943: 28.2; ‘tramp-handle-file-regular-p’ misses symlinks
Date: Fri, 20 Jan 2023 11:56:07 +0100	[thread overview]
Message-ID: <877cxhv5iw.fsf@gmx.de> (raw)
In-Reply-To: <8B66E6A4-13D0-49B1-B2B5-52A561960C39@technomadic.org> (Greg Pfeil's message of "Thu, 19 Jan 2023 10:55:45 -0700")

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 10:56 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 [this message]
2023-01-20 14:16       ` Greg Pfeil
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=877cxhv5iw.fsf@gmx.de \
    --to=michael.albinus@gmx.de \
    --cc=60943@debbugs.gnu.org \
    --cc=greg@technomadic.org \
    /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).