GNU bug report logs -
#37884
27.0.50; Cannot write to a file in VirtualBox shared directory
Previous Next
Reported by: Bernardo <bernardo.bacic <at> pobox.com>
Date: Wed, 23 Oct 2019 10:29:01 UTC
Severity: normal
Found in version 27.0.50
Done: Paul Eggert <eggert <at> cs.ucla.edu>
Bug is archived. No further changes may be made.
Full log
Message #38 received at 37884 <at> debbugs.gnu.org (full text, mbox):
Robert Pluim <rpluim <at> gmail.com> writes:
>>>>>> On Tue, 29 Oct 2019 10:04:01 +0100, Andreas Schwab <schwab <at> 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
This bug report was last modified 5 years and 205 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.