From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Lars Ingebrigtsen Newsgroups: gmane.emacs.bugs 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 Message-ID: <87edvc9qvp.fsf@gnus.org> References: <87lepmusw5.fsf@posteo.net> <87pmexcn1h.fsf@gnus.org> <87edvd5bun.fsf@gmx.de> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="9050"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Thierry Volpiatto , 58446@debbugs.gnu.org To: Michael Albinus Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Oct 13 08:52:40 2022 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 1ois59-00028b-UT for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 13 Oct 2022 08:52:39 +0200 Original-Received: from localhost ([::1]:53172 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ois58-0004k0-L0 for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 13 Oct 2022 02:52:38 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:48252) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oirlH-0000jM-IY for bug-gnu-emacs@gnu.org; Thu, 13 Oct 2022 02:32:10 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:59993) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oirlC-0003gK-2w for bug-gnu-emacs@gnu.org; Thu, 13 Oct 2022 02:32:07 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oirlB-00010P-Jz for bug-gnu-emacs@gnu.org; Thu, 13 Oct 2022 02:32:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Lars Ingebrigtsen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 13 Oct 2022 06:32:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 58446 X-GNU-PR-Package: emacs Original-Received: via spool by 58446-submit@debbugs.gnu.org id=B58446.16656426783813 (code B ref 58446); Thu, 13 Oct 2022 06:32:01 +0000 Original-Received: (at 58446) by debbugs.gnu.org; 13 Oct 2022 06:31:18 +0000 Original-Received: from localhost ([127.0.0.1]:59071 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oirkU-0000zQ-0t for submit@debbugs.gnu.org; Thu, 13 Oct 2022 02:31:18 -0400 Original-Received: from quimby.gnus.org ([95.216.78.240]:59442) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oirkS-0000zC-91 for 58446@debbugs.gnu.org; Thu, 13 Oct 2022 02:31:16 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Type:MIME-Version:Message-ID:Date:References: In-Reply-To:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=VLuBpitqmfF/yC22UjbGsHQBLlXi9poEfmUr3N1ht9c=; b=vQiA6q1xLFX/WqMfEplpmTgyz/ ou13A1BhIu/GYeqzrIiT07UPo980f0RfGJDynflnu/NrTTHZnuNsbA1KxFwiwXFDf/0Vl7d1TKr8m wRyhRKe2ZKM+cwXTObuiAEz+G88qUYxSKi8GFunlIUhAuExCyyrf2KSXi+sDuCdbUAIo=; Original-Received: from [84.212.220.105] (helo=downe) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oirkI-0005H4-M5; Thu, 13 Oct 2022 08:31:09 +0200 In-Reply-To: <87edvd5bun.fsf@gmx.de> (Michael Albinus's message of "Wed, 12 Oct 2022 16:57:04 +0200") Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwAgMAAAAqbBEUAAAABGdBTUEAALGPC/xhBQAAACBj SFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAADFBMVEXR0MuAf31OTU3/ //8fmzB2AAAAAWJLR0QDEQxM8gAAAAd0SU1FB+YKDQYbFANy8RYAAAFVSURBVCjPTdKxTsMwEAbg /6I4opmCRJHSHUTzFI7UdmDy0A7NxACoyVOABBJjQChSmTokqL6nxGfTKh5sf7J9PucCIGdpWwPX 1LPMbdMKGv4Rdd9uTtz5bYMgsZB5Pz86pEcS6HTrMDtEsoBkL3gtuCoNonfB/Ywz0qCVgLUFuahf HswboNp8SjR3O+uIl4LE3cdtxGbwGUhk4t6G3Kqhp21W+6z3arN2460AH77HzRiFlv5ijEnAfIw7 jFd8n46RAOv4DI06B+oTCvfRbECLqQt7PEFaH+AHCkgtcW0uw7ZZRU8GV/9IJat1uGebaGVol3tM qVet2k10gCUXUnnExEtzfSCPRc7d4KrokdXc7bnUmYetpFovfoW44sHiIeTGK4vHM0ouWxx0QMu/ Gv4hk4j7hkFvEq1I5G9BtCApSRlKH2clqCnrxr1SKRhQRU3tDsfKZH96SXyAqR/HgQAAACV0RVh0 ZGF0ZTpjcmVhdGUAMjAyMi0xMC0xM1QwNjoyNzoyMCswMDowMLG1kZ0AAAAldEVYdGRhdGU6bW9k aWZ5ADIwMjItMTAtMTNUMDY6Mjc6MjArMDA6MDDA6CkhAAAAAElFTkSuQmCC X-Now-Playing: Rival Consoles's _Kid Velo_: "Kid Velo" 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" Xref: news.gmane.io gmane.emacs.bugs:245269 Archived-At: Michael Albinus 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.