From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Bernardo Newsgroups: gmane.emacs.bugs Subject: bug#37884: 27.0.50; Cannot write to a file in VirtualBox shared directory Date: Wed, 30 Oct 2019 19:44:35 +1100 Message-ID: <87sgnad3m4.fsf@pobox.com> References: <87h83zeoy1.fsf@pobox.com> <87blu2emi3.fsf@pobox.com> <83lft6rxrs.fsf@gnu.org> <874kztdy0l.fsf@pobox.com> <87zhhkc4vs.fsf@pobox.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="241430"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Andreas Schwab , 37884@debbugs.gnu.org To: Robert Pluim Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Oct 30 09:45:38 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1iPjbl-0010cF-5s for geb-bug-gnu-emacs@m.gmane.org; Wed, 30 Oct 2019 09:45:37 +0100 Original-Received: from localhost ([::1]:37914 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iPjbj-00061h-MR for geb-bug-gnu-emacs@m.gmane.org; Wed, 30 Oct 2019 04:45:35 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:46269) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iPjbE-00060a-A1 for bug-gnu-emacs@gnu.org; Wed, 30 Oct 2019 04:45:05 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iPjbC-0006eM-3C for bug-gnu-emacs@gnu.org; Wed, 30 Oct 2019 04:45:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:40384) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iPjbB-0006bf-UT for bug-gnu-emacs@gnu.org; Wed, 30 Oct 2019 04:45:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1iPjbB-0002wD-MU for bug-gnu-emacs@gnu.org; Wed, 30 Oct 2019 04:45:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Bernardo Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 30 Oct 2019 08:45:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 37884 X-GNU-PR-Package: emacs Original-Received: via spool by 37884-submit@debbugs.gnu.org id=B37884.157242509011262 (code B ref 37884); Wed, 30 Oct 2019 08:45:01 +0000 Original-Received: (at 37884) by debbugs.gnu.org; 30 Oct 2019 08:44:50 +0000 Original-Received: from localhost ([127.0.0.1]:49205 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iPjb0-0002vZ-EO for submit@debbugs.gnu.org; Wed, 30 Oct 2019 04:44:50 -0400 Original-Received: from pecan2-mail.exetel.com.au ([220.233.0.71]:33777 helo=pecan2.exetel.com.au) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iPjaw-0002vI-3r for 37884@debbugs.gnu.org; Wed, 30 Oct 2019 04:44:48 -0400 Original-Received: from 206.199.233.220.static.exetel.com.au ([220.233.199.206] helo=deb) by pecan2.exetel.com.au with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.91) (envelope-from ) id 1iPjal-00025z-Sc; Wed, 30 Oct 2019 19:44:35 +1100 In-Reply-To: (Robert Pluim's message of "Tue, 29 Oct 2019 14:41:33 +0100") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 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.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:170396 Archived-At: Robert Pluim writes: >>>>>> On Tue, 29 Oct 2019 10:04:01 +0100, Andreas Schwab = said: > Andreas> You need to move this check under the condition above, other= wise you may > Andreas> get a false positive if unlink didn't fail or wasn't called = at all. > > >> + { > >> + chmod (lfname, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); > >> + err =3D 0; > >> + errno =3D 0; > > Indeed. Next time maybe I=CA=BCll try actually compiling my patches before > I send them. Take 3 > > diff --git a/src/filelock.c b/src/filelock.c > index ff25d6475d..bd1e8d9b2d 100644 > --- a/src/filelock.c > +++ b/src/filelock.c > @@ -731,9 +731,20 @@ unlock_file (Lisp_Object fn) >=20=20 > int err =3D current_lock_owner (0, lfname); > if (err =3D=3D -2 && unlink (lfname) !=3D 0 && errno !=3D ENOENT) > + { > err =3D errno; > - if (0 < err) > - report_file_errno ("Unlocking file", filename, err); > + /* On certain filesystems the file must be writable for unlink to > + succeed, so make it writable and retry (Bug#37784). */ > + if (errno =3D=3D EPERM) > + { > + chmod (lfname, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); > + err =3D 0; > + if (unlink (lfname) !=3D 0 && errno !=3D ENOENT) > + err =3D errno; > + } > + } > + if (0 < err) > + report_file_errno ("Unlocking file", filename, err); >=20=20 > SAFE_FREE (); > } confirmed this patch works fine; thanks for the effort (and persistence) --=20 Rgds, Bernardo