From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: file-equal-p Date: Fri, 17 Feb 2023 14:25:38 +0200 Message-ID: <83ilg01nst.fsf@gnu.org> References: <87a61es8fh.fsf.ref@yahoo.com> <87a61es8fh.fsf@yahoo.com> <87v8k06247.fsf@igel.home> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="22927"; mail-complaints-to="usenet@ciao.gmane.io" Cc: rms@gnu.org, luangruo@yahoo.com, emacs-devel@gnu.org To: Andreas Schwab Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri Feb 17 13:26:11 2023 Return-path: Envelope-to: ged-emacs-devel@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 1pSzoZ-0005lL-TU for ged-emacs-devel@m.gmane-mx.org; Fri, 17 Feb 2023 13:26:11 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pSzoF-0005ht-Ej; Fri, 17 Feb 2023 07:25:51 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pSzoC-0005cW-8b for emacs-devel@gnu.org; Fri, 17 Feb 2023 07:25:49 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pSzoB-0002ua-DT; Fri, 17 Feb 2023 07:25:47 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=0y2z0e7uR8oFTXgTEMYqLsaCHsHdDi8Ebe1mk49Xcow=; b=I2XshEgcVSOB rMEJBHJCCYG0iD4gzGKHUpPhU3qWjfGK6ctK5aEBBF23RmJ+L/MUhQ1dF2vNepPJ9OB+DRnIqNH59 uW8tmb+ZkXesqfq5eULhdsSoGmDWmaHZtqBZQP8pe3gtMbCoRhp9DSFdMbbE9khkS5VEjfdghNraD flKGFcHFlqXMDvyNlxMX5e6HUMmRqvf8iEHw8N0hew8NPHk07stQ5i11GilSLrl6XrgtnKSfoDNJ/ +oFd8VAGnNENZx/QH7cZtTo/kgFg/GNB/y+vniYOjeN3+tvoBbVzSkxisMs4Io9fv1mnv9h7yu93y xtugFrxSsDNeAOZNhoxNpw==; Original-Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pSzo3-0005jb-30; Fri, 17 Feb 2023 07:25:39 -0500 In-Reply-To: <87v8k06247.fsf@igel.home> (message from Andreas Schwab on Fri, 17 Feb 2023 11:02:48 +0100) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:303469 Archived-At: > From: Andreas Schwab > Cc: Po Lu , emacs-devel@gnu.org > Date: Fri, 17 Feb 2023 11:02:48 +0100 > > On Feb 16 2023, Richard Stallman wrote: > > > If so, can Emacs examine it using that other way? > > The right way to solve the issue is to only compare the inode and device > numbers. The other attributes (other than the type) can change any time > for unrelated reasons, and do not define the identity of a file. That depends on the semantics of "files are equal". If the issue is only whether two file names point to the same file's data, then yes, using file-attribute-file-identifier is TRT. But that is not the only possible semantics of these tests. It is therefore up to the application to decide which API to use, IMO. Of course, as long as the file is identified only by its name, race condition is possible even if we only compare the inode and the device number.