develooper Front page | perl.perl5.porters | Postings from January 2018

Re: [perl #132648] Cwd: different return values between pure perland XS variants

Thread Previous | Thread Next
From:
Tony Cook
Date:
January 16, 2018 10:27
Subject:
Re: [perl #132648] Cwd: different return values between pure perland XS variants
Message ID:
20180116102534.wnowunbuyv7bypqe@mars.tony.develop-help.com
On Tue, Jan 16, 2018 at 08:23:58AM +0000, Zefram wrote:
> Tony Cook wrote:
> >Having to record that the directory (or file) is marked deleted and
> >not make it available to getcwd(), open(), opendir(), unlink() etc
> 
> That's not what I'm proposing, and would be totally unworkable.
> 
> If rmdir(2) doesn't actually succeed in removing the directory
> (immediately), then I'll add a check for that in cwd_enoent.t, skipping
> the tests if the directory didn't go away.  If rmdir() does remove the
> directory and pwd(1) emits a name that can't be used, then I'll add a
> check for that in _backtick_pwd(), to prevent it returning an unusable
> name.

If this what you need?

tony@saturn ~/dev/perl/git
$ perl 132648.pl
/home/tony/dev/perl/git/foo

tony@saturn ~/dev/perl/git
$ cat 132648.pl
#!perl
use Cwd;

mkdir "foo", 0700
  or die "mkdir $!";
chdir "foo"
  or die "chdir $!";
rmdir "../foo"
  or die "rmdir $!";
my $cwd = getcwd
  or die "getcwd $!";
print "$cwd\n";
print "$cwd is a dir\n" if -d $cwd;

Tony

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About