X-Git-Url: http://www.git.stargrave.org/?a=blobdiff_plain;f=lib%2FPublicInbox%2FLeiMirror.pm;h=4be8f70ae4015b63c6cd8622715dc67f69a045ea;hb=97510d7a92b4e44318d1917a54c70d536bbf46f2;hp=5cfa6fea851c9d11b6979228e9e950c49adef69d;hpb=9f02576da775abf208f5a03c03b6f7abd72596d0;p=public-inbox.git diff --git a/lib/PublicInbox/LeiMirror.pm b/lib/PublicInbox/LeiMirror.pm index 5cfa6fea..4be8f70a 100644 --- a/lib/PublicInbox/LeiMirror.pm +++ b/lib/PublicInbox/LeiMirror.pm @@ -96,15 +96,15 @@ sub _get_txt { # non-fatal my $path = $uri->path; chop($path) eq '/' or die "BUG: $uri not canonicalized"; $uri->path("$path/$endpoint"); - my $cmd = $self->{curl}->for_uri($lei, $uri, '--compressed'); - my $ce = "$self->{dst}/$file"; - my $ft = File::Temp->new(TEMPLATE => "$file-XXXX", - UNLINK => 1, DIR => $self->{dst}); - my $opt = { 0 => $lei->{0}, 1 => $ft, 2 => $lei->{2} }; + my $ft = File::Temp->new(TEMPLATE => "$file-XXXX", DIR => $self->{dst}); + my $f = $ft->filename; + my $opt = { 0 => $lei->{0}, 1 => $lei->{1}, 2 => $lei->{2} }; + my $cmd = $self->{curl}->for_uri($lei, $uri, + qw(--compressed -R -o), $f); my $cerr = run_reap($lei, $cmd, $opt); return "$uri missing" if ($cerr >> 8) == 22; return "# @$cmd failed (non-fatal)" if $cerr; - my $f = $ft->filename; + my $ce = "$self->{dst}/$file"; rename($f, $ce) or return "rename($f, $ce): $! (non-fatal)"; $ft->unlink_on_destroy(0); undef; # success @@ -122,6 +122,7 @@ sub _try_config { my $err = _get_txt($self, qw(_/text/config/raw inbox.config.example)); return $self->{lei}->err($err) if $err; my $f = "$self->{dst}/inbox.config.example"; + chmod((stat($f))[2] & 0444, $f) or die "chmod(a-w, $f): $!"; my $cfg = PublicInbox::Config->git_config_dump($f, $self->{lei}->{2}); my $ibx = $self->{ibx} = {}; for my $sec (grep(/\Apublicinbox\./, @{$cfg->{-section_order}})) {