* [PATCH 00/19] lei import Maildir, remote mboxrd fixes
@ 2021-02-07 8:51 7% Eric Wong
2021-02-07 8:51 6% ` [PATCH 01/19] spawn: pi_fork_exec: restore parent sigmask in child Eric Wong
0 siblings, 1 reply; 2+ results
From: Eric Wong @ 2021-02-07 8:51 UTC (permalink / raw)
To: meta
"lei q" with remote mboxrd + early MUA spawning is
nicer, too. Several risky constructs eliminated,
Interrupting "add-external --mirror" is less bad, now;
though it could probably support indexlevel=none in
case somebody wants to run index themselves.
Eric Wong (19):
spawn: pi_fork_exec: restore parent sigmask in child
spawn: pi_fork_exec: support "pgid"
lei add-external: handle interrupts with --mirror
spawn_pp: die more consistently in child
ipc: do not die inside wq_worker child process
ipc: trim down the Storable checks
Makefile.PL: depend on IO::Uncompress::Gunzip
xapcmd: avoid potential die surprise in children
tests: guard setup_public_inboxes for SQLite and Xapian
Revert "ipc: add support for asynchronous callbacks"
ipc: wq_do => wq_io_do
lei: more consistent IPC exit and error handling
lei: remove --mua-cmd alias for --mua
lei: replace --thread with --threads
lei q: improve remote mboxrd UX
lei q: SIGWINCH process group with the terminal
lei import: support Maildirs
imap: avoid unnecessary delete on stack
httpd/async: avoid unnecessary on-stack delete
Documentation/lei-q.pod | 4 +-
MANIFEST | 1 +
Makefile.PL | 1 +
lib/PublicInbox/HTTPD/Async.pm | 2 +-
lib/PublicInbox/IMAP.pm | 6 +-
lib/PublicInbox/IPC.pm | 105 +++++++-----------------
lib/PublicInbox/LEI.pm | 49 +++++++----
lib/PublicInbox/LeiCurl.pm | 11 ++-
lib/PublicInbox/LeiHelp.pm | 6 +-
lib/PublicInbox/LeiImport.pm | 38 ++++++---
lib/PublicInbox/LeiMirror.pm | 75 ++++++++++-------
lib/PublicInbox/LeiOverview.pm | 7 +-
lib/PublicInbox/LeiQuery.pm | 4 +-
lib/PublicInbox/LeiStore.pm | 8 +-
lib/PublicInbox/LeiToMail.pm | 37 ++++-----
lib/PublicInbox/LeiXSearch.pm | 143 ++++++++++++++++++++-------------
lib/PublicInbox/Mbox.pm | 2 +-
lib/PublicInbox/OnDestroy.pm | 2 +-
lib/PublicInbox/Search.pm | 2 +-
lib/PublicInbox/SearchView.pm | 2 +-
lib/PublicInbox/Spawn.pm | 63 +++++++++------
lib/PublicInbox/SpawnPP.pm | 44 +++++-----
lib/PublicInbox/Xapcmd.pm | 11 +--
script/lei | 8 +-
t/ipc.t | 39 ++-------
t/lei-externals.t | 2 +
t/lei-import-maildir.t | 33 ++++++++
t/lei-mirror.t | 14 ++++
t/lei.t | 2 +-
t/lei_to_mail.t | 6 +-
t/spawn.t | 18 +++++
xt/stress-sharedkv.t | 6 +-
32 files changed, 433 insertions(+), 318 deletions(-)
create mode 100644 t/lei-import-maildir.t
^ permalink raw reply [relevance 7%]
* [PATCH 01/19] spawn: pi_fork_exec: restore parent sigmask in child
2021-02-07 8:51 7% [PATCH 00/19] lei import Maildir, remote mboxrd fixes Eric Wong
@ 2021-02-07 8:51 6% ` Eric Wong
0 siblings, 0 replies; 2+ results
From: Eric Wong @ 2021-02-07 8:51 UTC (permalink / raw)
To: meta
We continue to unblock SIGCHLD unconditionally, but also
any signals not blocked by the parent (wq_worker).
This will allow Ctrl-C (SIGINT) to stop "git clone" and allow
git-clone cleanup to be performed and other long-running
processes when pi_fork_exec supports setpgid(2). This won't
affect existing daemons on systems with signalfd(2) or
EVFILT_SIGNAL at all, since those run with signals blocked
anyways.
---
lib/PublicInbox/Spawn.pm | 26 ++++++++++++--------------
lib/PublicInbox/SpawnPP.pm | 6 ++----
2 files changed, 14 insertions(+), 18 deletions(-)
diff --git a/lib/PublicInbox/Spawn.pm b/lib/PublicInbox/Spawn.pm
index f7dcb024..bac24dd1 100644
--- a/lib/PublicInbox/Spawn.pm
+++ b/lib/PublicInbox/Spawn.pm
@@ -82,20 +82,20 @@ int pi_fork_exec(SV *redirref, SV *file, SV *cmdref, SV *envref, SV *rlimref,
const char *filename = SvPV_nolen(file);
pid_t pid;
char **argv, **envp;
- sigset_t set, old, cset;
+ sigset_t set, old;
int ret, perrnum, cerrnum = 0;
+ int chld_is_member;
AV2C_COPY(argv, cmd);
AV2C_COPY(envp, env);
- ret = sigfillset(&set);
- assert(ret == 0 && "BUG calling sigfillset");
- ret = sigprocmask(SIG_SETMASK, &set, &old);
- assert(ret == 0 && "BUG calling sigprocmask to block");
- ret = sigemptyset(&cset);
- assert(ret == 0 && "BUG calling sigemptyset");
- ret = sigaddset(&cset, SIGCHLD);
- assert(ret == 0 && "BUG calling sigaddset for SIGCHLD");
+ if (sigfillset(&set)) return -1;
+ if (sigprocmask(SIG_SETMASK, &set, &old)) return -1;
+ chld_is_member = sigismember(&old, SIGCHLD);
+ if (chld_is_member < 0) return -1;
+ if (chld_is_member > 0)
+ sigdelset(&old, SIGCHLD);
+
pid = vfork();
if (pid == 0) {
int sig;
@@ -127,15 +127,13 @@ int pi_fork_exec(SV *redirref, SV *file, SV *cmdref, SV *envref, SV *rlimref,
exit_err(&cerrnum);
}
- /*
- * don't bother unblocking other signals for now, just SIGCHLD.
- * we don't want signals to the group taking out a subprocess
- */
- (void)sigprocmask(SIG_UNBLOCK, &cset, NULL);
+ (void)sigprocmask(SIG_SETMASK, &old, NULL);
execve(filename, argv, envp);
exit_err(&cerrnum);
}
perrnum = errno;
+ if (chld_is_member > 0)
+ sigaddset(&old, SIGCHLD);
ret = sigprocmask(SIG_SETMASK, &old, NULL);
assert(ret == 0 && "BUG calling sigprocmask to restore");
if (cerrnum) {
diff --git a/lib/PublicInbox/SpawnPP.pm b/lib/PublicInbox/SpawnPP.pm
index b0ad4da5..f64b95dc 100644
--- a/lib/PublicInbox/SpawnPP.pm
+++ b/lib/PublicInbox/SpawnPP.pm
@@ -37,10 +37,8 @@ sub pi_fork_exec ($$$$$$) {
chdir $cd or die "chdir $cd: $!";
}
$SIG{$_} = 'DEFAULT' for keys %SIG;
- my $cset = POSIX::SigSet->new();
- $cset->addset(POSIX::SIGCHLD) or die "can't add SIGCHLD: $!";
- sigprocmask(SIG_UNBLOCK, $cset) or
- die "can't unblock SIGCHLD: $!";
+ $old->delset(POSIX::SIGCHLD) or die "delset SIGCHLD: $!";
+ sigprocmask(SIG_SETMASK, $old) or die "SETMASK: ~SIGCHLD: $!";
if ($ENV{MOD_PERL}) {
exec which('env'), '-i', @$env, @$cmd;
die "exec env -i ... $cmd->[0] failed: $!\n";
^ permalink raw reply related [relevance 6%]
Results 1-2 of 2 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2021-02-07 8:51 7% [PATCH 00/19] lei import Maildir, remote mboxrd fixes Eric Wong
2021-02-07 8:51 6% ` [PATCH 01/19] spawn: pi_fork_exec: restore parent sigmask in child Eric Wong
Code repositories for project(s) associated with this public inbox
https://80x24.org/public-inbox.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).