user/dev discussion of public-inbox itself
 help / color / mirror / code / Atom feed
Search results ordered by [date|relevance]  view[summary|nested|Atom feed]
thread overview below | download mbox.gz: |
* [PATCH 1/2] lei_to_mail: Maildir: ensure link(2) succeeds
  2021-02-19  0:58  5% [PATCH 0/2] Maildir fixups Eric Wong
@ 2021-02-19  0:58  7% ` Eric Wong
  0 siblings, 0 replies; 2+ results
From: Eric Wong @ 2021-02-19  0:58 UTC (permalink / raw)
  To: meta

link(2) may fail with errors other than EEXIST; just bail out
since something is likely seriously wrong.
---
 lib/PublicInbox/LeiToMail.pm | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/PublicInbox/LeiToMail.pm b/lib/PublicInbox/LeiToMail.pm
index f0adc44f..8a2d9471 100644
--- a/lib/PublicInbox/LeiToMail.pm
+++ b/lib/PublicInbox/LeiToMail.pm
@@ -302,8 +302,9 @@ sub _buf2maildir {
 		$rand = '';
 		do {
 			$final = $dst.$rand.$common.':2,'.$sfx;
-		} while (!link($tmp, $final) && $! == EEXIST &&
+		} while (!($ok = link($tmp, $final)) && $! == EEXIST &&
 			($rand = _rand.','));
+		die "link($tmp, $final): $!" unless $ok;
 		unlink($tmp) or warn "W: failed to unlink $tmp: $!\n";
 	} else {
 		my $err = "Error writing $smsg->{blob} to $dst: $!\n";

^ permalink raw reply related	[relevance 7%]

* [PATCH 0/2] Maildir fixups
@ 2021-02-19  0:58  5% Eric Wong
  2021-02-19  0:58  7% ` [PATCH 1/2] lei_to_mail: Maildir: ensure link(2) succeeds Eric Wong
  0 siblings, 1 reply; 2+ results
From: Eric Wong @ 2021-02-19  0:58 UTC (permalink / raw)
  To: meta

Emergency only writes to "new", and LeiToMail only writes to
"cur", but otherwise try to make them more similar.  LeiToMail
remains more performance critical since it's for bulk dumps;
and Emergency is close to the original djb specification with
hostname and PID in the filename.

Eric Wong (2):
  lei_to_mail: Maildir: ensure link(2) succeeds
  emergency: modernize and reduce syscalls

 lib/PublicInbox/Emergency.pm | 59 +++++++++++++++---------------------
 lib/PublicInbox/LeiToMail.pm |  3 +-
 2 files changed, 26 insertions(+), 36 deletions(-)

^ permalink raw reply	[relevance 5%]

Results 1-2 of 2 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2021-02-19  0:58  5% [PATCH 0/2] Maildir fixups Eric Wong
2021-02-19  0:58  7% ` [PATCH 1/2] lei_to_mail: Maildir: ensure link(2) succeeds 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).