* spew
@ 2015-06-29 17:45 Eric Wong
0 siblings, 0 replies; 3+ messages in thread
From: Eric Wong @ 2015-06-29 17:45 UTC (permalink / raw)
To: spew
diff --git a/st.c b/st.c
index 4b9099c..eb95fe3 100644
--- a/st.c
+++ b/st.c
@@ -196,7 +196,8 @@ stat_col(void)
static struct list_head *
st_head(const st_table *tbl)
{
- return (struct list_head *)&tbl->as.big.private_list_head;
+ uintptr_t addr = &tbl->as.big.private_list_head;
+ return (struct list_head *)addr;
}
st_table*
^ permalink raw reply related [flat|nested] 3+ messages in thread
* spew
@ 2015-08-23 19:32 Eric Wong
0 siblings, 0 replies; 3+ messages in thread
From: Eric Wong @ 2015-08-23 19:32 UTC (permalink / raw)
To: spew
diff --git a/lib/PublicInbox/SearchIdx.pm b/lib/PublicInbox/SearchIdx.pm
index 5664c38..fdc4a6f 100644
--- a/lib/PublicInbox/SearchIdx.pm
+++ b/lib/PublicInbox/SearchIdx.pm
@@ -21,18 +21,21 @@ sub new {
my $dir = $class->xdir($git_dir);
require Search::Xapian::WritableDatabase;
my $flag = Search::Xapian::DB_OPEN;
+ my $self = bless { git_dir => $git_dir }, $class;
+ my $perm = $self->_git_config_perm;
+ my $umask = _umask_for($perm);
+ $self->{umask} = $umask;
+ open(my $fh, '>>', '/tmp/pi-err.log');
+ print $fh sprintf("perm: $perm umask %o\n", $umask);
+
if ($writable == 1) {
require File::Path;
- File::Path::mkpath($dir);
+ $self->with_umask(sub { File::Path::mkpath($dir) });
$flag = Search::Xapian::DB_CREATE_OR_OPEN;
}
- my $self = bless { git_dir => $git_dir }, $class;
- my $umask = _umask_for($self->_git_config_perm);
- my $old_umask = umask $umask;
- my $db = eval { Search::Xapian::WritableDatabase->new($dir, $flag) };
- my $err = $@;
- umask $old_umask;
- die $err if $err;
+ my $db = $self->with_umask(sub {
+ Search::Xapian::WritableDatabase->new($dir, $flag);
+ });
$self->{xdb} = $db;
$self;
}
@@ -288,9 +291,14 @@ sub do_cat_mail {
$@ ? undef : $mime;
}
-# indexes all unindexed messages
sub index_sync {
my ($self, $head) = @_;
+ $self->with_umask(sub { $self->_index_sync($head) });
+}
+
+# indexes all unindexed messages
+sub _index_sync {
+ my ($self, $head) = @_;
require PublicInbox::GitCatFile;
my $db = $self->{xdb};
my $hex = '[a-f0-9]';
@@ -423,4 +431,14 @@ sub _umask_for {
(~$rv & 0777);
}
+sub with_umask {
+ my ($self, $cb) = @_;
+ my $old = umask $self->{umask};
+ my $rv = eval { $cb->() };
+ my $err = $@;
+ umask $old;
+ die $err if $@;
+ $rv;
+}
+
1;
diff --git a/public-inbox-mda b/public-inbox-mda
index 8e98d6e..15ec890 100755
--- a/public-inbox-mda
+++ b/public-inbox-mda
@@ -88,7 +88,12 @@ sub do_spamc {
sub search_index_sync {
my ($git_dir) = @_;
eval {
- require PublicInbox::Search;
+ require PublicInbox::SearchIdx;
PublicInbox::SearchIdx->new($git_dir, 2)->index_sync;
};
+ if ($@) {
+ my $err = $@;
+ open(my $fh, '>>', '/tmp/pi-err.log');
+ print $fh $err;
+ }
}
^ permalink raw reply related [flat|nested] 3+ messages in thread
* spew
@ 2016-08-02 20:54 Eric Wong
0 siblings, 0 replies; 3+ messages in thread
From: Eric Wong @ 2016-08-02 20:54 UTC (permalink / raw)
To: spew
diff --git a/lib/yahns/http_response.rb b/lib/yahns/http_response.rb
index 88ff9f9..f2d9c62 100644
--- a/lib/yahns/http_response.rb
+++ b/lib/yahns/http_response.rb
@@ -126,6 +126,7 @@ def http_response_write(status, headers, body, hdr_only)
k = self.class
alive = @hs.next? && k.persistent_connections
flags = MSG_DONTWAIT
+ term = false
if @hs.headers?
code = status.to_i
@@ -147,14 +148,19 @@ def http_response_write(status, headers, body, hdr_only)
# allow Rack apps to tell us they want to drop the client
alive = false if value =~ /\bclose\b/i
when %r{\AContent-Length\z}i
+ term = true
flags |= MSG_MORE if value.to_i > 0 && !hdr_only
kv_str(buf, key, value)
+ when %r{\ATransfer-Encoding\z}i
+ term = true if value =~ /\bchunked\b/i
+ kv_str(buf, key, value)
when "rack.hijack"
hijack = value
else
kv_str(buf, key, value)
end
end
+ alive &&= term
buf << (alive ? "Connection: keep-alive\r\n\r\n".freeze
: "Connection: close\r\n\r\n".freeze)
case rv = kgio_syssend(buf, flags)
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-08-02 20:54 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-08-23 19:32 spew Eric Wong
-- strict thread matches above, loose matches on Subject: below --
2016-08-02 20:54 spew Eric Wong
2015-06-29 17:45 spew Eric Wong
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).