all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Lars Ingebrigtsen <larsi@gnus.org>
To: Michael Albinus <michael.albinus@gmx.de>
Cc: Thierry Volpiatto <thievol@posteo.net>, 58446@debbugs.gnu.org
Subject: bug#58446: 28.2; file-attribute-device-number returns a cons cell instead of an integer
Date: Thu, 13 Oct 2022 08:31:06 +0200	[thread overview]
Message-ID: <87edvc9qvp.fsf@gnus.org> (raw)
In-Reply-To: <87edvd5bun.fsf@gmx.de> (Michael Albinus's message of "Wed, 12 Oct 2022 16:57:04 +0200")

Michael Albinus <michael.albinus@gmx.de> writes:

[explanation snipped]

> As said, this change happend almost 20 years ago. Device numbers are
> usually ignored by Emacs and external packages, I don't remember a
> problem report for this over the years. Emacs core creates the
> buffer-local variable buffer-file-number, which is indeed (INODE
> DEVNUM). See basic-save-buffer:
>
> 	      (setq buffer-file-number
> 		    (nthcdr 10 (file-attributes buffer-file-name)))
>
> And this variable is used for checking whether two files are equal, see
> find-buffer-visiting:
>
>                             (equal buffer-file-number number)
>
> That's why it works also with Tramp's interpretation of device
> numbers. And again, w/o blame over the years.

Yes, I agree -- we should probably just document this.  But I was
wondering whether it would be useful to make the `file-attribute'
structure extendable?  We could have a twelfth (optional) element that
could be an plist of properties, and then we'd have a place to stash
stuff.

(That might break stuff, though.)

But if we haven't needed that until now, we're probably not going to
need it going forward, and we should just document the current status
quo. 

> And perhaps we could even add a helper function to extract the
> information for a file's uniqueness:
>
> (defsubst file-attribute-file-number (attributes)
>   "The inode and device numbers in ATTRIBUTES returned by `file-attributes'.
> It can be used to determine whether two files are identical."
>   (nthcdr 10 attributes))
>
> WDYT?

Makes sense to me.





  reply	other threads:[~2022-10-13  6:31 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-11 18:11 bug#58446: 28.2; file-attribute-device-number returns a cons cell instead of an integer Thierry Volpiatto
2022-10-12 11:13 ` Lars Ingebrigtsen
2022-10-12 14:57   ` Michael Albinus
2022-10-13  6:31     ` Lars Ingebrigtsen [this message]
2022-10-13  7:09       ` Eli Zaretskii
2022-10-13 19:16         ` Michael Albinus
2022-10-14 17:04     ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-10-14 17:28       ` Michael Albinus
2022-10-14 18:34         ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-10-14 19:03           ` Michael Albinus
2022-10-14 19:14             ` Eli Zaretskii
2022-10-14 19:33               ` 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

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

  git send-email \
    --in-reply-to=87edvc9qvp.fsf@gnus.org \
    --to=larsi@gnus.org \
    --cc=58446@debbugs.gnu.org \
    --cc=michael.albinus@gmx.de \
    --cc=thievol@posteo.net \
    /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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.