From b439514d5bda1e1d134db8ac362834468735ae6a Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Fri, 16 Apr 2021 16:10:32 -0700 Subject: lei: fix rel2abs We don't want pathnames with "GLOB(0xADD12355)" in them. --- lib/PublicInbox/LEI.pm | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'lib') 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); } -- cgit v1.2.3-24-ge0c7