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

tmpdir tries to change the current working directory #5948

Closed
p6rt opened this issue Dec 30, 2016 · 4 comments
Closed

tmpdir tries to change the current working directory #5948

p6rt opened this issue Dec 30, 2016 · 4 comments

Comments

@p6rt
Copy link

@p6rt p6rt commented Dec 30, 2016

Migrated from rt.perl.org#130454 (status was 'resolved')

Searchable as RT130454$

@p6rt
Copy link
Author

@p6rt p6rt commented Dec 30, 2016

From @briandfoy

Setting the temporary directory apparently tries to change the current
working directory, which I didn't expect. But, the documentation for
tmpdir doesn't say what it does (https://docs.perl6.org/routine/tmpdir).

  put "Tempdir is " ~ $*TMPDIR;

  {
  my $dir = '/Users/brian/.tmp';
  unless my $rc = tmpdir( '/Users/brian/.not_there' ) {
  my $e = $rc.exception;
  put "unless​: Error changing to $dir " ~ $e.^name ~ '​: ' ~ $e.message;
  }
  CATCH {
  put "CATCH​: Error changing to $dir " ~ .^name;
  }
  }

I expected that tmpdir would return a Failure, and maybe it does if it
doesn't change the current working directory. This may be related to
https://rt-archive.perl.org/perl6/Ticket/Display.html?id=130418
("chdir appears to throw exception immediately").

I would only expect things that want to create a temporary file to use
the value of TMPDIR (say, like
https://github.com/perlpilot/p6-File-Temp). I don't need to know where
that is and wouldn't want the current working directory to be there.
I'd rather have the current working directory be the one where my
input files are.

@p6rt
Copy link
Author

@p6rt p6rt commented May 1, 2017

From @zoffixznet

On Thu, 29 Dec 2016 23​:11​:38 -0800, comdog wrote​:

Setting the temporary directory apparently tries to change the current
working directory, which I didn't expect. But, the documentation for
tmpdir doesn't say what it does
(https://docs.perl6.org/routine/tmpdir).

put "Tempdir is " ~ $*TMPDIR;

{
my $dir = '/Users/brian/.tmp';
unless my $rc = tmpdir( '/Users/brian/.not_there' ) {
my $e = $rc.exception;
put "unless​: Error changing to $dir " ~ $e.^name ~ '​: ' ~
$e.message;
}
CATCH {
put "CATCH​: Error changing to $dir " ~ .^name;
}
}

I expected that tmpdir would return a Failure, and maybe it does if it
doesn't change the current working directory. This may be related to
https://rt-archive.perl.org/perl6/Ticket/Display.html?id=130418
("chdir appears to throw exception immediately").

I would only expect things that want to create a temporary file to use
the value of TMPDIR (say, like
https://github.com/perlpilot/p6-File-Temp). I don't need to know where
that is and wouldn't want the current working directory to be there.
I'd rather have the current working directory be the one where my
input files are.

Thank you for the report.

&tmpdir was removed from Rakudo's implementation and the issue described in this ticket no longer applies.

-- IO grant

@p6rt
Copy link
Author

@p6rt p6rt commented May 1, 2017

The RT System itself - Status changed from 'new' to 'open'

@p6rt
Copy link
Author

@p6rt p6rt commented Jul 15, 2017

@zoffixznet - Status changed from 'open' to 'resolved'

@p6rt p6rt closed this Jul 15, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant