Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

temp directories may be deleted by child processes #12

Closed
skaji opened this issue May 13, 2018 · 3 comments
Closed

temp directories may be deleted by child processes #12

skaji opened this issue May 13, 2018 · 3 comments

Comments

@skaji
Copy link
Contributor

skaji commented May 13, 2018

Currently directories created by File::pushd::tempd may be deleted by child processes.

# test.pl
use strict;
use warnings;
use File::pushd;
use Cwd 'getcwd';

my $tempd = tempd;

my $pid = fork // die;

if ($pid == 0) {
    exit;
}
wait;

my $cwd = getcwd or die "getcwd: $!";
❯ perl test.pl
getcwd: No such file or directory at test.pl line 16.

I think it would be nice

  • a) to delete directories only if $$ = pid who created the directories, or
  • b) to document this behavior in pod clearly.
@xdg
Copy link
Contributor

xdg commented May 13, 2018

Good catch. Do you want to write a patch and test to cache and check $$ in DESTROY?

@skaji
Copy link
Contributor Author

skaji commented May 13, 2018

@xdg Thanks!

@xdg
Copy link
Contributor

xdg commented May 14, 2018

Thank you! I've released it as a -TRIAL and have a note in my calendar for next week to release stable if it's smoking well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants