[Bug 6111] New: remotefilelog and fsannotate extensions do not work on Solaris because of flock

mercurial-bugs at mercurial-scm.org mercurial-bugs at mercurial-scm.org
Thu Apr 4 06:54:14 UTC 2019


https://bz.mercurial-scm.org/show_bug.cgi?id=6111

            Bug ID: 6111
           Summary: remotefilelog and fsannotate extensions do not work on
                    Solaris because of flock
           Product: Mercurial
           Version: 4.9
          Hardware: PC
                OS: Linux
            Status: UNCONFIRMED
          Severity: feature
          Priority: wish
         Component: Mercurial
          Assignee: bugzilla at mercurial-scm.org
          Reporter: vlmarek13 at gmail.com
                CC: mercurial-devel at mercurial-scm.org

Created attachment 2040
  --> https://bz.mercurial-scm.org/attachment.cgi?id=2040&action=edit
Opening the files used for locking in readwrite rather than readonly mode

Hi,

The Mercurial test suite is failing on Solaris and so are the two modules I
believe. The problem is that remotefilelog and fsannotate extensions are using

fcntl.flock(lockfd, fcntl.LOCK_EX)

flock is not implemented on Solaris, so python is emulating the behavior via
fcntl F_SETLKW.

https://github.com/python/cpython/blob/master/Modules/fcntlmodule.c
420   ret = fcntl(fd, (code & LOCK_NB) ? F_SETLK : F_SETLKW, &l);

But fcntl needs to have the lockfd file opened for writing as documented in
fcntl(2):

       An  exclusive lock will prevent any other process from setting a shared
       lock or an exclusive lock on any  portion  of  the  protected  area.  A
       request  for an exclusive lock will fail if the file descriptor was not
       opened with write access.

The extensions are opening the file as O_RDONLY. Changing that to O_RDWR makes
the test suite to pass. The fcntl module is not opening the files but rather
it's getting the fd from caller, so I believe that the fix should go to
mercurial.

I am attaching the patch

Thank you
__ 
 Vlad

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the Mercurial-devel mailing list