Bug 5882 - 'hg push' fails on read-only filesystem
Summary: 'hg push' fails on read-only filesystem
Status: RESOLVED FIXED
Alias: None
Product: Mercurial
Classification: Unclassified
Component: Mercurial (show other bugs)
Version: unspecified
Hardware: PC Other
: normal bug
Assignee: Bugzilla
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-05-11 09:05 UTC by Josef "Jeff" Sipek
Modified: 2018-05-22 20:19 UTC (History)
2 users (show)

See Also:
Python Version: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Josef "Jeff" Sipek 2018-05-11 09:05 UTC
$ cd /local/fs/that/is/mounted/read-only/repo
$ hg push ssh://somewhere/else
pushing to ssh://somewhere/else
abort: could not lock repository /local/fs/that/is/mounted/read-only/repo: Read-only file system

FWIW, bundling works fine:

$ hg bundle -a /tmp/test.hg
5575 changesets found

$ hg version -v
Mercurial Distributed SCM (version 4.5.2+1462-0a1fb171dc1d)
...
  evolve     external  8.0.0.dev
  topic      external  0.9.0.dev
Comment 1 Yuya Nishihara 2018-05-12 22:36 UTC
Can you run the command with --traceback to see which function tries to
acquire a lock?
Comment 2 Josef "Jeff" Sipek 2018-05-14 11:57 UTC
Let me know if you need anything else.

$ hg init /tmp/xy
$ hg --traceback push /tmp/xy
pushing to /tmp/xy
Traceback (most recent call last):
  File "/home/jeffpc/src/oss/hg-committed/mercurial/scmutil.py", line 159, in callcatch
    return func()
  File "/home/jeffpc/src/oss/hg-committed/mercurial/dispatch.py", line 344, in _runcatchfunc
    return _dispatch(req)
  File "/home/jeffpc/src/oss/hg-committed/mercurial/dispatch.py", line 973, in _dispatch
    cmdpats, cmdoptions)
  File "/home/jeffpc/src/oss/hg-committed/mercurial/dispatch.py", line 730, in runcommand
    ret = _runcommand(ui, options, cmd, d)
  File "/home/jeffpc/src/oss/hg-committed/hgext/pager.py", line 77, in pagecmd
    return orig(ui, options, cmd, cmdfunc)
  File "/home/jeffpc/src/oss/hg-committed/mercurial/dispatch.py", line 981, in _runcommand
    return cmdfunc()
  File "/home/jeffpc/src/oss/hg-committed/mercurial/dispatch.py", line 970, in <lambda>
    d = lambda: util.checksignature(func)(ui, *args, **strcmdopt)
  File "/home/jeffpc/src/oss/hg-committed/mercurial/util.py", line 1537, in check
    return func(*args, **kwargs)
  File "/home/jeffpc/src/oss/hg-committed/mercurial/util.py", line 1537, in check
    return func(*args, **kwargs)
  File "/home/jeffpc/.local/lib/python2.7/site-packages/hgext3rd/topic/__init__.py", line 1123, in pushoutgoingwrap
    return orig(ui, repo, *args, **opts)
  File "/home/jeffpc/src/oss/hg-committed/mercurial/util.py", line 1537, in check
    return func(*args, **kwargs)
  File "/home/jeffpc/src/oss/hg-committed/mercurial/util.py", line 1537, in check
    return func(*args, **kwargs)
  File "/home/jeffpc/.local/lib/python2.7/site-packages/hgext3rd/topic/flow.py", line 68, in wrappush
    return orig(repo, remote, *args, **newargs)
  File "/home/jeffpc/src/oss/hg-committed/mercurial/util.py", line 1537, in check
    return func(*args, **kwargs)
  File "/home/jeffpc/src/oss/hg-committed/mercurial/util.py", line 1537, in check
    return func(*args, **kwargs)
  File "/home/jeffpc/.local/lib/python2.7/site-packages/hgext3rd/evolve/__init__.py", line 794, in warnobserrors
    return orig(ui, repo, *args, **kwargs)
  File "/home/jeffpc/src/oss/hg-committed/mercurial/util.py", line 1537, in check
    return func(*args, **kwargs)
  File "/home/jeffpc/src/oss/hg-committed/mercurial/commands.py", line 4184, in push
    opargs=opargs)
  File "/home/jeffpc/src/oss/hg-committed/mercurial/extensions.py", line 359, in closure
    return func(*(args + a), **kw)
  File "/home/jeffpc/.local/lib/python2.7/site-packages/hgext3rd/evolve/__init__.py", line 825, in push
    return orig(repo, *args, **opts)
  File "/home/jeffpc/src/oss/hg-committed/mercurial/exchange.py", line 513, in push
    lock = pushop.repo.lock()
  File "/home/jeffpc/src/oss/hg-committed/mercurial/localrepo.py", line 1692, in lock
    self.invalidate, _('repository %s') % self.origroot)
  File "/home/jeffpc/src/oss/hg-committed/mercurial/localrepo.py", line 1663, in _lock
    parentlock=parentlock)
  File "/home/jeffpc/src/oss/hg-committed/mercurial/lock.py", line 135, in trylock
    l._trylock()
  File "/home/jeffpc/src/oss/hg-committed/mercurial/lock.py", line 271, in _trylock
    why.filename, self.desc)
LockUnavailable: [Errno 30] Read-only file system: '/home/jeffpc/...ro-repo.../.hg/store/lock'
abort: could not lock repository /home/jeffpc/...ro-repo...: Read-only file system
Comment 3 Yuya Nishihara 2018-05-15 09:05 UTC
Thanks. Appears that the exception to be caught is too narrow.
Comment 4 HG Bot 2018-05-21 14:40 UTC
Fixed by https://mercurial-scm.org/repo/hg/rev/7c05198cd1ca
Yuya Nishihara <yuya@tcha.org>
push: continue without locking on lock failure other than EEXIST (issue5882)

This code was added by 3f5e75c22585 "push: make locking of source optional
(issue3684)", but EACCES isn't the only error that could be triggered by
filesystem permission. I think catching LockUnavailable is more appropriate
than testing errno value by caller.

(please test the fix)
Comment 5 Josef "Jeff" Sipek 2018-05-22 20:19 UTC
I just tried hg-stable with the fix.  It works.