GNU bug report logs - #37884
27.0.50; Cannot write to a file in VirtualBox shared directory

Previous Next

Package: emacs;

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 #32 received at 37884 <at> debbugs.gnu.org (full text, mbox):

From: Andreas Schwab <schwab <at> suse.de>
To: Bernardo <bernardo.bacic <at> pobox.com>
Cc: 37884 <at> debbugs.gnu.org, Robert Pluim <rpluim <at> gmail.com>
Subject: Re: bug#37884: 27.0.50;
 Cannot write to a file in VirtualBox shared directory
Date: Tue, 29 Oct 2019 10:04:01 +0100
On Okt 29 2019, Bernardo wrote:

> diff --git a/src/filelock.c b/src/filelock.c
> index ff25d6475d..046a1b014f 100644
> --- a/src/filelock.c
> +++ b/src/filelock.c
> @@ -732,6 +732,16 @@ unlock_file (Lisp_Object fn)
>    int err = current_lock_owner (0, lfname);
>    if (err == -2 && unlink (lfname) != 0 && errno != ENOENT)
>      err = errno;
> +  /* On certain filesystems the file must be writable for unlink to
> +     succeed (Bug#37784).  */
> +  if (errno == EPERM)

You need to move this check under the condition above, otherwise you may
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;

No need to clear errno here.

> +      if (unlink (lfname) != 0 && errno != ENOENT)
> +       err = errno;
> +    }

Andreas.

-- 
Andreas Schwab, SUSE Labs, schwab <at> suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."




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.