From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Robert Pluim Newsgroups: gmane.emacs.bugs Subject: bug#37884: 27.0.50; Cannot write to a file in VirtualBox shared directory Date: Tue, 29 Oct 2019 14:41:33 +0100 Message-ID: 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="87965"; mail-complaints-to="usenet@blaine.gmane.org" Cc: 37884@debbugs.gnu.org, Bernardo To: Andreas Schwab Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Oct 29 14:42:22 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 1iPRlN-000Mkz-OK for geb-bug-gnu-emacs@m.gmane.org; Tue, 29 Oct 2019 14:42:21 +0100 Original-Received: from localhost ([::1]:57016 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iPRlL-0004bT-An for geb-bug-gnu-emacs@m.gmane.org; Tue, 29 Oct 2019 09:42:19 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:56084) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iPRl5-0004Zz-QD for bug-gnu-emacs@gnu.org; Tue, 29 Oct 2019 09:42:04 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iPRl4-0005Ua-Ps for bug-gnu-emacs@gnu.org; Tue, 29 Oct 2019 09:42:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:38245) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iPRl4-0005UR-Ho for bug-gnu-emacs@gnu.org; Tue, 29 Oct 2019 09:42:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1iPRl4-00012l-CB for bug-gnu-emacs@gnu.org; Tue, 29 Oct 2019 09:42:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Robert Pluim Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 29 Oct 2019 13:42:02 +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.15723565053988 (code B ref 37884); Tue, 29 Oct 2019 13:42:02 +0000 Original-Received: (at 37884) by debbugs.gnu.org; 29 Oct 2019 13:41:45 +0000 Original-Received: from localhost ([127.0.0.1]:47066 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iPRkm-00012G-PV for submit@debbugs.gnu.org; Tue, 29 Oct 2019 09:41:45 -0400 Original-Received: from mail-wm1-f43.google.com ([209.85.128.43]:40573) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iPRkk-000120-4I for 37884@debbugs.gnu.org; Tue, 29 Oct 2019 09:41:42 -0400 Original-Received: by mail-wm1-f43.google.com with SMTP id w9so2458042wmm.5 for <37884@debbugs.gnu.org>; Tue, 29 Oct 2019 06:41:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:mail-copies-to:gmane-reply-to-list :date:in-reply-to:message-id:mime-version:content-transfer-encoding; bh=eukcuTPpTHCWpqwa6FTSn/I4X30UL98kfA0T4qAhw6I=; b=qZm5wX4E/l86MhGxIuJPqTOb/7gHoANEkJ4cBX5AWPBUB7X23AR9hDp05qFbC8UcED Y/n2iePr73MNozDwLM8WGRAn+e7wFBEvxeCYXqN6uM5b+xpKMdBS8VGQ/+D9UcAnRq9k iCf++FZ8ZcRhCI2aSbVor7xb2Z6PH5cTSgM9zPka1JJeltDR+fBy0oV2FVTv6yfKic6h VuQA/sVU5whOjm6WdhRrczcfuXo9ltxFn1X3Qtf5VdJJJQQdi0oejMcmfv/jPxL0bPMF BNuRByqA2gStPfzG9C8MVD/TUt+o2gstI5vCMGHZeTQSpWGDnOoGW3CfCjkdM3/VcDGR jETQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:mail-copies-to :gmane-reply-to-list:date:in-reply-to:message-id:mime-version :content-transfer-encoding; bh=eukcuTPpTHCWpqwa6FTSn/I4X30UL98kfA0T4qAhw6I=; b=aCepceWOeILTKv29xf3HC2CnPB+dwHAt0DLkO1TE4WuAgb2U1rpHHqtIh8c26B6rrd 6RSufQhfbc1Ni00tlxG5GbIHJAqxL7S0nXiqNLX/1/pIWAxmYpopaykhmR8EKuYcvECK sX3A/foz2MOJbjW7FQ7jwolb6qVNscb+7i4JHavrwLx1BAPKJUeCGFFO0Ifr+ZgwWLUG zgrpTnFmogk8tTvCeGVcT2v4ukIIsRleyXB/DB7L3cxJ17hEsN4YV9y7aNOm+SkKk7t7 LLg3+6T8tyTi4H677D8KwwTc9RzYoiJ+I0YFFmnBcleTINxOStPXOC7m53MJRDTkaZ8c i2Bw== X-Gm-Message-State: APjAAAWQEaj7Zc66kZdwO5K1o/0X1QoU+FiBt/hqgzxNa7C5IfjpivRr gdp6l46Imvx7/t5eRFbU3uIPVYO3 X-Google-Smtp-Source: APXvYqzpiNzicDw9lElEQOEqcuk75NHNJcfTeNqQtuyKBJ7UUHjMSA33j4q+NzT6JJhK2zverWvppQ== X-Received: by 2002:a1c:49c2:: with SMTP id w185mr4076211wma.16.1572356495607; Tue, 29 Oct 2019 06:41:35 -0700 (PDT) Original-Received: from rpluim-mac ([2a01:e34:ecfc:a860:100d:44e5:c295:82b2]) by smtp.gmail.com with ESMTPSA id x12sm15147445wru.93.2019.10.29.06.41.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Oct 2019 06:41:34 -0700 (PDT) Mail-Copies-To: never Gmane-Reply-To-List: yes In-Reply-To: (Andreas Schwab's message of "Tue, 29 Oct 2019 10:04:01 +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:170371 Archived-At: >>>>> On Tue, 29 Oct 2019 10:04:01 +0100, Andreas Schwab s= aid: Andreas> You need to move this check under the condition above, otherwi= se 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 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 SAFE_FREE (); }