* [PATCH 03/13] process_pipe: don't run `close' unless requested
2023-10-01 9:54 5% [PATCH 00/13] various warning/diagnostic fixes Eric Wong
@ 2023-10-01 9:54 7% ` Eric Wong
0 siblings, 0 replies; 2+ results
From: Eric Wong @ 2023-10-01 9:54 UTC (permalink / raw)
To: meta
If a user is relying on reference counts to invalidate FDs
(as we do in many places), rely on them instead of explicit
`close'. This forces us to do a better job of managing refs
and avoiding redundant fields which make our code more fragile.
---
lib/PublicInbox/ProcessPipe.pm | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/PublicInbox/ProcessPipe.pm b/lib/PublicInbox/ProcessPipe.pm
index 16971801..ba2c1ecb 100644
--- a/lib/PublicInbox/ProcessPipe.pm
+++ b/lib/PublicInbox/ProcessPipe.pm
@@ -58,7 +58,7 @@ sub FILENO { fileno($_[0]->{fh}) }
sub _close ($;$) {
my ($self, $wait) = @_;
my ($fh, $pid) = delete(@$self{qw(fh pid)});
- my $ret = defined($fh) ? close($fh) : '';
+ my $ret = (defined($fh) && $wait) ? close($fh) : ($fh = '');
return $ret unless defined($pid) && $self->{ppid} == $$;
if ($wait) { # caller cares about the exit status:
# synchronous wait via defined(wantarray) on awaitpid:
^ permalink raw reply related [relevance 7%]
* [PATCH 00/13] various warning/diagnostic fixes
@ 2023-10-01 9:54 5% Eric Wong
2023-10-01 9:54 7% ` [PATCH 03/13] process_pipe: don't run `close' unless requested Eric Wong
0 siblings, 1 reply; 2+ results
From: Eric Wong @ 2023-10-01 9:54 UTC (permalink / raw)
To: meta
13/13 could be important to people who have trouble doing 2>&1
into a pager.
11/13 and lei-daemon missing -w is the cause for patches 6..10 :x
The rest were various things I noticed along the way.
Eric Wong (13):
gcf2: take non-ref scalar request arg
t/git: show git_version in diag output
process_pipe: don't run `close' unless requested
git: improve error reporting
git: packed_bytes: deal with glob+stat TOCTTOU
lei rediff: `git diff -O<order-file>' support
lei: correct exit signal
lei mail-diff: don't remove temporary subdirectory
lei_store: unlink stderr buffer early
overidx: fix version comparison
treewide: enable warnings in all exec-ed processes
lei: ->fail only allows integer exit codes
lei: deal with clients with blocked stderr
lib/PublicInbox/Gcf2Client.pm | 11 ++++++-----
lib/PublicInbox/Git.pm | 10 ++++------
lib/PublicInbox/GitAsyncCat.pm | 4 ++--
lib/PublicInbox/LEI.pm | 15 ++++++++-------
lib/PublicInbox/LeiMailDiff.pm | 2 --
lib/PublicInbox/LeiRediff.pm | 5 +++--
lib/PublicInbox/LeiStore.pm | 21 +++++++++++++--------
lib/PublicInbox/LeiStoreErr.pm | 27 +++++++++++++++++++++++++--
lib/PublicInbox/OverIdx.pm | 9 +++++----
lib/PublicInbox/ProcessPipe.pm | 2 +-
script/lei | 4 ++--
t/edit.t | 29 +++++++++++++++--------------
t/extsearch.t | 2 +-
t/gcf2_client.t | 32 ++++++++++++++++----------------
t/git.t | 6 +++---
t/lei-q-save.t | 4 ++--
t/mbox_reader.t | 6 +++---
t/spawn.t | 4 ++--
18 files changed, 111 insertions(+), 82 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 --
2023-10-01 9:54 5% [PATCH 00/13] various warning/diagnostic fixes Eric Wong
2023-10-01 9:54 7% ` [PATCH 03/13] process_pipe: don't run `close' unless requested 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).