about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2021-04-16 16:10:32 -0700
committerEric Wong <e@80x24.org>2021-04-17 10:00:45 +0000
commitb439514d5bda1e1d134db8ac362834468735ae6a (patch)
tree265bbe4e9217183830da6dcba22a7acfd9e353a6
parent5df7b58488e0af9b082ed472cc7e693de869ec63 (diff)
downloadpublic-inbox-b439514d5bda1e1d134db8ac362834468735ae6a.tar.gz
We don't want pathnames with "GLOB(0xADD12355)" in them.
-rw-r--r--lib/PublicInbox/LEI.pm13
1 files changed, 7 insertions, 6 deletions
diff --git a/lib/PublicInbox/LEI.pm b/lib/PublicInbox/LEI.pm
index 52b588a2..ebd0f154 100644
--- a/lib/PublicInbox/LEI.pm
+++ b/lib/PublicInbox/LEI.pm
@@ -68,18 +68,19 @@ sub rel2abs ($$) {
         my ($self, $p) = @_;
         return $p if index($p, '/') == 0; # already absolute
         my $pwd = $self->{env}->{PWD};
+        my $cwd;
         if (defined $pwd) {
-                my $cwd = $self->{3} // getcwd() // die "getcwd(PWD=$pwd): $!";
+                my $xcwd = $self->{3} //
+                        ($cwd = getcwd() // die "getcwd(PWD=$pwd): $!");
                 if (my @st_pwd = stat($pwd)) {
-                        my @st_cwd = stat($cwd) or die "stat($cwd): $!";
+                        my @st_cwd = stat($xcwd) or die "stat($xcwd): $!";
                         "@st_pwd[1,0]" eq "@st_cwd[1,0]" or
-                                $self->{env}->{PWD} = $pwd = $cwd;
+                                $self->{env}->{PWD} = $pwd = undef;
                 } else { # PWD was invalid
-                        delete $self->{env}->{PWD};
-                        undef $pwd;
+                        $self->{env}->{PWD} = $pwd = undef;
                 }
         }
-        $pwd //= $self->{env}->{PWD} = getcwd() // die "getcwd(PWD=$pwd): $!";
+        $pwd //= $self->{env}->{PWD} = $cwd // getcwd() // die "getcwd: $!";
         File::Spec->rel2abs($p, $pwd);
 }