From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Paul Eggert Newsgroups: gmane.emacs.bugs Subject: bug#46397: 27.1; Cannot delete buffer pointing to a file in a path that includes a file Date: Fri, 12 Feb 2021 01:36:30 -0800 Organization: UCLA Computer Science Department Message-ID: <2ce4897b-56ac-9409-b5e8-c735528e48f1@cs.ucla.edu> References: <87h7mllgin.fsf@nexoid.at> <83a6scj745.fsf@gnu.org> <39d0e035-27b6-e2bd-daa2-747dda2c1a35@cs.ucla.edu> <835z2ziu52.fsf@gnu.org> <83pn15g28y.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="14594"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.6.1 Cc: gmatta@gmail.com, 46397@debbugs.gnu.org, craven@gmx.net, Matt Armstrong To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Feb 12 10:37:12 2021 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 1lAUsy-0003h4-9z for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 12 Feb 2021 10:37:12 +0100 Original-Received: from localhost ([::1]:35590 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lAUsx-0007ad-BQ for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 12 Feb 2021 04:37:11 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:55340) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lAUso-0007X4-Gj for bug-gnu-emacs@gnu.org; Fri, 12 Feb 2021 04:37:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:48376) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lAUso-0002kN-98 for bug-gnu-emacs@gnu.org; Fri, 12 Feb 2021 04:37:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lAUso-0007eS-4f for bug-gnu-emacs@gnu.org; Fri, 12 Feb 2021 04:37:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Paul Eggert Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 12 Feb 2021 09:37:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 46397 X-GNU-PR-Package: emacs Original-Received: via spool by 46397-submit@debbugs.gnu.org id=B46397.161312260029381 (code B ref 46397); Fri, 12 Feb 2021 09:37:02 +0000 Original-Received: (at 46397) by debbugs.gnu.org; 12 Feb 2021 09:36:40 +0000 Original-Received: from localhost ([127.0.0.1]:59922 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lAUsR-0007dp-VO for submit@debbugs.gnu.org; Fri, 12 Feb 2021 04:36:40 -0500 Original-Received: from zimbra.cs.ucla.edu ([131.179.128.68]:44436) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lAUsP-0007da-DA for 46397@debbugs.gnu.org; Fri, 12 Feb 2021 04:36:38 -0500 Original-Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 5C923160054; Fri, 12 Feb 2021 01:36:31 -0800 (PST) Original-Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id baHUaAZ4HwAP; Fri, 12 Feb 2021 01:36:30 -0800 (PST) Original-Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 9550D1600FE; Fri, 12 Feb 2021 01:36:30 -0800 (PST) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu Original-Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id vTs4D2b7K2Wn; Fri, 12 Feb 2021 01:36:30 -0800 (PST) Original-Received: from [192.168.1.9] (cpe-23-243-218-95.socal.res.rr.com [23.243.218.95]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id 66834160054; Fri, 12 Feb 2021 01:36:30 -0800 (PST) In-Reply-To: <83pn15g28y.fsf@gnu.org> Content-Language: en-US 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:199847 Archived-At: On 2/11/21 11:43 PM, Eli Zaretskii wrote: >> From: Matt Armstrong >> In this case, Paul's commit changes the current_lock_owner() function >> such that it returns zero upon ENOTDIR. The caller must interpret the >> zero return as meaning "at the time current_lock_owner() was called, >> nobody owned the lock file...or the lock file was obsolete." >> >> ENOTDIR has a specific meaning that we can rely on. Both ENOENT and >> ENOTDIR imply that the file was definitely not on disk at the time of >> the call. Because of this, current_lock_owner() can safely conclude th= at >> nobody owned the lock. >=20 > "Definitely"? "safely"? How do you arrive at that conclusion? >=20 > The Posix spec of 'unlink' says: Matt was talking about current_lock_owner, a function that does not call=20 'unlink', so it's not clear why the 'unlink' spec is relevant here. current_lock_owner eventually calls either readlinkat or (on systems=20 without symlinks) openat. If either fails with ENOTDIR, some ancestor of=20 the lock file is a non-directory, hence the lock file itself cannot=20 possibly exist and therefore it must be the case that nobody owns the=20 lock. This is true regardless of which particular ancestor is a=20 non-directory. (The lockfile name does not end in "/", so we needn't=20 worry about that case here.)