From: Bernardo <bernardo.bacic@pobox.com>
To: Robert Pluim <rpluim@gmail.com>
Cc: Andreas Schwab <schwab@suse.de>, 37884@debbugs.gnu.org
Subject: bug#37884: 27.0.50; Cannot write to a file in VirtualBox shared directory
Date: Wed, 30 Oct 2019 19:44:35 +1100 [thread overview]
Message-ID: <87sgnad3m4.fsf@pobox.com> (raw)
In-Reply-To: <m2d0efpt2q.fsf@gmail.com> (Robert Pluim's message of "Tue, 29 Oct 2019 14:41:33 +0100")
Robert Pluim <rpluim@gmail.com> writes:
>>>>>> On Tue, 29 Oct 2019 10:04:01 +0100, Andreas Schwab <schwab@suse.de> said:
> Andreas> You need to move this check under the condition above, otherwise 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 = 0;
> >> + errno = 0;
>
> Indeed. Next time maybe Iʼll 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)
>
> int err = current_lock_owner (0, lfname);
> if (err == -2 && unlink (lfname) != 0 && errno != ENOENT)
> + {
> err = 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 == EPERM)
> + {
> + chmod (lfname, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
> + err = 0;
> + if (unlink (lfname) != 0 && errno != ENOENT)
> + err = errno;
> + }
> + }
> + if (0 < err)
> + report_file_errno ("Unlocking file", filename, err);
>
> SAFE_FREE ();
> }
confirmed this patch works fine;
thanks for the effort (and persistence)
--
Rgds, Bernardo
next prev parent reply other threads:[~2019-10-30 8:44 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-23 10:28 bug#37884: 27.0.50; Cannot write to a file in VirtualBox shared directory Bernardo
2019-10-24 16:10 ` Robert Pluim
[not found] ` <87blu2emi3.fsf@pobox.com>
2019-10-27 15:34 ` Robert Pluim
2019-10-27 15:52 ` Eli Zaretskii
2019-10-27 16:01 ` Robert Pluim
2019-10-27 16:34 ` Eli Zaretskii
2019-10-28 9:23 ` Bernardo
2019-10-28 12:32 ` Robert Pluim
2019-10-29 8:50 ` Bernardo
2019-10-29 9:04 ` Andreas Schwab
2019-10-29 13:41 ` Robert Pluim
2019-10-30 8:44 ` Bernardo [this message]
2019-10-30 13:31 ` Robert Pluim
2019-10-30 16:25 ` Eli Zaretskii
2019-10-31 1:41 ` Paul Eggert
2019-10-31 7:38 ` Robert Pluim
2019-10-31 14:37 ` Eli Zaretskii
2019-10-31 21:24 ` Paul Eggert
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87sgnad3m4.fsf@pobox.com \
--to=bernardo.bacic@pobox.com \
--cc=37884@debbugs.gnu.org \
--cc=rpluim@gmail.com \
--cc=schwab@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).