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

From: Robert Pluim <rpluim <at> gmail.com>
To: Bernardo <bernardo.bacic <at> pobox.com>
Cc: 37884 <at> debbugs.gnu.org
Subject: Re: bug#37884: 27.0.50; Cannot write to a file in VirtualBox shared
 directory
Date: Thu, 24 Oct 2019 18:10:59 +0200
>>>>> On Wed, 23 Oct 2019 21:28:06 +1100, Bernardo <bernardo.bacic <at> pobox.com> said:

    Bernardo> When Emacs is started with strace ( $ strace emacs -Q ) it can be seen
    Bernardo> that there are issues with the lock file that's created -
    Bernardo> /media/sf_Home/.#zz_stuff

    Bernardo> The strace messages are in the attachement.

Weʼre getting EPERM when doing unlink on the lock file, which is very
strange.

    Bernardo> The 'shared directory' is a feature of Virtual Box which allows both the
    Bernardo> host and applications running in a virtual machine to have access to
    Bernardo> files in the same directory.

    Bernardo> The file system type of the shared directory is vboxsf which seems to be
    Bernardo> a layer on top of NTFS.
    Bernardo>   $ mount | grep vbox
    Bernardo>   Home on /media/sf_Home type vboxsf (rw,nodev,relatime,<snip>

    Bernardo> It looks like symbolic links are not allowed on
    Bernardo> this FS type; from terminal:
    Bernardo>   $ ln -s zz_stuff my_link
    Bernardo>   ln: failed to create symbolic link 'my_link': Operation not permitted

Right, so emacs switches to a regular file instead:

symlink fails:
    symlink("mk7 <at> deb.2246:1571819801", "/media/sf_Home/.#zz_stuff") = -1 EPERM (Operation not permitted)

so use a regular file:

    open("/media/sf_Home/.#-emacsvxLcB2", O_RDWR|O_CREAT|O_EXCL|O_CLOEXEC, 0600) = 13

and put the lock information inside the file, and make it read-only:

    write(13, "mk7 <at> deb.2246:1571819801", 23) = 23
    fchmod(13, 0444)                        = 0

and then rename it:

    "/media/sf_Home/.#zz_stuff", RENAME_NOREPLACE) = 0

Later on when emacs saves the file, it tries to get rid of the lock
file, which fails:

    unlink("/media/sf_Home/.#zz_stuff")     = -1 EPERM (Operation not permitted)

So your filesystem doesnʼt let you call unlink() on read-only files? I
guess we could try adjusting the chmod to 664 or similar if that helps here.

Robert




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.