From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.0 required=3.0 tests=ALL_TRUSTED,BAYES_00 shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 509AE1FA04; Mon, 11 May 2020 00:29:27 +0000 (UTC) Date: Mon, 11 May 2020 00:29:27 +0000 From: Eric Wong To: meta@public-inbox.org Subject: Re: [PATCH 5/5] spawn: use ~/.cache/public-inbox/inline-c if writable Message-ID: <20200511002927.GA13730@dcvr> References: <20200510223715.19254-1-e@yhbt.net> <20200510223715.19254-6-e@yhbt.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20200510223715.19254-6-e@yhbt.net> List-Id: Eric Wong wrote: > -my $inline_dir = $ENV{PERL_INLINE_DIRECTORY}; > -$vfork_spawn = undef unless defined $inline_dir && -d $inline_dir && -w _; > +my $inline_dir = $ENV{PERL_INLINE_DIRECTORY} // ( > + $ENV{XDG_CACHE_HOME} // > + (($ENV{HOME} // (getpwuid($>))[7]).'/.cache') Erm, nobody runs perl with setuid, anyways, right? diff --git a/lib/PublicInbox/Spawn.pm b/lib/PublicInbox/Spawn.pm index 489472502fa..eaebb062393 100644 --- a/lib/PublicInbox/Spawn.pm +++ b/lib/PublicInbox/Spawn.pm @@ -143,7 +143,7 @@ VFORK_SPAWN my $inline_dir = $ENV{PERL_INLINE_DIRECTORY} // ( $ENV{XDG_CACHE_HOME} // - (($ENV{HOME} // (getpwuid($>))[7]).'/.cache') + (($ENV{HOME} // (getpwuid($<))[7]).'/.cache') ).'/public-inbox/inline-c'; $vfork_spawn = undef unless -d $inline_dir && -w _; On the other hand, I'm not sure if the getpwuid call is even worth it when we can hard-code "/nonexistent" for "nobody" when $HOME is undefined...