-
Notifications
You must be signed in to change notification settings - Fork 854
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fcntl(F_SETLK) for setting byte range locks is broken leading to data corruption #1927
Comments
The issue referenced looks like lock files, not byte range locks. Another test in my test suite tests lock files and it passes on WSL. Still, the issues could be related. It should be trivially easy to convert the new ORD locks to LockFileEx. The older POSIX locks would require a little more work to emulate the broken semantics required by POSIX. In any case they should return ENOTSUPP or something so implementations can choose a backup locking system like lock files. |
FWIW, recent builds of QEMU require F_OFD_SETLK / F_OFD_GETLK for disk image files. It would be nice to have them implemented. |
I see this fcntl(F_SETLK) issue with libapr's apr_file_lock() API. A child process is able to run this sequence successfully while the parent holds the lock.
|
A simple test case for fcntl-style file locking semantics can be found in "locky.c" linked from this blog post: https://apenwarr.ca/log/20101213 |
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 microsoft/WSL#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 5156fea 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.
Still seeing this on Version 1803 (4.4.0-17134-Microsoft). Are there plans to fix this? |
touch /tmp/lock zmodload zsh/system zsystem flock /tmp/lock ( zsystem flock /tmp/lock ) # must hang but on wsl it doesn't See: - microsoft/WSL#1927 - microsoft/WSL#1712
So any update on this ? here are some codes in C not working (using lockf) /******************************************************
In this file, we implement a simple mutual exclusion
between processes accessing a shared file.
********************************************************/
#include <stdlib.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/uio.h>
#include <unistd.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <string.h>
#include <setjmp.h>
#include <signal.h>
#include <sys/file.h>
void on_alrm(int sig_nb);
jmp_buf ctxt;
int open_ret;
int main (int argc, char *argv[])
{
int lock_ret, write_ret ;
char taped_word[256];
if (argc != 3)
{
printf("Wrong usage : %s file_name time_out! \n", argv[0]);
exit(2);
}
/*-----------------------------------------------------
To check that the program works correctly, display
outputs on shell windows for which we first obtained
the name using the tty command. Pass the file name
as an argument to the program.
----------------------------------------------------- */
int timeout = atoi(argv[2]);
if ((open_ret = open (argv[1], O_RDWR)) == -1)
{
perror ("open 2");
exit (1);
}
while (1)
{
sigsetjmp(ctxt, 1);
/* Avoid starvation */
sleep(1);
/* Implement a mutual exclusion */
lseek(open_ret, 0, SEEK_SET);
lock_ret = flock(open_ret, LOCK_EX);
printf ("Pid %d : entered the critical section\n", (int)getpid() );
signal(SIGALRM, on_alrm);
alarm(timeout);
/*----------------------------------------------
Begining of the critical section
----------------------------------------------*/
while ( fgets(taped_word, sizeof(taped_word), stdin) )
{
/*----------------------------------------------
The program stays in the read/write loop until
the user tape "end".
----------------------------------------------*/
if (!strncmp (taped_word, "end", 3)) break;
write_ret = write (open_ret, taped_word, strlen(taped_word));
if (write_ret < 0)
{
printf ("Error when writing in %s\n", argv[1]);
break;
}
}
/*----------------------------------------------
End of the critical section
----------------------------------------------*/
lseek(open_ret, 0, SEEK_SET);
/* Release the second lock */
lock_ret = flock(open_ret, LOCK_UN);
printf ("Pid %d : arret temporaire d'utilisation de %s\n",
(int)getpid(), argv[1]);
/* To avoid starvation */
sleep(1);
printf ("Finished critical section, lock returned = %d\n", lock_ret);
} /* fin de la boucle while */
}
void on_alrm(int sig_nb)
{
lseek(open_ret, 0, SEEK_SET);
/* Release the second lock */
flock(open_ret, LOCK_UN);
printf("Jump: re-execute before critical section\n");
siglongjmp(ctxt, sig_nb);
} /******************************************************
On UNIX, usage of locks when accessing a file verrou
is not mandatory (advisory locking). To make it
mandatory (mandatory locking), it is necessary
(if you have the wright to do so) to modify the access
wrights on the file (cf. man lockf et man chmod).
Depending on the operating systems, commands that follow
should do the job:
chmod 2644
chmod +l
********************************************************/
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/uio.h>
#include <unistd.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <string.h>
int main (int argc, char *argv[]){
int i=0, sentence_size, sleep_index_in_sentence,
deadlock_nb=0, /* counter for the number of detected deadlocks */
correct_iteration_nb =0, /* counter for the number of correct iteration
* of the critical section */
lockf_ret =0, /* value returned by call to lockf */
file_1, file_2; /* shared resources */
char sentence[256];
if (argc != 3){
printf(" Wrong usage : %s file_1_name file_2_name ! \n", argv[0]);
exit(2);
}
sprintf(sentence, " -- Writen by pid %d -- \n", (int)getpid() );
sentence_size=strlen(sentence);
/* Open the two files */
if ((file_1 = open (argv[1], O_RDWR)) == -1) {
perror ("open file_1");
exit (1);
}
if ((file_2 = open (argv[2], O_RDWR)) == -1) {
perror ("open file_2");
exit (1);
}
while(1)
{
/* Take the first lock */
lockf_ret = lockf(file_1, F_LOCK, 0);
if (lockf_ret != 0) perror ("lockf file_1");
printf ("Pid %d : entered critical section 1 (%s), lockf_ret=%d\n", (int)getpid(), argv[1], lockf_ret );
// simulate execution
sleep(random() %4);
/* Take the second lock */
lockf_ret = lockf(file_2, F_LOCK, 0);
/* If a deadlock is detected, release the first lock
execute sleep, increment deadlock_nb, and try to
take it again by restarting the loop */
if (lockf_ret != 0) {
perror ("lockf file_2");
if (errno == EDEADLK){
printf ("Pid %d : ulock %s (deadlock_nb=%d)\n", (int)getpid(), argv[1], deadlock_nb);
deadlock_nb++;
/** Release the first lock */
lockf_ret = lockf(file_1, F_ULOCK, 0);
sleep(deadlock_nb);
/* continue the loop */
continue;
}
}
deadlock_nb=0;
correct_iteration_nb++;
printf ("Pid %d : entered critical section 2 (%s), lockf_ret=%d, correct_iteration_nb =%d\n",
(int)getpid(), argv[2], lockf_ret, correct_iteration_nb);
/*----------------------------------------------
Begining of the critical section
----------------------------------------------*/
sleep_index_in_sentence=random()%sentence_size;
for (i=0; i <sentence_size ;i++){
if (i == sleep_index_in_sentence)sleep(random()%4);
if (write (file_1, sentence+i, sizeof (char)) < 0){
printf ("ERROR: writing to %s failed\n", argv[1]);
break;
}
}
for (i=0; i <sentence_size;i++){
if (i == sleep_index_in_sentence)sleep(random()%4);
if (write (file_2, sentence+i, sizeof (char) ) < 0){
printf ("ERROR: writing to %s failed\n", argv[2]);
break;
}
}
/*----------------------------------------------
End of the critical section
----------------------------------------------*/
lseek(file_2, 0, SEEK_SET);
/* Release the second lock */
lockf_ret = lockf(file_2, F_ULOCK, 0);
if (lockf_ret != 0) perror ("ulockf file_2");
printf ("Pid %d : exit critical section 2 (%s), lockf_ret=%d\n", (int)getpid(), argv[2], lockf_ret );
lseek(file_1, 0, SEEK_SET);
/* Release the first lock */
lockf_ret = lockf(file_1, F_ULOCK, 0);
if (lockf_ret != 0) perror ("ulockf file_1");
printf ("Pid %d : exit critical section 1 (%s), lockf_ret=%d\n", (int)getpid(), argv[1], lockf_ret );
} /* end of for */
return 0;
} |
touch /tmp/lock zmodload zsh/system zsystem flock /tmp/lock ( zsystem flock /tmp/lock ) # must hang but on wsl it doesn't See: - microsoft/WSL#1927 - microsoft/WSL#1712
@benhillis, do you know if this applies to WSL2? In gittup/tup#394 they seem to have fixed the issue moving to WSL2, but com-lihaoyi/mill#874 seems to indicate this bug is still present in WSL2. |
Yes all the |
Was it fixed for WSL1? |
Why will this not be fixed in WSL-1. The WSL-2 environment cannot be used on older CPU-environments and WSL-1 is unusable for me when this is not fixed. Why does Microsoft not fix a bug in a product it still distributes on the newest Windows versions? WSL-2 is not a replacement for WSL-1, says Microsoft. They can be used as different products. This is really terrible, as it is a simple bug that exists already for years. |
I'm in the same situation as @gertvanantwerpentno I do not want to move to WSL-2 for various reasons and without this being fixed in WSL-1 I'm basically stuck. |
Me too, @StephenAtty . |
Will, there be a solution or a workaround for WSL1. It's annoying sometimes |
@saurav3199 = It's not been fixed. They never had any intention of fixing it. They want you to move onto WSL2 which is a full virtual machine. So using WSL as light weight linux development environment is a dead duck. |
Another WSL1 user here. Recently hit this issue with a systemd update on Debian sid. Really hoping this gets implemented or worked around at some point! https://superuser.com/a/1805742/1298503 |
It is really unlucky that this bug will not get fixed. :-( |
commit 03f052671a8de9f77715d1c457588964a4b07fb7 Author: William Hay <wish@dumain.com> Date: Sat Nov 9 14:41:34 2024 +0000 Remove .pylintrc commit 235ca1bcf7b21690d86739adbb4097562f636503 Author: William Hay <wish@dumain.com> Date: Sat Nov 9 14:28:15 2024 +0000 Reduce to minimal do commit 7f00abc36be15f398fa3ecf9f4e5283509c34a00 Author: Avery Pennarun <apenwarr@tailscale.com> Date: Tue Jul 27 12:59:55 2021 -0400 jobserver: fix rare race condition in previous timer-exception workaround. We have to clear the setitimer *before* leaving the try/except clause, or the timer might fire between the try/except and the try/finally, leaking a TimeoutError. Reported-by: Denton Gentry commit 8b2a4e9c37c74340a9ad49e602d8e41581202715 Author: Ankur Kothari <ankur@lipidity.com> Date: Mon May 18 20:24:12 2020 +1000 Fix typo in docs: "an C" should be "in C" commit f75b69f0634ae0c48a6fa25038a235fa42c2fa81 Author: Raphael Das Gupta <git@raphael.dasgupta.ch> Date: Fri Mar 27 02:18:08 2020 +0100 fix typo / grammar in docs landing page commit 3f6e5f5e70617dd1af631f15e3b6cc3bec326795 Author: Aidan Holm <aidanholm+github@gmail.com> Date: Sat Mar 28 20:59:02 2020 +0800 Fix typo. commit 670abbe305341e8c160418e7a80c3b6b396e8486 Author: Avery Pennarun <apenwarr@tailscale.com> Date: Mon Jun 15 02:17:25 2020 -0400 jobserver.py: _try_read()'s alarm timeout needs to throw an exception. In python3, os.read() automatically retries after EINTR, which breaks our ability to interrupt on SIGALRM. Instead, throw an exception from the SIGALRM handler, which should work on both python2 and python3. This fixes a rare deadlock during parallel builds on python3. For background: https://www.python.org/dev/peps/pep-0475/#backward-compatibility "Applications relying on the fact that system calls are interrupted with InterruptedError will hang. The authors of this PEP don't think that such applications exist [...]" Well, apparently they were mistaken :) commit aa920f12eda8b197c227b6314fa1690bd274b854 Author: Avery Pennarun <apenwarr@tailscale.com> Date: Mon Jun 15 00:39:10 2020 -0400 jobserver.py: fix very rare python3 failure reported by a user. Traceback (most recent call last): File "/nix/store/i0835myyhrfr13lh4y26r58406kk90xj-redo-apenwarr-0.42a/bin/../lib/redo/cmd_ifchange.py", line 54, in main jobserver.force_return_tokens() File "/nix/store/i0835myyhrfr13lh4y26r58406kk90xj-redo-apenwarr-0.42a/bin/../lib/redo/jobserver.py", line 482, in force_return_tokens os.write(_cheatfds[1], 't' * _cheats) TypeError: a bytes-like object is required, not 'str' Unfortunately I wasn't able to replicate it, but this is obviously the right fix. commit c1054a5902fefcb28ad942ae3df9345b1e4e2b6a Author: Avery Pennarun <apenwarr@tailscale.com> Date: Mon Jun 15 00:33:41 2020 -0400 t/110-compile: remove hard dependency on /usr/include/stdio.h. This was testing source files outside the current build tree, but if you don't have the file at all, that's not a good reason to fail the test. commit a60949135dcc9f0cf6d7366c23ff3e8ea18ce915 Merge: 68d3551 94e9ee6 Author: Avery Pennarun <apenwarr@gmail.com> Date: Wed Mar 4 15:00:34 2020 -0500 Merge branch 'doc_install_sudo' of git://github.com/BlameJohnny/redo * 'doc_install_sudo' of git://github.com/BlameJohnny/redo: GettingStarted.md: Add -E option to sudo to preserve environment commit 68d355178ea520f7b5b34251a35e47e83a08becb Merge: 92f86fc be3bda8 Author: Avery Pennarun <apenwarr@gmail.com> Date: Wed Mar 4 14:54:24 2020 -0500 Merge: Add compatibility to Python 3 (and retain Python 2) Merge branch 'py6' of https://github.com/mlell/redo * 'py6' of https://github.com/mlell/redo: Remove python<3.0 restriction in setup.py Make compatible to BeautifulSoup4 Accept octal representations of Python 2 (0nnn) and Python 3 (0onnn) Prevent iterator being changed while iterating Python 2/3 compatible treatment of max(n, None) Prevent "Exception ... ignored" in `redo-log ... | head` Distinguish byte (python2 str type) and unicode strings (python 3 str type) Set file descriptor as inheritable for all pythons >=3.4 Unify print function usage for Python 2 and 3 via __future__ import Run 2to3 utility Remove python interpreter selection commit 92f86fc0226be616356bf247368537541e5b4a55 Author: Avery Pennarun <apenwarr@gmail.com> Date: Sun Jan 5 02:52:26 2020 -0500 docs/cookbook/c: missing quote char. commit 94e9ee60d2faccbc7a4a70bb677f12ab294e0636 Author: Johnny Lind <lind.johnny@gmail.com> Date: Sun Dec 8 01:00:28 2019 +0100 GettingStarted.md: Add -E option to sudo to preserve environment commit be3bda885df90f86ec90b8b85604b7132cc54b43 Author: Moritz Lell <mlell08@gmail.com> Date: Wed Oct 30 22:14:00 2019 +0100 Remove python<3.0 restriction in setup.py commit a8fd6a123c7f9dc9d9f19ec9065bf0760c0211a2 Author: Moritz Lell <mlell08@gmail.com> Date: Wed Oct 30 21:27:46 2019 +0100 Make compatible to BeautifulSoup4 commit 5953729a443d21eef30c6e748b50fce057e4b8bc Author: Moritz Lell <mlell08@gmail.com> Date: Wed Oct 30 19:55:46 2019 +0100 Accept octal representations of Python 2 (0nnn) and Python 3 (0onnn) The number format '0onnn' is accepted by both pythons commit 7f2d04d5fffdbe7632f78898aa3f8346bb162bea Author: Moritz Lell <mlell08@gmail.com> Date: Wed Oct 30 19:54:28 2019 +0100 Prevent iterator being changed while iterating In Python 3, `zip()` returns an iterator that in turn contains references to `tparts` and `bparts`. Because those two variables are modified within the loop, the iterator does not advance properly. Fix this by explicitly obtaining a list. commit efab08fc9ffbecdd91ce598fadcb13abcfb6755a Author: Moritz Lell <mlell08@gmail.com> Date: Wed Oct 30 19:51:17 2019 +0100 Python 2/3 compatible treatment of max(n, None) Python 3 does no longer allow comparisons of different types. Therefore, explicitly convert f.checked_runid to a number that's always smaller than `f.changed_runid` commit 52a8ca25b2c9bb779382771bb32621a2dce7ded1 Author: Moritz Lell <mlell08@gmail.com> Date: Wed Oct 30 19:28:09 2019 +0100 Prevent "Exception ... ignored" in `redo-log ... | head` When STDOUT is piped to another program and that program closes the pipe, this program is supposed to terminate. However, Python 3 prints an error message because prior to exiting, STDOUT is automatically flushed which does not work due to it being closed by the other side. This commit includes code taken from the Python documentation for this case. The output stream is redirected to /dev/null commit e239820afd1959f8c0d01ee9dac5f59bd18d0fd2 Author: Moritz Lell <mlell08@gmail.com> Date: Wed Oct 30 19:21:23 2019 +0100 Distinguish byte (python2 str type) and unicode strings (python 3 str type) Python 3 strings are python 2 unicode strings. Therefore consistently mark strings that are sent via pipes or written/read to file as byte strings. commit 0d8d19437e6da1f8d6a6218a1467c83bd35dee08 Author: Moritz Lell <mlell08@gmail.com> Date: Wed Oct 30 19:11:00 2019 +0100 Set file descriptor as inheritable for all pythons >=3.4 This is mandated by PEP 446 commit 62845688e508398b4ea666ddde46ca323d7a3038 Author: Moritz Lell <mlell08@gmail.com> Date: Wed Oct 30 19:09:39 2019 +0100 Unify print function usage for Python 2 and 3 via __future__ import commit 491040ea728a5a885620982be16446ad01ff024e Author: Moritz Lell <mlell08@gmail.com> Date: Sun Oct 27 14:19:50 2019 +0100 Run 2to3 utility commit e8d4809bc57deac3714b1bc950031b3fa2483a41 Author: Moritz Lell <mlell08@gmail.com> Date: Sun Oct 27 14:19:25 2019 +0100 Remove python interpreter selection commit b08b5efcef8ab9cf9d532fdd50994e1092144924 Author: Avery Pennarun <apenwarr@gmail.com> Date: Wed Jul 24 02:45:47 2019 -0400 t/shelltest.od: Add a new preliminary test for IFS= behaviour. Apparently in zsh (when in sh compatibility mode), IFS=/ will split "/a/b/c/" into 5 parts ("", "a", "b", "c", ""). Other shells all seem to agree that it's 4 parts ("", "a", "b", "c"). zsh seems maybe more correct to me, but the majority rules, so we'll warn on it. Meanwhile, we'll also fix the one place in minimal/do that failed due to this oddity, since it's relatively easy to avoid. Reported-by: shamrin@gmail.com commit 262d272f2959142ef0c5f77b21bea502d749a001 Author: Avery Pennarun <apenwarr@gmail.com> Date: Wed Jul 24 03:00:52 2019 -0400 t/103-unicode: workaround unicode normalization on newer macOS. As named, the file would be extracted by git on macOS, then (un)helpfully normalized by the macOS filesystem. After that, "git clean -fdx" would delete the file, since it no longer had the expected name, so git thought it wasn't part of its repo. I considered pre-normalizing the filename, but a) that would break on any future OS that normalizes differently; and b) that means we won't test denormalized filenames. Instead, we'll remove the directory from git, and create it from sh instead, then figure out what name it got really created as, and then pass the "real" name to redo. commit bc9cc75bc6470bb8c8113bdaa3bbfdab2864e7eb Author: Avery Pennarun <apenwarr@gmail.com> Date: Wed Jul 24 02:52:17 2019 -0400 Disable docker container test from toplevel 'redo test' It's not reliable on all versions of docker, and we haven't had time to fix it yet, so just turn it off. It's not essential to redo. Reported-by: fcsmith@gmail.com commit 8924fa35fa7363b531f8e6b48a1328d2407ad5cf Author: Avery Pennarun <apenwarr@gmail.com> Date: Fri Jun 21 00:27:40 2019 +0900 Oops, redo/whichpython.do would fail if python2.7 didn't exist. commit 12b0d59b9f404ef62e1b35956d951e150a7cdb94 Merge: fb0a5bd 7845f6d Author: Avery Pennarun <apenwarr@gmail.com> Date: Wed May 15 18:55:52 2019 -0700 Merge remote-tracking branch 'origin/experimental/dockrepo' * origin/experimental/dockrepo: docs/cookbook/container: update docker image builder. commit fb0a5bd69c49fce9addf999491a1dcc2c6eecb89 Author: Avery Pennarun <apenwarr@gmail.com> Date: Wed May 15 16:53:49 2019 -0700 Fix more problems with "/usr/bin/env python" picking python3. Open files in 'rb' (read binary) mode to prevent useless default utf8 encoding in python3, without breaking python2 compatibility. Reported-by: Tharre <tharre3@gmail.com> commit 2e4d3d518ec60a371ecc582f776953e79b9630cc Author: Avery Pennarun <apenwarr@gmail.com> Date: Wed May 15 15:17:29 2019 -0700 cookbook/container/default.sha256.do: use explicit close_fds=False. Some people have /usr/bin/python as a link to python3. The script is designed to work in either python2 or python3, but python3's subprocess model defaults to close_fds=True, which closes the jobserver fds and causes an error. Explicitly force close_fds=False to get identical behaviour on python2 and python3. Reported-by: Tharre <tharre3@gmail.com> commit 1ff5262124bd507d92d99e09ebe5b5e3d09217bd Author: Avery Pennarun <apenwarr@gmail.com> Date: Wed May 15 14:12:26 2019 -0700 redoconf/configure.sh: use "cmp -s" to silence output. Eliminates this warning: $ mkdir out $ ../configure $ ../configure --prefix=/usr cmp: EOF on _flags after byte 33 Reported-by: compufreak@gmail.com commit 4b01cdd9b51ef38d48e4a1ce5e0fb78b0c7d8abb Author: Avery Pennarun <apenwarr@gmail.com> Date: Mon May 13 23:08:41 2019 +0000 Fix minor pylint warnings. commit 5684142f11aa0b100a2976ebd54f8509d0c35971 Author: Avery Pennarun <apenwarr@gmail.com> Date: Mon May 13 22:58:42 2019 +0000 redo-log: "(resumed)" lines didn't print as often as they should. If we print a line indicating that we've started building a subprogram, then that's an "interruption" of the detailed output of the current program; we need to "resume" the current program's logs before printing any new detailed information that comes through. commit 642d6fa193a9ea7334fd4592b4d52300d07bd24b Author: Avery Pennarun <apenwarr@gmail.com> Date: Wed May 1 13:17:35 2019 -0400 Unset CDPATH if it is set. Apparently on some (probably buggy) platforms, when CDPATH is set, the 'cd' command will always print text to stdout. This caused fail 122 and 123 in shelltest.od. CDPATH is an interactive-mode option, so let's clear it when running scripts. commit 7238b370e4f2d25f496f30cc30b21c9f3c01b3b2 Author: Avery Pennarun <apenwarr@gmail.com> Date: Tue Mar 12 00:03:34 2019 -0400 builder.py: create temp log file in the same directory as the final one. We're going to rename() it from the temp name to the final name, which doesn't work across filesystems, so the safest option is to keep it in the same directory. Reported-by: spacefrogg@meterriblecrew.net commit e24e045a07f9c5ca25eac6a76108b69d340d2c26 Author: Avery Pennarun <apenwarr@gmail.com> Date: Tue Mar 5 23:33:11 2019 -0500 docs/cookbook/redoconf-simple: a simple redoconf C++ project. This is a little simpler than the docs/cookbook/c project, which doesn't actually have a doc yet because there was too much to explain. I think I might make that a follow-on cookbook chapter, for people who have read this simple one. I think this doc is maybe a little too long; I intended it to be "here's what you do to get started" but it turned into "here's what you do to get started, and why it works, in excruciating detail." Not quite sure how to fix. (Also updated some other parts of the docs to refer to redoconf as a real thing now instead of a "maybe someone should write this" thing.) commit 7845f6dddea66fce6e908036d737d68435e85782 Author: Avery Pennarun <apenwarr@gmail.com> Date: Tue Mar 5 21:49:36 2019 -0500 docs/cookbook/container: update docker image builder. Apparently some newer docker versions crash if there is no "repository" file in the resulting image. Its syntax seems simple enough, described in https://github.com/moby/moby/blob/master/image/spec/v1.md Reported-by: Matthew Singletary <matt.singletary@gmail.com> commit 2bea74df35893ffea60286b114aa0198aa0ae82f Author: Avery Pennarun <apenwarr@gmail.com> Date: Sun Mar 3 20:56:17 2019 -0500 Work around ancient shells where >$3 does not implicitly quote $3. Also add an entry in shelltest.od to reject any shell exhibiting that bug. Reported-by: Wayne Scott <wsc9tt@gmail.com> commit 7895c947d5a51a6df2d48097e8e635dd606e39e2 Author: Avery Pennarun <apenwarr@gmail.com> Date: Sun Mar 3 20:53:47 2019 -0500 shelltest.od: warning 84 (W84) triggered on *all* shells, not just posh. I must have changed this at the last minute when adding it, but I don't know why. We were redefining f4() inside a subshell, so it never applied to the parent shell, so it was always considered a failure. But that's not what we were supposed to be testing. This is just supposed to be a test of the really rare syntax of defining a function without enclosing braces, which only fails on posh, as far as I've seen. commit 0dcc685739d4599b0ae1e51aa76b1137e829d377 Author: Avery Pennarun <apenwarr@gmail.com> Date: Sun Mar 3 19:30:37 2019 -0500 Minor clarifications to redo install instructions. Reported-by: @DRMacIver on twitter commit cead02bd210ffdf8b784c33df3b73fb2153368e1 Author: Avery Pennarun <apenwarr@gmail.com> Date: Sat Mar 2 19:08:47 2019 -0500 redo-log: sometimes print a (resumed) line after ending a level of recursion. If A calls B, and B produces stderr output, and then A wants to produce output, the resulting log would be confusing: we'd see 'redo A' and then 'redo B' and then B's output, but no indicator that B has ended and we're back in A. Now we show 'redo A (resumed)' before A's output. If B didn't produce any output, or A doesn't produce any output, we don't bother with the (resumed) line. This seems nice, as it doesn't clutter the log when there is no ambiguity anyway. commit b196315222688e5d5cc78dc679d56ec3920b10ec Author: Avery Pennarun <apenwarr@gmail.com> Date: Sat Mar 2 18:46:00 2019 -0500 Change -x/-v to only affect top-level targets by default, not recursively. Because redo targets are nicely isolated (unlike make targets), you usually only want to debug one of them at a time. Using -x could be confusing, because you might end up with a dump of output from a dependency you're not interested in. Now, by default we'll disable -x when recursing into sub-targets, so you only see the trace from the targets you are actually trying to debug. To get recursive behaviour, specify -x twice, eg. -xx. Same idea with -v. commit 7b4e3326bd19c2d7f7bd797ca58e5dfacc2e5d27 Author: Avery Pennarun <apenwarr@gmail.com> Date: Sat Mar 2 18:41:37 2019 -0500 logs.py: don't print (unchanged) lines with --no-log unless DEBUG. This accidentally made output look different with --no-log vs with normal redo-log output, because redo-log has a -u option while plain redo does not. (This is on purpose. When running redo, you only want to see the things that actually happened, so it never passes -u to the auto-launched redo-log instance. But when reviewing logs later, you might want to look at the past logs from building a component that was unchanged in the most recent run.) commit 3071d134166bf6db8f529c25385c373d97d1ef62 Merge: 63230a1 1a3c11f Author: Avery Pennarun <apenwarr@gmail.com> Date: Sat Mar 2 04:32:07 2019 -0500 Merge branch 'redoconf' * redoconf: redoconf: a stub rc_include() now sources ./redoconf.rc automatically. redoconf: assorted minor fixes. redoconf: move -Wl,-rpath flags to shlib.rc and add -Wl,-z,origin. mkdocs: don't bother to include cookbook/c/out.*/ dirs. docs/cookbook/c/allconfig.do: avoid need for '&' backgrounding. Precompiled headers: supply "-x c-header" or "-x c++-header" if available. minimal/do: remove dependency on 'seq' command. Fix some build problems on MacOS X. redoconf: posix.rc: fix abort when timespec is not available. redoconf: better handling of required vs optional detectors. redoconf: clock_gettime() detection needs to depend on -lrt. redoconf: avoid sed -E in _objlist(). Experimental new redoconf C/C++ build/autoconfiguration system. commit 1a3c11f2207736f9ce7f2b69639c13269770dd9c Author: Avery Pennarun <apenwarr@gmail.com> Date: Sat Mar 2 04:23:05 2019 -0500 redoconf: a stub rc_include() now sources ./redoconf.rc automatically. This lets us remove the awkward ". ./redoconf.rc" line from zillions of .od scripts, without paying the price of *always* including that whole file every time default.do.sh is used. commit 49f85f2156bc5f134dedb74f768fd1b17fb8195e Author: Avery Pennarun <apenwarr@gmail.com> Date: Sat Mar 2 04:12:25 2019 -0500 redoconf: assorted minor fixes. - libqt4.rc: add detection of the 'moc' command in $MOC. - libssl.rc: add detection script for openssl. - default.do.sh: provide a die() function to all .od files. It's just too useful to not have it (I haven't converted everything to it yet). - When building out/x/y.z, match against $S/default.z.od and $S/default.od if they exist. - *.list files (lists of source/object files to include in a binary) can now contain *.o files in addition to *.c, *.cc, etc. - rename compile() to _compile() to avoid polluting the namespace for scripts called from default.do.sh. - When building a .so file in the top level directory, no need to make a symlink of it into the top level directory. - link.od and link-shlib.od forgot to make use of the $xLIBS variable. commit 1e2fc9be8ad9606b1225bdf9a7914eda3d4617de Merge: 8825033 63230a1 Author: Avery Pennarun <apenwarr@gmail.com> Date: Sat Mar 2 04:09:17 2019 -0500 Merge branch 'master' into redoconf * master: builder.py: atomically replace the log for a given target. redo-ifchange regression: if REDO_LOG is not set, assume it's 1. Explicitly reject target/source filenames with newlines in them. If redo searched all the way up to /default.do, it would run ./default.do instead. Overridden files were accidentally getting reclassified as static. Certain redo post-build failures would still mark a target as built. minimal/do: remove dependency on 'seq' command. commit 63230a1ae338b6a88be0e9c2a6e43b6f10d456dd Author: Avery Pennarun <apenwarr@gmail.com> Date: Sat Mar 2 03:45:35 2019 -0500 builder.py: atomically replace the log for a given target. Previously we were truncating the log if it existed. This would cause redo-log to produce invalid output if you had the following (admittedly rare) sequence in a single session: - start building X - redo-log starts showing the log for X - finish building X - redo-log has not finished showing the log for X yet - start building X again for some reason - redo-log sees a truncated logfile. Now, redo-log can finish reading the original file (which no longer has a filename since it was overwritten) while the new file is being created. commit 8a97b0cb2ccedc74c8fc6565a1cb6ef03706169a Author: Avery Pennarun <apenwarr@gmail.com> Date: Sat Mar 2 03:18:17 2019 -0500 redo-ifchange regression: if REDO_LOG is not set, assume it's 1. At some point this got broken during a refactoring. The result was that redo-ifchange, run from the command line (as opposed to inside a .do script) would fail to start the log prettifier. commit 83bc49512f47cc6b54ca1795bd43b6b021794939 Author: Avery Pennarun <apenwarr@gmail.com> Date: Sat Mar 2 03:09:42 2019 -0500 Explicitly reject target/source filenames with newlines in them. This avoids an ugly assertion failure when we try to log a message containing an inner newline. commit e5a27f04e8052a76cf4e8cd2a02eb549ab899052 Author: Avery Pennarun <apenwarr@gmail.com> Date: Sat Mar 2 02:53:02 2019 -0500 If redo searched all the way up to /default.do, it would run ./default.do instead. This only happened if the containing project was buggy, ie. you tried to build a target that has no .do file available anywhere. However, it resulted in a confusing outcome for that case, where we'd run the wrong default.do file with the wrong parameters. Extended an existing test to catch this mistake. commit 90989d1ffb365af693aab5def848e5b0002e3ace Author: Avery Pennarun <apenwarr@gmail.com> Date: Sat Mar 2 02:38:02 2019 -0500 Overridden files were accidentally getting reclassified as static. This is relatively harmless, since we treat them *almost* identically, except that we print a warning for overridden files to remind you that something fishy is going on. Add a test for the actual warning message to ensure it is printed. (I don't like tests for specific warning messages, but it was necessary in this case.) commit 8100aa4973137513f892a53e2838382445100600 Author: Avery Pennarun <apenwarr@gmail.com> Date: Sat Mar 2 02:13:18 2019 -0500 Certain redo post-build failures would still mark a target as built. If we failed because: - target dir doesn't exist - failed to copy from stdout - failed to rename $3 We would correctly return error 209, but the target would still be marked as having been built, so redo-ifchange would not try to build it next time, beause we forgot to call sf.set_failed() in those cases. minimal/do worked correctly. Added a test to catch this in the future. commit 8a0effa5b3d216eea23d0c87de5b93bc3b82e8dd Author: Avery Pennarun <apenwarr@gmail.com> Date: Sun Feb 24 22:36:47 2019 -0500 minimal/do: remove dependency on 'seq' command. It was not available in older versions of FreeBSD and MacOS. Reported-by: Wayne Scott <wsc9tt@gmail.com> commit 88250334da81fc9334323177157ef6fbd1699b33 Author: Avery Pennarun <apenwarr@gmail.com> Date: Fri Mar 1 13:38:25 2019 -0500 redoconf: move -Wl,-rpath flags to shlib.rc and add -Wl,-z,origin. It was kind of ugly to have this kind of special flag directly in link.od; now we detect whether it's available. This also gives a project the ability to override the flag in some other way if they want. As a result, rc/shlib.rc needs to be included in all.rc.od if you want to create or link against shared libraries. While we're here, also add -Wl,-z,origin on platforms where it works. This is apparently needed for FreeBSD 8.0 at least, and probably other platforms. Reported-by: Wayne Scott <wsc9tt@gmail.com> commit 1eb7b2879d30258c99e923634d078e83aad03f9d Author: Avery Pennarun <apenwarr@gmail.com> Date: Mon Feb 25 13:57:47 2019 +0000 mkdocs: don't bother to include cookbook/c/out.*/ dirs. commit e036e2522d99cd279e4bd675089fcdbc75696957 Author: Avery Pennarun <apenwarr@gmail.com> Date: Mon Feb 25 13:44:28 2019 +0000 docs/cookbook/c/allconfig.do: avoid need for '&' backgrounding. Instead of running a bunch of separate rc_include statements in the background, which causes unpredictable ordering of log output and prevents -j from controlling parallelism, let's do a single redo-ifchange for all of them (the slow part) followed by sequentially checking the results (the fast part). commit 1574b11598d4dce42fe174eaf406b6f130db02bb Author: Avery Pennarun <apenwarr@gmail.com> Date: Mon Feb 25 13:09:11 2019 +0000 Precompiled headers: supply "-x c-header" or "-x c++-header" if available. Some older versions of gcc give "all.hpp: linker input file unused because linking not done" otherwise, because they don't realize files named *.hpp are headers. Reported-by: Wayne Scott <wsc9tt@gmail.com> commit 313ac6a51c0f87987b288aaf5eb24901fc133b97 Author: Avery Pennarun <apenwarr@gmail.com> Date: Sun Feb 24 22:36:47 2019 -0500 minimal/do: remove dependency on 'seq' command. It was not available in older versions of FreeBSD and MacOS. Reported-by: Wayne Scott <wsc9tt@gmail.com> commit 328d4ead7a825a35899e258addf1716666622741 Author: Avery Pennarun <apenwarr@gmail.com> Date: Sun Feb 24 22:29:19 2019 -0500 Fix some build problems on MacOS X. - Linking shared libraries needs slightly different options. - We were trying to detect mach_time.h but needed to detect mach/mach_time.h instead. While we're here, add a --disable-shared option to ./configure, which is different from --enable-static. --disable-shared does not build *new* share libraries, but doesn't pass -static to the linker (apparently there is no static linking posible on MacOS). commit 017997c035e69bd2f8d882cf63fba81844a31aeb Author: Avery Pennarun <apenwarr@gmail.com> Date: Sat Feb 23 21:00:26 2019 -0500 redoconf: posix.rc: fix abort when timespec is not available. Now we define HAS_POSIX=1 if it works, and to blank otherwise, to be consistent with other rc scripts, but it doesn't abort if we can't find timespec. Meanwhile, slightly clarify the error message in rc.sh. Reported-by: Nathaniel Filardo <nwfilardo@gmail.com> commit bdb8d8a27d5907262fd895897a70c28e843f00d8 Author: Avery Pennarun <apenwarr@gmail.com> Date: Sat Feb 23 16:45:08 2019 -0500 redoconf: better handling of required vs optional detectors. CC.rc was the only "mandatory" detection, which was weird and inconsistent. Instead, make it optional like the others, and have it set a HAVE_CC variable appropriately (and have CXX.rc work the same way). Then, add a default.required.rc.od that checks the HAVE_* for any variable and aborts if it is not available. This allows us to fix confusing behaviour in allconfig.do, which would try every compiler on the system, but redo would print a (non-fatal) error message (and prevent redo-stamp optimization) when CC.rc failed for any non-working compilers. Now CC.rc just politely reports that it didn't find a compiler. Then we change all.rc.od to make CC.rc mandatory. Reported-by: Nathaniel Filardo <nwfilardo@gmail.com> commit 337e026ce30fcf958da7043a661d2ea862fb4b03 Author: Avery Pennarun <apenwarr@gmail.com> Date: Sat Feb 23 15:51:30 2019 -0500 redoconf: clock_gettime() detection needs to depend on -lrt. More generally, default.func.rc.od wasn't super useful because you couldn't specify either a header file or library dependencies. Drop it and make an explicit clock_gettime.rc.od. As a bonus, this also checks that CLOCK_MONOTONIC exists as expected. Reported-by: Wayne Scott <wsc9tt@gmail.com> commit ea6a7135f12fef6444458dc2f2c5c6c308e063be Author: Avery Pennarun <apenwarr@gmail.com> Date: Sat Feb 23 15:44:46 2019 -0500 redoconf: avoid sed -E in _objlist(). Turns out there's a less confusing way to do it using 'case' wildcards instead. Reported-by: Wayne Scott <wsc9tt@gmail.com> commit 6dae51f4d2b1f32aee025dabe26ee5f75aa64608 Author: Avery Pennarun <apenwarr@gmail.com> Date: Sun Feb 3 01:14:51 2019 -0500 Experimental new redoconf C/C++ build/autoconfiguration system. To test it out, try this: ./do -j10 build cd docs/cookbook/c redo -j10 test It should detect all the compilers on your system and make three separate builds for each one: normal, debug, and optimized. Then it tries to run a test program under each one. If there are windows cross compilers and you also have 'wine' installed, it'll try running the test program under wine as well. redoconf currently has no documentation other than the example program. We'll fix that later. commit 5db883ac581c9db2053002a8b4e63e8820c81528 Author: Avery Pennarun <apenwarr@gmail.com> Date: Sat Feb 23 06:47:59 2019 -0500 mkdocs: exclude more generated file types. These files can appear/disappear during a parallel build, which confuses mkdocs when it tries to refer to them, even though we never wanted them in the docs anyway. commit e7ea1e651d03127a69d42758856b039a7b3cd6dd Merge: cb60966 78921b0 Author: Avery Pennarun <apenwarr@gmail.com> Date: Sat Feb 23 00:42:29 2019 -0500 Merge remote-tracking branch 'origin/master' * origin/master: Fix builder: Reinstate stderr instead of opening /dev/tty commit cb60966d9e3857e17baff2a855088090ac076a24 Author: Avery Pennarun <apenwarr@gmail.com> Date: Wed Feb 20 19:18:02 2019 -0500 mkdocs: exclude more generated files from cookbook/container. commit 938c6c65c49f504a951f65a0c53bfcd0c4921113 Author: Avery Pennarun <apenwarr@gmail.com> Date: Wed Feb 20 19:14:37 2019 -0500 cookbook/container/kvm: better handling of \r\n line endings. commit 78921b013835b67a3539983d405ab4cd48251bf4 Merge: 1479189 c18c4b9 Author: apenwarr <apenwarr@gmail.com> Date: Thu Feb 14 04:57:53 2019 -0500 Merge pull request #27 from spacefrogg/fix-tty Fix builder: Reinstate stderr instead of opening /dev/tty commit c18c4b92c9a2b23f0ce06d9aebf151bdaded6dd1 Author: Michael Raitza <git@spacefrogg.net> Date: Sat Feb 9 19:17:34 2019 +0100 Fix builder: Reinstate stderr instead of opening /dev/tty Reconnect the builder's original stderr file descriptor after the logger has finished its job. Fixes that redo could not be run without a controlling terminal. commit 1479189bfe0e5240a03565d242af8f96942fa92b Author: Avery Pennarun <apenwarr@gmail.com> Date: Tue Feb 12 16:32:30 2019 -0500 mkdocs: include additional hljs languages. We upgraded mkdocs earlier to support some useful features (like the mkdocs-exclude plugin), but that one changes the highlight.js configuration to include fewer languages by default. Specify the additional ones we want to include. Reported-by: @DRMacIver on twitter commit 6fbda9a7b3708383cedc6f1e549a3144175a0702 Author: Avery Pennarun <apenwarr@gmail.com> Date: Sat Feb 2 23:54:27 2019 -0500 docs/cookbook/container: don't delete *.out and *.code during build. If mkdocs is running in parallel, it can get upset if one of these files exists when it lists the directory, but doesn't exist when it goes to generate the output. Fundamentally this is a problem in mkdocs more than in our code, but we might as well avoid it. commit 3dbdfbc06f68c47035b832b3fade26b1b0ff014c Author: Avery Pennarun <apenwarr@gmail.com> Date: Fri Jan 18 00:06:18 2019 +0000 Better handling if parent closes REDO_CHEATFDS or MAKEFLAGS fds. Silently recover if REDO_CHEATFDS file descriptors are closed, because they aren't completely essential and MAKEFLAGS-related warnings already get printed if all file descriptors have been closed. If MAKEFLAGS --jobserver-auth flags are closed, improve the error message so that a) it's a normal error instead of an exception and b) we link to documentation about why it happens. Also write some more detailed documentation about what's going on here. commit bcc05a6e860ff08fae6d75488340e14b1c4e6bd2 Merge: 909bb62 cb7d3af Author: apenwarr <apenwarr@gmail.com> Date: Wed Jan 16 19:52:17 2019 -1000 Merge pull request #26 from martinmosegaard/proof-cook-container cookbook/container: minor proofreading commit cb7d3afc8f8284d3d26241985f23339b6cf6524c Author: Martin Mosegaard Amdisen <martin@chainalysis.com> Date: Tue Jan 15 08:24:43 2019 +0100 cookbook/container: minor proofreading Fixed a typo found while reading. Also rephrased a sentence about comm, that at least to me makes it simpler to understand. commit 909bb62dcecc65126fc27b8f1cfbd22bcf95254c Author: Avery Pennarun <apenwarr@gmail.com> Date: Mon Jan 14 06:57:26 2019 +0000 cookbook/container: some minor clarifications. Most of these were suggested by Jeff Stearns <jeff.stearns@gmail.com>. commit 20fe7a79ec4adf0c66c5ffcef983049135bc31bc Author: Avery Pennarun <apenwarr@gmail.com> Date: Mon Jan 14 06:46:07 2019 +0000 cookbook/container: skip on missing cpio and missing kvm kernel image. commit 537866b871e116559e94f790ae3d737a5a24eef4 Author: Avery Pennarun <apenwarr@gmail.com> Date: Mon Jan 14 06:44:55 2019 +0000 cookbook/container: remove unexplained "exec >&2" lines. These are often a good idea, but not necessary here and are distracting to the tutorial, so let's just take them out. Reported-by: Jeff Stearns <jeff.stearns@gmail.com> commit 1eeb1fb909a086c89b8bd7edf61825919f5be199 Merge: 3923a7d a6db325 Author: apenwarr <apenwarr@gmail.com> Date: Sun Jan 13 19:22:31 2019 -1000 Merge pull request #25 from ejona86/missing-ps1 cookbook/container: add missing PS1 to sh example commit a6db325998dba70783d3ba948f8f3b1bcee067b6 Author: Eric Anderson <ejona@google.com> Date: Sun Jan 13 20:38:54 2019 -0800 cookbook/container: add missing PS1 to sh example commit 3923a7d3f8bdae0cce959c94556e48844c6cee41 Author: Avery Pennarun <apenwarr@gmail.com> Date: Wed Jan 2 23:46:01 2019 -0500 cookbook/container: example of building+running docker containers. This got... long... and complicated. But I think it's a really good demonstration of getting redo to do complicated things elegantly. At least, I hope it is. commit 01497f55e981ae4132d487531eb3684ff435f1c4 Author: Avery Pennarun <apenwarr@gmail.com> Date: Tue Jan 8 01:32:16 2019 -0500 mkdocs: enforce sufficiently new version, and use mkdocs-exclude. We want to use the mkdocs-exclude plugin, which lets us exclude particular files from the output directory. But plugins aren't available in the debian-stable version of mkdocs, so ensure that we're running a sufficiently new version. If we aren't, gracefully just skip building the documentation. commit 61f3e4672e16e5742ea0ffde7d00c058e1d89e36 Author: Avery Pennarun <apenwarr@gmail.com> Date: Wed Jan 2 14:18:51 2019 -0500 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. commit 613fcb1c342de9e9d140fcdf46ee2123467d3561 Author: Avery Pennarun <apenwarr@gmail.com> Date: Tue Jan 1 19:10:55 2019 -0500 minimal/do: use 'pwd -P' instead of '/bin/pwd'. On MacOS (at least 10.11.6), /bin/pwd defaults to using $PWD (ie. pwd -L). On most other OSes it defaults to *not* using $PWD (ie. pwd -P). We need the latter behaviour. It appears that 'pwd -P' has been specified by POSIX for quite a few years now, so let's rely on it. shelltest.od will now also check for it, though if your 'sh' doesn't support this feature, it'll be too late, because shelltest needs minimal/do in order to run. commit 5907d826654bd18c4b070ea6cc8792ff286d3cfe Author: Avery Pennarun <apenwarr@gmail.com> Date: Mon Dec 31 20:55:20 2018 -0500 setup.py: add a python setuptools package. To build a package suitable for python's pip tool: python setup.py sdist To install a pre-built package from pypi: pip install redo-tools commit 576e980c0e270f027fc7f8023301bd0a82cbc392 Author: Avery Pennarun <apenwarr@gmail.com> Date: Mon Dec 31 19:35:56 2018 -0500 t/351-deps-forget: remove a test that occasionally flakes. This is unfixable when running with -j > 1 because of how the current t/flush-cache script works. We'll only be able to fix that after making a more granular flush-cache tool, which is already on my todo list. commit 87bac287b655a07609049d4957ac31ee70e58d44 Author: Avery Pennarun <apenwarr@gmail.com> Date: Mon Dec 31 17:43:03 2018 -0500 t/010-jobserver: add serial/parallel override tests. This new test validates that you can pass -j1 and -j2 in a sub-redo to create a sub-jobserver with exactly the number of jobs you specified. Now that we have that feature, we can also test for the bug fixed two commits ago where, with -j1, targets would be built in an unexpected order. commit 19049d52fca460b41e318ce1aae569bd3c5ca3ad Author: Avery Pennarun <apenwarr@gmail.com> Date: Mon Dec 31 18:57:58 2018 -0500 jobserver: allow overriding the parent jobserver in a subprocess. Previously, if you passed a -j option to a redo process in a redo or make process hierarchy with MAKEFLAGS already set, it would ignore the -j option and continue using the jobserver provided by the parent. With this change, we instead initialize a new jobserver with the desired number of tokens, which is what GNU make does in the same situation. A typical use case for this is to force serialization of build steps in a subtree (by using -j1). In make, this is often useful for "fixing" makefiles that haven't been written correctly for parallel builds. In redo, that happens much less often, but it's useful at least in unit tests. Passing -j1 is relatively harmless (the redo you are starting inherits a token anyway, so it doesn't create any new tokens). Passing -j > 1 is more risky, because it creates new tokens, thus increasing the level of parallelism in the system. Because this may not be what you wanted, we print a warning when you pass -j > 1 to a sub-redo. GNU make gives a similar warning in this situation. commit e247a7230033a1e27a6d0475615101d070bc7635 Author: Avery Pennarun <apenwarr@gmail.com> Date: Mon Dec 31 16:53:13 2018 -0500 jobserver: don't release the very last token in wait_all(). After waiting for children to exit, we would release our own token, and then the caller would immediately try to obtain a token again. This accounted for tokens correctly, but would pass tokens around the call tree in unexpected ways. For example, imagine we had only one token. We call 'redo a1 a2', and a1 calls 'redo b1 b2', and b1 calls 'redo c1'. When c1 exits, it releases its token, then tries to re-acquire it before exiting. This also includes 'redo b1 b2' and 'redo a1 a2' in the race for the token, which means b1 might get suspended while *either* a2 or b2 starts running. This never caused a deadlock, even if a2 or b2 depends on b1, because if they tried to build b1, they would notice it is locked, give up their token, and wait for the lock. c1 (and then b1) could then obtain the token and immediately terminate, allowing progress to continue. But this is not really the way we expect things to happen. "Obviously" what we want here is a straightforward stack unwinding: c1 should finish, then b1, then b2, then a1, then b2. The not-very-obvious symptom of this bug is that redo's unit tests seemed to run in the wrong order when using -j1 --no-log. (--log would hide the problem by rearranging logs back into the right order!) commit 22dd0cdd6bf8cdd4fc783260c0f10cca05454163 Author: Avery Pennarun <apenwarr@gmail.com> Date: Mon Dec 31 15:07:18 2018 -0500 Move _all.do -> all.do and slightly update docs. all.do's main job was to print a "nothing much to do" message after running. Nowadays it actually does do stuff, so we can remove the warning, making _all.do redundant. commit e897c3eca5df3c169f4e37fbb04f058a9d3f6687 Author: Tony Garnock-Jones <tonygarnockjones@gmail.com> Date: Mon Dec 31 18:27:43 2018 +0000 Avoid symlinking to /bin/true in minimal/do, which fails when /bin/true is busybox (#24) commit bd9a9e4005e1d15bf04cc1214309843c54bd4690 Author: Avery Pennarun <apenwarr@gmail.com> Date: Thu Dec 20 08:39:42 2018 +0000 shelltest: add some tests around 'local' and 'set -u'. commit cf274842f429a1657fa69ddb60aadcb136812178 Author: Avery Pennarun <apenwarr@gmail.com> Date: Thu Dec 20 08:50:40 2018 +0000 shelltest: wrap some tests in 'eval' so they don't abort in posh. posh will abort the entire script if it detects a syntax error. I don't know if that's good or not, but you shouldn't be writing scripts with syntax errors, so that by itself isn't a good reason for posh to fail. It still fails some actual tests, but at least now we don't consider it a 'crash' outcome. commit d7a057ed298453b04b1f66884b7c91c1fbdab0fa Author: Avery Pennarun <apenwarr@gmail.com> Date: Thu Dec 20 04:46:10 2018 +0000 shelltest: add reference URLs for some "set -e" behaviour. commit 174a093dc550b404b0e07242291c032986c18f8c Author: Avery Pennarun <apenwarr@gmail.com> Date: Tue Dec 18 12:59:51 2018 +0000 Don't set_checked() on is_override files. If a file is overridden and then overridden again, this caused us to rebuild only the first thing that depends on it, but not any subsequent things, which is a pretty serious bug. It turned out that t/350-deps-forget is already supposed to test this, but I had cleverly encoded the wrong behaviour into the expected results in the table-driven test. I blame lack of sleep. Anyway, I fixed the test, which made it fail, and then fixed the code, which made it pass. commit 686c381109ff03bb362607eb22308189a91b5ef7 Author: Avery Pennarun <apenwarr@gmail.com> Date: Mon Dec 17 15:58:06 2018 +0000 Fix more inconsistent behaviour with symlinks in paths. Both redo and minimal/do were doing slightly weird things with symlinked directories, especially when combined with "..". For example, if x is a link to ., then x/x/x/x/../y should resolve to "../y", which is quite non-obvious. Added some tests to make sure this stays fixed. commit 1f64cc452545fa6504d8cbb6fc09470f875e76d4 Author: Avery Pennarun <apenwarr@gmail.com> Date: Mon Dec 17 12:35:32 2018 +0000 shelltest.od: add more "set -e" tests and add a 'skip' return code. Based on the earlier t/000-set-minus-e bug in minimal/do on some shells, let's add some extra tests that reveal the weirdness on those shells. Unfortunately because they are so popular (including bash and zsh), we can't reject them outright for failing this one. While we're here, add a new return code, "skip", which notes that a test has failed but is not important enough to be considered a warning or failure. Previously we just had these commented out, which is not quite obvious enough. ...and I updated a few comments while reviewing some of the older tests. commit 761b77333efbab01bf8e3d813254e9b31fbeb05e Author: Avery Pennarun <apenwarr@gmail.com> Date: Mon Dec 17 13:21:42 2018 +0000 redo/sh.do: include the 'lksh' variant of mksh. This one attempts to be a much closer match to POSIX, and seems to succeed, giving only warning W118. commit 6cf06f707aa6e9407fafff3f0054834940a11fb3 Author: Avery Pennarun <apenwarr@gmail.com> Date: Mon Dec 17 12:33:17 2018 +0000 shelltest.od: we accidentally treated some fails as mere warnings. We were setting a global variable FAIL on failure, but if we failed inside a subshell (which a very small number of tests might do), this setting would be lost. The script output (a series of failed/warning lines) was still valid, but not the return code, so the shell might be selected even if one of these tests failed. To avoid the problem, put the fail/warning state in the filesystem instead, which is shared across subshells. commit 9aa8061e831f7e25ebd8777959856af4d01b149c Author: Avery Pennarun <apenwarr@gmail.com> Date: Mon Dec 17 13:50:33 2018 +0000 minimal/do: fix a bug when $PWD != $(/bin/pwd). This can happen when $PWD contains a symlink somewhere in the path. In that case, "cd ..; cat x" could mean something different from "cat ../x". Notably, this error occurs when running "./do test" if your build directory is through a symlink. For example, on freebsd your home directory is /home/$USER, but /home is a symlink to /usr/home, which triggers this problem. Not adding tests in this commit, because when I added some tests, I found even more symlink-related bugs, but those ones are much more unlikely to occur. The additional fixes+tests are in a later commit. commit 54d8399718b0f565e0b195f4b897b2137aa44f8a Author: Avery Pennarun <apenwarr@gmail.com> Date: Mon Dec 17 12:09:49 2018 +0000 minimal/do: fix t/000-set-minus-e on some shells. Running commands in "||" context (like "x || return") disables "set -e" behaviour in that context, even several levels deep in the call hierarchy. The exact behaviour varies between shells, but this caused a test failure with at least zsh 5.3.1 on debian. commit 29f939013ebd3a83d9c4d296fd00715532f5d6fa Author: Avery Pennarun <apenwarr@gmail.com> Date: Fri Dec 14 08:38:53 2018 +0000 Add a bunch of missing python docstrings. This appeases pylint, so un-disable its docstring warning. commit 39e017869d0e5aa4b42df2f78bcdf92c1b7f6189 Author: Avery Pennarun <apenwarr@gmail.com> Date: Thu Dec 13 12:58:56 2018 +0000 Ensure correct operation with read-only target dirs and .do file dirs. Although I expect this is rather rare, some people may want to build in a read-write subdir of a read-only tree. Other than some confusing error reporting, this works fine in redo after the recent changes to temp file handling, but let's add a test to make sure it stays that way. The test found a bug in minimal/do, so let's fix that. Reported-by: Jeff Stearns <jeff.stearns@gmail.com> commit d95277d12173c0128624de9d85bc2aca35abd98c Author: Avery Pennarun <apenwarr@gmail.com> Date: Wed Dec 12 03:37:44 2018 +0000 Use mkstemp() to create the stdout temp file, and simplify $3 path. Previously, we'd try to put the stdout temp file in the same dir as the target, if that dir exists. Otherwise we'd walk up the directory tree looking for a good place. But this would go wrong if the directory we chose got *deleted* during the run of the .do file. Instead, we switch to an entirely new design: we use mkstemp() to generate a temp file in the standard temp file location (probably /tmp), then open it and immediately delete it, so the .do file can't cause any unexpected behaviour. After the .do file exits, we use our still-open fd to the stdout file to read the content back out. In the old implementation, we also put the $3 in the "adjusted" location that depended whether the target dir already existed, just for consistency. But that was never necessary: we didn't create the $3 file, and if the .do script wants to write to $3, it should create the target dir first anyway. So change it to *always* use a $3 temp filename in the target dir, which is much simpler and so has fewer edge cases. Add t/202-del/deltest4 with some tests for all these edge cases. Reported-by: Jeff Stearns <jeff.stearns@gmail.com> commit 1f79bf117427e923d42930d31e8721ae81af78cc Author: Avery Pennarun <apenwarr@gmail.com> Date: Wed Dec 12 03:36:09 2018 +0000 Detect when a .do script deletes its stdout tmp file. This can happen if we create the .tmp file in the same directory as the target, and the .do file first does "rm -rf" on that directory, then re-creates it. The result is that the stdout file is lost. We'll make this a warning if the .do script *didn't* write to stdout (so the loss is harmless, just weird), and an error if they *did* write to stdout, which we can detect because we still have an open fd on the file, so we can fstat() it. commit 2b4fe812e28b07bfecb841042d5d57340ddad803 Author: Avery Pennarun <apenwarr@gmail.com> Date: Tue Dec 11 02:57:29 2018 +0000 Some renaming and comments to try to clarify builder and jobserver. The code is still a bit spaghetti-like, especialy when it comes to redo-unlocked, but at least the new names are slightly more comprehensible. commit 4d2b4cfccbcfd7d78516f0be6822a3bbb30a5f08 Author: Avery Pennarun <apenwarr@gmail.com> Date: Tue Dec 11 00:55:05 2018 +0000 Make calls to logs.setup() explicit in each cmd. Further reducing magic implicit behaviour to make code easier to follow. commit 474e12eed8b41c159a5a1567c6cfb3cfaa46e95e Author: Avery Pennarun <apenwarr@gmail.com> Date: Tue Dec 11 01:19:58 2018 +0000 Fix minimal/do and tests when built in a path containing spaces. Basically all just missing quotes around shell strings that use $PWD. Most paths inside a project, since redo uses relative paths, only need to worry when project-internal directories or filenames have spaces in them. Reported-by: Jeff Stearns <jeff.stearns@gmail.com> commit 539a26d26472b11157754e9964273a02305df5df Author: Avery Pennarun <apenwarr@gmail.com> Date: Mon Dec 10 05:03:20 2018 +0000 Minor copyediting of index.md. commit 2b7da63c669216b53cc4d950c33dd38f0068377d Author: Avery Pennarun <apenwarr@gmail.com> Date: Mon Dec 10 04:33:57 2018 +0000 Fix a few lagging doc references to old-style build+test layout. commit bd8dbfb4876cfff972958d466accd3440292d271 Author: Avery Pennarun <apenwarr@gmail.com> Date: Wed Dec 5 02:34:36 2018 -0500 Switch to module-relative import syntax. Now that the python scripts are all in a "redo" python module, we can use the "new style" (ahem) package-relative imports. This appeases pylint, plus avoids confusion in case more than one package has similarly-named modules. commit 0b648521fd0a5b3c9c9f54a89b18f24935fac46f Author: Avery Pennarun <apenwarr@gmail.com> Date: Wed Dec 5 02:17:17 2018 -0500 Move setproctitle() stuff into title.py. This removes another instance of magical code running at module import time. And the process title wasn't really part of the state database anyway. Unfortunately this uncovered a bug: the recent change to use 'python -S' makes it not find the setproctitle module if installed. My goodness, I hate the horrible python easy_install module gunk that makes startup linearly slower the more modules you have installed, whether you import them or not, if you don't use -S. But oh well, we're stuck with it for now. commit 9b6d1eeb6ecbd076ad3e039a1428a76d9b4dce9a Author: Avery Pennarun <apenwarr@gmail.com> Date: Wed Dec 5 01:07:16 2018 -0500 env and env_init: Eliminate weird auto-initialization of globals. Merge the two files into env, and make each command explicitly call the function that sets it up in the way that's needed for that command. This means we can finally just import all the modules at the top of each file, without worrying about import order. Phew. While we're here, remove the weird auto-appending-'all'-to-targets feature in env.init(). Instead, do it explicitly, and only from redo and redo-ifchange, only if is_toplevel and no other targets are given. commit 75b5352511ab12444bc4476ab4aae485ab128553 Author: Avery Pennarun <apenwarr@gmail.com> Date: Wed Dec 5 01:47:44 2018 -0500 test.do: allow docs to build in parallel with tests. Previously, we'd try to build all the critical stuff first, and then run the tests. Nowadays, it takes a little longer to build the docs (especially some of the docs/cookbook/ stuff), and this isn't needed to run the tests, so let's allow them to parallelize. commit 99188bef0d04a0b32624d15788a3da1b61f8b708 Author: Avery Pennarun <apenwarr@gmail.com> Date: Wed Dec 5 00:27:52 2018 -0500 Rename redo/python -> redo/py. This avoids a name overlap with the system-installed copy of python. Since redo adds the redo/ dir to the $PATH before running .do files, python.do might see its own previously-created target instead of the "real" python when testing, and create an infinite loop by accident. commit f1305b49eb27e95a6e99663d4f26808b6163b7e3 Author: Avery Pennarun <apenwarr@gmail.com> Date: Wed Dec 5 00:18:07 2018 -0500 Move env.{add,get}_lock() into cycles.py, and rename. They really aren't locks at all, they're a cycle detector. Also rename REDO_LOCKS to a more meaningful REDO_CYCLES. And we'll move the CyclicDependencyError exception in here as well, instead of state.py where it doesn't really belong. commit ded14507b06c5e7f2fc556dd1b9b1b12dfc86176 Author: Avery Pennarun <apenwarr@gmail.com> Date: Tue Dec 4 23:34:28 2018 -0500 Rename vars{,_init}.py -> env{,_init}.py. This fixes some pylint 'redefined builtins' warnings. While I was here, I fixed the others too by renaming a few local variables. commit 65cf1c98541ea5d8f574cbf4140882d688ba577f Author: Avery Pennarun <apenwarr@gmail.com> Date: Tue Dec 4 23:20:14 2018 -0500 Rename jwack.py -> jobserver.py. I'm not really sure why I called it jwack. I think it was kind of a wack jobserver(tm). But nowadays most of the wack-ness is gone. commit 6e96395d488b5f73845be1d0f5ff82c1ab48bba2 Author: Avery Pennarun <apenwarr@gmail.com> Date: Wed Dec 5 00:21:46 2018 -0500 redo/version: fix pylint warning. commit f6fe00db5cafa12d4f3c9dcbd83ef3d1b69bd8c3 Author: Avery Pennarun <apenwarr@gmail.com> Date: Mon Dec 3 21:39:15 2018 -0500 Directory reorg: move code into redo/, generate binaries in bin/. It's time to start preparing for a version of redo that doesn't work unless we build it first (because it will rely on C modules, and eventually be rewritten in C altogether). To get rolling, remove the old-style symlinks to the main programs, and rename those programs from redo-*.py to redo/cmd_*.py. We'll also move all library functions into the redo/ dir, which is a more python-style naming convention. Previously, install.do was generating wrappers for installing in /usr/bin, which extend sys.path and then import+run the right file. This made "installed" redo work quite differently from running redo inside its source tree. Instead, let's always generate the wrappers in bin/, and not make anything executable except those wrappers. Since we're generating wrappers anyway, let's actually auto-detect the right version of python for the running system; distros can't seem to agree on what to call their python2 binaries (sigh). We'll fill in the right #! shebang lines. Since we're doing that, we can stop using /usr/bin/env, which will a) make things slightly faster, and b) let us use "python -S", which tells python not to load a bunch of extra crap we're not using, thus improving startup times. Annoyingly, we now have to build redo using minimal/do, then run the tests using bin/redo. To make this less annoying, we add a toplevel ./do script that knows the right steps, and a Makefile (whee!) for people who are used to typing 'make' and 'make test' and 'make clean'. commit 5bc7c861b66460fbfed86eb324bc9ab5f15a07b3 Author: Avery Pennarun <apenwarr@gmail.com> Date: Tue Dec 4 02:52:23 2018 -0500 minimal/do: use "#!/usr/bin/env sh" instead of "#!/bin/sh" This way you can force it to use redo-sh, so that it can pass shelltest.od. commit 8911a222bf4ffe76ff069a0f8852fca8fbffac72 Author: Avery Pennarun <apenwarr@gmail.com> Date: Mon Dec 3 23:41:05 2018 -0500 minimal/do: reminder that nowadays incremental mode is default. commit df44dc54a2021229070b2271e876675496fd125d Author: Avery Pennarun <apenwarr@gmail.com> Date: Tue Dec 4 00:07:23 2018 -0500 jwack: _cheatfds error when run from toplevel make -j. Also added a new unit test to confirm that 'make' behaviour works as expected, with and without parallelism. commit 5abf78059f195b9efe50659397d86663c1f11881 Author: Avery Pennarun <apenwarr@gmail.com> Date: Mon Dec 3 23:20:23 2018 -0500 t/351-deps-forget: forgot skip-if-minimal-do. minimal/do doesn't really understand dependencies at all, to say nothing of forgetting targets and converting them to sources. commit 2d17be11eddff71ccbeb37d53c8b6c4ee68ab96d Author: Avery Pennarun <apenwarr@gmail.com> Date: Tue Dec 4 02:31:41 2018 -0500 sh.do: explicitly check /bin/sh instead of sh. Because our experiment involves creating a file called redo/sh, and the redo directory (or some other version of redo's dirctory) might be on the path, just testing 'sh' is actually wrong: we might end up with some earlier version of redo-sh. Instead, specifically for sh, always demand that we test /bin/sh. commit 07163d81cf6aa596076e5e0b42fa3d16515cc3d7 Author: Avery Pennarun <apenwarr@gmail.com> Date: Tue Dec 4 02:32:14 2018 -0500 shelltest.od: detect some weird zsh problems. This seems to only affect old zsh on MacOS. But we want to catch it anyway, because it caused t/351-deps-forget to fail in a weird way on that version of zsh. Shells really suck. commit 02f307578bdc0da3cfe9f783c1e13c7896bba9e7 Author: Avery Pennarun <apenwarr@gmail.com> Date: Mon Dec 3 21:15:31 2018 -0500 Oops, broken 'install.do' target after pylint fixes. commit 280cf6f3aa10d1afb06a418b48f07d222a0f7504 Author: Avery Pennarun <apenwarr@gmail.com> Date: Mon Dec 3 01:45:36 2018 -0500 Add Roadmap.md. commit e1327540fb95cf00b728304b9f1dcac31bf5591c Author: Avery Pennarun <apenwarr@gmail.com> Date: Sun Dec 2 23:15:37 2018 -0500 Move into the 21st century by fixing some pylint warnings. commit 1966a0fac77db0cc9665caa816385be83cd6bb44 Author: Avery Pennarun <apenwarr@gmail.com> Date: Sun Dec 2 22:53:00 2018 -0500 If using --log or -j > 1, disable stdin. Parallelism and redo-log cause lots of confusion for any rules that try to ask the user for questions, so disable it altogether. Arguably, we should just disable stdin all the time, but maybe it's still occasionally useful (even though you have to pass --no-log to get it back). commit 70f1557413ae02b89f40099cecacb6bd9f4492eb Author: Avery Pennarun <apenwarr@gmail.com> Date: Sun Dec 2 22:35:57 2018 -0500 redo.py: split redo-log options into their own section. This makes it a little more clear which things change the output format vs changing redo functionality. commit 2b0d34f0ed5b9b11668199796396d825a46b9bf5 Author: Avery Pennarun <apenwarr@gmail.com> Date: Sun Dec 2 16:53:05 2018 -0500 More fixes for converting missing targets -> sources. I attempted to fix this in commit c06d1fba4013, but it was apparently incomplete and not all cases were covered by tests. Let's add a much more thorough test by going through every possible combination and making sure redo-{sources,targets,ood} all work as expected, that the "you modified it" warning does or does not show up when expected, and that dependencies are rebuilt the number of times we expect. commit f25ebd6ccc679b147fad14b61b6bd09f90dfaaef Author: Avery Pennarun <apenwarr@gmail.com> Date: Thu Nov 29 14:50:24 2018 -0500 Docs: format inline <code> blocks better. It seems like we're using these differently than most readthedocs.org users. Remove the borders and padding so they work better inline, and prevent confusing word wraps. commit 2e84c1bc02d4e01fe2ab52aef67f6d55f9bfa5f9 Author: Avery Pennarun <apenwarr@gmail.com> Date: Wed Nov 28 14:04:12 2018 -0500 Docs/cookbook: add an R + latex example. This shows how to dynamically generate a plot in R+ggplot2, then embed it into a latex document, and compile it to pdf, all with proper autodependencies. commit 461ef57b26d3282735a7ea37ad0490333b2ca429 Author: Avery Pennarun <apenwarr@gmail.com> Date: Wed Nov 28 12:55:49 2018 -0500 Docs/cookbook: build from toplevel 'test' instead of toplevel 'all'. The cookbook examples are interesting as redo tests, but don't need to be built in order to build redo. commit caa86ac4bdb06948aefe81b015cdaa067c8bb8b3 Author: Avery Pennarun <apenwarr@gmail.com> Date: Mon Nov 26 18:09:36 2018 -0500 Docs: results of more proofreading. commit d9d70c4c44479fd480f5d0fb1860ad330d53149f Author: Avery Pennarun <apenwarr@gmail.com> Date: Mon Nov 26 17:32:19 2018 -0500 Even more doc cleanups. commit 4008ce4a91a1ab0769529e0e7aea3370ff654497 Author: Avery Pennarun <apenwarr@gmail.com> Date: Mon Nov 26 17:04:31 2018 -0500 Change license to Apache 2.0. Mailing list discussion was here: https://groups.google.com/forum/#!topic/redo-list/wLMZMxtn4wo Several more contributors replied to me personally to say that they don't have a problem with the change (and several consider the change to be an improvement). The overwhelming majority of everything in the redo repo was written by me, so I have the right to change the license unilaterally anyway, subject to a few rules. Since the new license actually removes licensing/usage restrictions for everyone, this should be no problem. commit 3b305edc7e640df6018c290b6c4c7401be8f14fa Author: Avery Pennarun <apenwarr@gmail.com> Date: Mon Nov 26 13:10:29 2018 -0500 Cookbook: add an example of using default.do for text processing. commit d663c9b67d675e6d02fe9883b841b8e80ddc10dc Author: Avery Pennarun <apenwarr@gmail.com> Date: Sat Nov 24 14:36:02 2018 -0500 First cookbook example for the docs: Hello World in C. commit d664099c9d5239e918b140cf4e8c104127417bc9 Author: Avery Pennarun <apenwarr@gmail.com> Date: Fri Nov 23 19:35:42 2018 -0500 Undo commit 95680ed: "Switch …
Another victim of this issue here, Not very elegant, but my workaround was to momentarily convert to WSL2 using (surprisingly, it's not much time): wsl.exe --set-version Ubuntu-24.04 2 , then let apt fix the problem with: apt install -f , then convert back to WSL1, with: wsl.exe --set-version Ubuntu-24.04 1 It works now (I guess until the next |
My WSL is the Creator's Update 1703. uname -r reports 4.4.0-43-Microsoft
I'm seeing fcntl(F_SETLK) permit multiple exclusive locks on WSL which is bad, it's instant data corruption for anything relying on this to work. This test launches four child processes and uses a shared memory map to check if fcntl(F_SETLK) is working correctly. This test passes on real Linux, fails badly on WSL:
While you're at it, if you could implement the non-insane fcntl(F_OFD_SETLK) locks that would be very useful. The fcntl(F_SETLK) type locks are stupid.
The text was updated successfully, but these errors were encountered: