about summary refs log tree commit homepage
path: root/lib/PublicInbox/Emergency.pm
DateCommit message (Collapse)
2023-10-11emergency: support hostname of `.'
I think I was too lazy when configuring my Dragonfly VM install.
2023-04-25emergency: make error messages more consistent
Showing "failed" is needless if we already know the program is die-ing. We'll prefix "BUG:" to bug messages, "W:" to non-fatal warnings to be consistent with our newer code such as lei.
2023-02-22treewide: simplify File::Path mkpath/make_path callers
File::Path already accounts for the existence of directories, handles races from redundant mkdir(2), and croaks on unrecoverable errors. So there's no point in doing any of that on our end. Furthermore, avoiding the overhead of loading File::Path doesn't seem worth it to save 20-60ms given the overhead of loading our other code. Instead, try to reduce optree overhead on our code, instead, since File::Path gets used in a bunch of places. We'll also favor the newer make_path for multi-directory invocations to avoid bloating our own optree to create an arrayref, but mkpath is one fewer subroutine call within File::Path itself, right now.
2021-02-19emergency: modernize and reduce syscalls
As with LeiToMail, we'll exclusively rely on O_EXCL and EEXIST instead of "-f" (stat(2)) for file name collision checking. Furthermore, we can rely on link(2) error handling instead of using stat(2) to check the result of link(2). We'll still keep the hostname in these filenames, but memoize it on a per-instance basis since hostname changes are rare and we can assume it won't change between "tmp" and "cur". We'll also start embedding the PID as {"tmp.$$"} into the fiel name to guard against accidental deletion in child processes, instead of requiring an extra hash lookup. Finally, avoid multiple getpid(2) syscalls in internal subs since glibc no longer caches in getpid(3). We'll also favor constant comparison of $! against EEXIST for inlining. and stop doing ->autoflush when we only have a single print + flush.
2021-01-01update copyrights for 2021
Using "make update-copyrights" after setting GNULIB_PATH in my config.mak
2020-07-29emergency: create full path to PI_EMERGENCY
It's possible for ~/.public-inbox/ to not exist if PI_CONFIG points to an alternate location. Only noticed from the previous patch fixing t/init.t behavior.
2020-02-06treewide: run update-copyrights from gnulib for 2019
I didn't wait until September to do it, this year!
2020-01-06treewide: "require" + "use" cleanup and docs
There's a bunch of leftover "require" and "use" statements we no longer need and can get rid of, along with some excessive imports via "use". IO::Handle usage isn't always obvious, so add comments describing why a package loads it. Along the same lines, document the tmpdir support as the reason we depend on File::Temp 0.19, even though every Perl 5.10.1+ user has it. While we're at it, favor "use" over "require", since it it gives us extra compile-time checking.
2019-09-09run update-copyrights from gnulib for 2019
2018-03-29mda: support v2 inboxes
I mainly focus on -watch for mirroring busy mailing lists, but using -mda should remain an option.
2018-02-07update copyrights for 2018
Using update-copyrights from gnulib While we're at it, use the SPDX identifier for AGPL-3.0+ to ease mechanical processing.
2016-06-18emergency: avoid needless mkpath dependency
Be more explicit and slightly speed up tests.
2016-06-15emergency: implement new emergency Maildir delivery
This is transactional and hopefully safer in case we hit SIGSEGV or SIGKILL during processing, as the tmp/ copy will remain on the FS even if DESTROY/END handlers are not called.