apenwarr-redo/redo
Avery Pennarun 61f3e4672e Workaround for completely broken file locking on Windows 10 WSL.
WSL (Windows Services for Linux) provides a Linux-kernel-compatible ABI
for userspace processes, but the current version doesn't not implement
fcntl() locks at all; it just always returns success.  See
https://github.com/Microsoft/WSL/issues/1927.

This causes us three kinds of problem:
  1. sqlite3 in WAL mode gives "OperationalError: locking protocol".
     1b. Other sqlite3 journal modes also don't work when used by
         multiple processes.
  2. redo parallelism doesn't work, because we can't prevent the same
     target from being build several times simultaneously.
  3. "redo-log -f" doesn't work, since it can't tell whether the log
     file it's tailing is "done" or not.

To fix #1, we switch the sqlite3 journal back to PERSIST instead of
WAL.  We originally changed to WAL in commit 5156feae9d to reduce
deadlocks on MacOS.  That was never adequately explained, but PERSIST
still acts weird on MacOS, so we'll only switch to PERSIST when we
detect that locking is definitely broken.  Sigh.

To (mostly) fix #2, we disable any -j value > 1 when locking is broken.
This prevents basic forms of parallelism, but doesn't stop you from
re-entrantly starting other instances of redo.  To fix that properly,
we need to switch to a different locking mechanism entirely, which is
tough in python.  flock() locks probably work, for example, but
python's locks lie and just use fcntl locks for those.

To fix #3, we always force --no-log mode when we find that locking is
broken.
2019-01-02 14:49:33 -05:00
..
version Add a bunch of missing python docstrings. 2018-12-14 09:03:53 +00:00
.gitignore Rename redo/python -> redo/py. 2018-12-05 02:27:04 -05:00
__init__.py Directory reorg: move code into redo/, generate binaries in bin/. 2018-12-04 02:53:40 -05:00
atoi.py Add a bunch of missing python docstrings. 2018-12-14 09:03:53 +00:00
builder.py Workaround for completely broken file locking on Windows 10 WSL. 2019-01-02 14:49:33 -05:00
clean.do Rename redo/python -> redo/py. 2018-12-05 02:27:04 -05:00
cmd_always.py Workaround for completely broken file locking on Windows 10 WSL. 2019-01-02 14:49:33 -05:00
cmd_ifchange.py Workaround for completely broken file locking on Windows 10 WSL. 2019-01-02 14:49:33 -05:00
cmd_ifcreate.py Workaround for completely broken file locking on Windows 10 WSL. 2019-01-02 14:49:33 -05:00
cmd_log.py Workaround for completely broken file locking on Windows 10 WSL. 2019-01-02 14:49:33 -05:00
cmd_ood.py Workaround for completely broken file locking on Windows 10 WSL. 2019-01-02 14:49:33 -05:00
cmd_redo.py Workaround for completely broken file locking on Windows 10 WSL. 2019-01-02 14:49:33 -05:00
cmd_sources.py Workaround for completely broken file locking on Windows 10 WSL. 2019-01-02 14:49:33 -05:00
cmd_stamp.py Workaround for completely broken file locking on Windows 10 WSL. 2019-01-02 14:49:33 -05:00
cmd_targets.py Workaround for completely broken file locking on Windows 10 WSL. 2019-01-02 14:49:33 -05:00
cmd_unlocked.py Workaround for completely broken file locking on Windows 10 WSL. 2019-01-02 14:49:33 -05:00
cmd_whichdo.py Workaround for completely broken file locking on Windows 10 WSL. 2019-01-02 14:49:33 -05:00
cycles.py Move env.{add,get}_lock() into cycles.py, and rename. 2018-12-05 02:26:58 -05:00
deps.py Add a bunch of missing python docstrings. 2018-12-14 09:03:53 +00:00
env.py Workaround for completely broken file locking on Windows 10 WSL. 2019-01-02 14:49:33 -05:00
helpers.py Add a bunch of missing python docstrings. 2018-12-14 09:03:53 +00:00
jobserver.py jobserver: allow overriding the parent jobserver in a subprocess. 2018-12-31 19:24:27 -05:00
logs.py Workaround for completely broken file locking on Windows 10 WSL. 2019-01-02 14:49:33 -05:00
options.py Directory reorg: move code into redo/, generate binaries in bin/. 2018-12-04 02:53:40 -05:00
paths.py Add a bunch of missing python docstrings. 2018-12-14 09:03:53 +00:00
py.do Rename redo/python -> redo/py. 2018-12-05 02:27:04 -05:00
sh.do shelltest.od: add more "set -e" tests and add a 'skip' return code. 2018-12-17 16:17:37 +00:00
state.py Workaround for completely broken file locking on Windows 10 WSL. 2019-01-02 14:49:33 -05:00
title.py Add a bunch of missing python docstrings. 2018-12-14 09:03:53 +00:00
whichpython.do Directory reorg: move code into redo/, generate binaries in bin/. 2018-12-04 02:53:40 -05:00