From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Drew Adams Newsgroups: gmane.emacs.bugs Subject: bug#56673: 26.3; Doc of `file-equal-p' Date: Thu, 21 Jul 2022 16:12:29 +0000 Message-ID: References: <83o7xjngzc.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="19105"; mail-complaints-to="usenet@ciao.gmane.io" Cc: "56673-done@debbugs.gnu.org" <56673-done@debbugs.gnu.org> To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Jul 21 18:15:27 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 1oEYpj-0004pD-CB for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 21 Jul 2022 18:15:27 +0200 Original-Received: from localhost ([::1]:56406 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oEYpb-0003Zw-TV for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 21 Jul 2022 12:15:22 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:39426) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oEYnO-0000oL-6q for bug-gnu-emacs@gnu.org; Thu, 21 Jul 2022 12:13:06 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:49144) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oEYnN-0002WG-VB for bug-gnu-emacs@gnu.org; Thu, 21 Jul 2022 12:13:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oEYnN-0001OU-RV for bug-gnu-emacs@gnu.org; Thu, 21 Jul 2022 12:13:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Drew Adams Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 21 Jul 2022 16:13:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 56673 X-GNU-PR-Package: emacs Original-Received: via spool by 56673-done@debbugs.gnu.org id=D56673.16584199585290 (code D ref 56673); Thu, 21 Jul 2022 16:13:01 +0000 Original-Received: (at 56673-done) by debbugs.gnu.org; 21 Jul 2022 16:12:38 +0000 Original-Received: from localhost ([127.0.0.1]:38881 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oEYmz-0001NE-GY for submit@debbugs.gnu.org; Thu, 21 Jul 2022 12:12:37 -0400 Original-Received: from mx0b-00069f02.pphosted.com ([205.220.177.32]:22318) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oEYmv-0001Mw-7C for 56673-done@debbugs.gnu.org; Thu, 21 Jul 2022 12:12:35 -0400 Original-Received: from pps.filterd (m0246632.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 26LG6Aw9004892; Thu, 21 Jul 2022 16:12:32 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : references : in-reply-to : content-type : content-transfer-encoding : mime-version; s=corp-2022-7-12; bh=UknsumTp8zvIiwZQKocUABaJmo36EpJRYt4rdZuRi1w=; b=G3ve/jNrdVSNcAUmxkyjiT8Njhn2OKTD5KsfRAFIzeZeUOt96+ESq4jg2Brlaevc3yko ak5cKzvfOdMAb36HCjmuh/psKtQ9NaNBsU7OsfaW+KJPMsxjw1ZIZ7xkrJh+LuAAt5Bu da3CWaoGxtg62ifBdr+MXvzCu/oUM9PUDvpkO3ZufT3P0a+5GTRlPHIH3ZxCQm0FR0E7 R0lMcmyMW0H+C7oDtZKvMRshGg4EaGAiamRgzw9KdahEesxoVzogvhFJ0c4U5nU8lbK6 iYd2KkDeq+/mQcvzbVmNstBzz+erNNt0H86arP1AUdCDNOpg4P7vd1FqJ/jcV2eDex8u Ow== Original-Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3hbmxsd07j-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 21 Jul 2022 16:12:32 +0000 Original-Received: from pps.filterd (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 26LEpvDv002690; Thu, 21 Jul 2022 16:12:31 GMT Original-Received: from nam02-dm3-obe.outbound.protection.outlook.com (mail-dm3nam02lp2041.outbound.protection.outlook.com [104.47.56.41]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3hc1md88j6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 21 Jul 2022 16:12:31 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QFF0oX0uRxUoBcaj+otUNfkTDxDNs64mtYS62zIDziBq89aBXeFh07kLv2oyEZQDAxpsBd103lCu7Aq4H55XA5X4zfCWnw/RnKFt1U/II+pmExInbjMSCkHbnq8PQCsOfHB+7+Hsc6uijAwSaeDsnJjI+ATRarPyQLeuEQnBXATy3RaI1vjRzDj8s0VDziMS5qYfCqMLbm80t3VM0n3qVPSwwpJm+2UJNj3W+0Cz2tzs5C3eeOeAeBz566V747PPUCo+1MmlN1RGsCcAiPpC1ocQDaaEo49r7/HGnPh0DaFow1oOaTZfTvC2u/Zq9ZXYwzZrqAboGs2y4DuP0xsO6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=UknsumTp8zvIiwZQKocUABaJmo36EpJRYt4rdZuRi1w=; b=cvmwMYUNYZzo5ujG1FDglMSSVX0CjLYOQhxBmHWHO/Il6wpDoTXOtedqk7vBEld03IWflpi1ZvENMTGkkIICM+BoaVLnACd1zJ5ZAIG/LzLIuxa9a6jhjTrgdv3iylAGp3jvF2KEqeq23tq97D2ZIWkT9HZ+Zc9bUp0mLWK2dNgfdwAMhRM/UGOPXl2w3+BW52uKdi8OSIJLqxTHlMIqo3nVJSjzrsb+5hJKRnNBZKges5tyX8pywlmRINv6w+ex3anB2Kf4GQrii1sp3jJy37Yj1K7trPAOz9QpwGIQgcvdt3Wx68DtOZ8JMZonxB6SbggE+vIe0Df79bRn8o7Ocw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=UknsumTp8zvIiwZQKocUABaJmo36EpJRYt4rdZuRi1w=; b=CK8noB3PdQrSU9CSAo+95JRayUpMUXw/IhW+0uHUSx8DAZG6QShnKOnfcYavQl15ZhITSDcA81PDiqVwAs64IW6bRPxYscFYPdNedk9rYBYYJ3oc/8GUZcs+ATBiQdBg4BRJ6SlQU03X+2aELSAMMSv5MBcHuzx6oeki9WXOCHY= Original-Received: from SJ0PR10MB5488.namprd10.prod.outlook.com (2603:10b6:a03:37e::19) by DM6PR10MB4075.namprd10.prod.outlook.com (2603:10b6:5:1d4::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5438.17; Thu, 21 Jul 2022 16:12:29 +0000 Original-Received: from SJ0PR10MB5488.namprd10.prod.outlook.com ([fe80::581b:ae2f:16b9:80fb]) by SJ0PR10MB5488.namprd10.prod.outlook.com ([fe80::581b:ae2f:16b9:80fb%7]) with mapi id 15.20.5458.018; Thu, 21 Jul 2022 16:12:29 +0000 Thread-Topic: [External] : Re: bug#56673: 26.3; Doc of `file-equal-p' Thread-Index: AdiceRSs/yPvbZSkQsOdM8R1vk8/wAATgQbzABQH2tA= In-Reply-To: <83o7xjngzc.fsf@gnu.org> Accept-Language: en-US Content-Language: en-US x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: ec4b9e10-401a-445e-4a50-08da6b33cf9e x-ms-traffictypediagnostic: DM6PR10MB4075:EE_ x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: V/WhVq6gbxhTLEil7+F3x6vw891qDgzdQeB4zly4LIERiUpHfQHfDzzqt5B8HAF07+w4x+oi9X21MISO7XWmsqCSBaM5/2EKLl6zpNb9dkPWtTUcjEX/IkZDb4IHDiZVEorDsv/RKRAcgShRaElDDhlAqKNnKj4GDEtkZQl7XKCauXsUguGsBDQ1SZ1uL0rcduIa/fN/B6gEqzwfrLZESXNZj3Xsrm/OWisSOEA2IUYIVVSXxVMdwmflO1pBsXPw3KBohSO0W0GGr0Deu3LtTakeG1PWnCNPjYLh56ekETBKZv06oo4AKemX/UQ6EgbF7MW/afrB6Yc2MuwQzwo6XOvFVPPeumf+yrIFmnWAK3stDbeSu+U+tlN2bZI9C4fSAIbFttVsIgvXAPaXuIa8QrXrPPWwjl3P+whGOOlOdkelVJ6vEalrWztJ/SafPwwZqTniYpgf89ncNd74ZGu2upe01r86UgtnEuT/T/aEAqfTZaQy/8kvd9GyYy4KDp7xY7IwhySg4htcAz6gzXvwihXOeRdUxfZ6OJfuSP5nR6EXTH72/zPY2dMm2BKg2n2GJey5/1X5C5jRvoIUXmsIyEONwz17CwZXkfRQtMx9dc0+4r7lmja/zEFobVPl+6DMGRfI8I76dQ7ZUKw25Jb+n4m+LmUYzx99KODjm6+fnqH0ZAGYzliFtcX27w02uf84wMyN8PIFESvB6blXP64koLiv3V/GPW31ZB+CGklq28Lo6sqpK503oytmu3Lrn b2BeE6LpiMXXZzp020ENTFj0nCgQAuxRpXQ22ZVP7iOjzXstp0p19Wgm7Lg1aiQEQOTQWlK/hcr2jEoc5AFHNKStg== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SJ0PR10MB5488.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230016)(366004)(346002)(396003)(39860400002)(136003)(376002)(6506007)(186003)(71200400001)(41300700001)(5660300002)(26005)(7696005)(478600001)(83380400001)(55016003)(9686003)(44832011)(76116006)(8936002)(6916009)(8676002)(4326008)(64756008)(38070700005)(66946007)(66446008)(122000001)(66476007)(316002)(33656002)(66556008)(2906002)(38100700002)(86362001)(52536014)(81973001); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: P4QyB8UGAfSG5Uwqnj1yMxirH1L6hoYPMxL/NF04z5pktYZtuBnFod4zDThfm8FbV9AjQOKuV6b26LvUW01ZTxl1y2tlXNOtMJBUTbtVlKhqH1f7dsdNcwzWP9M0D77CmGKkkLIO9AyqVknkONEcYS4jS3O2Zu6ipKAtS4rT+QS/5lhjPugRyJCs3tiMrsPeBFKxPuKvyNJUsBZpXPJpwgefXBC/UGdFuS3Dtorb/36DNlIlz+Fx1R96h6cd71mWcRXDR5VfV4jWU9YqG3Z78PxwCazQUOdRKGU9+c0TxMak4oL7jjVWjtyMVelhUUHc095jNswaHRGJxl9Ao4a4UDe8+6Eda9Rx1McLlrV5YA2DnWvDQP1XSRsHBiHU9UK2JcfQlKgHhDFTKalKuaNBfaBQ3dSnUQ747flBy0tmqEjt9Hke1ZzS18944Bl43VOC7n+zvwL1TJH5JtgeOrXi31eSPrXPtVNyy4xgvB/30ocai2DBU/tSn9jrwH0tuW1E40YqGcBFxithrhMxZFOq5O5Sy/MOMnpLbOMORWKCYqETXbo0d0hAxi7n+Yx0UMgfZ2uTFTwfDGl0V2zsi9VBvydeRC3I6JfBHMN0SE24smMJyahtIMXEaXBQuoMSULFYsr0nSycheOOyt+WUndouPTAcWkKSmWgO0mbWgwnhnB9wld2iGyfoMiW9uFywm/ud2ItLhyD3Q3oXo2JGoRh8057wEhFAsfYUlp7gEh8ObeOi6bppU0AxHu7yN4 fqxPg8BWPr9Y2WgB734qvv63/V9aNx2LoFBgbF4tTvhJBLq3p1y0ZgtEIYD/2cjnCl/4N8eIWeIl9A7yv77fG+NPwBidrjLVfm X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: SJ0PR10MB5488.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: ec4b9e10-401a-445e-4a50-08da6b33cf9e X-MS-Exchange-CrossTenant-originalarrivaltime: 21 Jul 2022 16:12:29.5858 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: kUWcz90BAr/FutaVlglUfACUW0JpDWRSHFb6x7QXwyMX+W+V56ZNmPwgWIclcN4bISudNczIHs7CntBgAy77DA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR10MB4075 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.883,Hydra:6.0.517,FMLib:17.11.122.1 definitions=2022-07-21_22,2022-07-20_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 bulkscore=0 phishscore=0 suspectscore=0 mlxlogscore=700 adultscore=0 spamscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2206140000 definitions=main-2207210065 X-Proofpoint-GUID: sZsMg3nBc711ziRSeiTGZc9hEsB2OMhw X-Proofpoint-ORIG-GUID: sZsMg3nBc711ziRSeiTGZc9hEsB2OMhw 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:237561 Archived-At: > > 1. I don't understand this part of the doc (in both doc string and > > manual): > > > > If FILE1 or FILE2 does not exist, the return value is unspecified. > > > > What's that about? >=20 > It means the result could be anything: nil or non-nil, and you > shouldn't expect anything specific. IOW, don't call this > function unless both files exist. > > > In what case(s) is the result unspecified because=20 > > one or both file doesn't exist? >=20 > All of them. There was a long discussion of this in=20 > bug#10489, and I'm not interested in reopening it. Thanks for reminding me of that thread. I've scanned it again now. My review of the thread reinforces to me that the _only_ case where a nonexistent file could possibly result in a non-nil return value is when a file handler is used. Do you disagree that that's the only case? If that's the only case, then could we perhaps say something like this (statement, not wording)? If neither file name has a `file-equal-p' handler then if either file does not exist the return value is nil. If either name has a `file-equal-p' handler then the return value could be nil or non-nil when either file does not exist. That first paragraph lets users know about an important, common use case - they may well know that no handler is involved in their use context. IIUC (correct me if wrong, please), code such as this would be correct, to handle the handler case also. But it would be costly, and would make useless any optimization a handler might make by not testing for existence. (defun file-equal-existing-p (file1 file2) "..." (let ((handler (or (find-file-name-handler file1 'file-equal-p) (find-file-name-handler file2 'file-equal-p)))) (if handler ;; Or a different `and' order... (and (funcall handler 'file-equal-p file1 file2) (file-exists-p file1) (file-exists-p file2)) (let (f1-attr f2-attr) (and (setq f1-attr (file-attributes (file-truename file1)) f2-attr (file-attributes (file-truename file2))) (equal f1-attr f2-attr)))))) And code such as this would cover the simple use case: (defun file-equal-no-handler-p (file1 file2) "..." (let ((handler (or (find-file-name-handler file1 'file-equal-p) (find-file-name-handler file2 'file-equal-p))) f1-attr f2-attr) (and (not handler)=20 (setq f1-attr (file-attributes (file-truename file1)) f2-attr (file-attributes (file-truename file2))) (equal f1-attr f2-attr)))))) > > 2. How about adding this sentence from the manual to=20 > > the doc string (also)? > > > > This is similar to comparing their truenames, except that > > remote file names are also handled in an appropriate manner. >=20 > The doc string already says that, albeit with different words. I don't see how it even vaguely suggests that, in any way. Could you point to the wording you think "already says that"? We have lots of `file-*' functions. It's fairly important that we make clear what each does, so users can make best use of them.