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

Command line arguments try and open as a file #6376

Closed
p6rt opened this issue Jul 5, 2017 · 5 comments
Closed

Command line arguments try and open as a file #6376

p6rt opened this issue Jul 5, 2017 · 5 comments
Labels
IO regression Issue did not exist previously

Comments

@p6rt
Copy link

p6rt commented Jul 5, 2017

Migrated from rt.perl.org#131703 (status was 'rejected')

Searchable as RT131703$

@p6rt
Copy link
Author

p6rt commented Jul 5, 2017

From @samcv

Here is the offending code
https://gist.github.com/9ed8322b4c9e1a40e1f3df495d8cee1d (not written by
me).

If you run it normally with no arguments and just press enter till the
end of execution, there are no issues. If you run `perl6 deckofpain.p6
easy` at the end of execution you get

Failed to open file /home/samantha/proj/perl6/easy​: No such file or
directory
  in sub MAIN at deck-of-pain.p6 line 127
  in block <unit> at deck-of-pain.p6 line 30

This is the commit that introduced this regression​:

[io grant] Swap IO​::ArgFiles to IO​::CatHandle impl

rakudo/rakudo@f539a62

@p6rt
Copy link
Author

p6rt commented Jul 5, 2017

From @zoffixznet

On Tue, 04 Jul 2017 22​:20​:58 -0700, samantham@​posteo.net wrote​:

Here is the offending code
https://gist.github.com/9ed8322b4c9e1a40e1f3df495d8cee1d (not written
by
me).

If you run it normally with no arguments and just press enter till the
end of execution, there are no issues. If you run `perl6 deckofpain.p6
easy` at the end of execution you get

Failed to open file /home/samantha/proj/perl6/easy​: No such file or
directory
in sub MAIN at deck-of-pain.p6 line 127
in block <unit> at deck-of-pain.p6 line 30

This is the commit that introduced this regression​:

[io grant] Swap IO​::ArgFiles to IO​::CatHandle impl

rakudo/rakudo@f539a62

Thank you for the report, however there's no bug here.

The script you linked to has a bug in that it assumes `get()` gets from $*IN, when it actually gets from $*ARGFILES, which is set to $*IN when there are no arguments given, and is set to a CatHandle made out of @​*ARGS when there are args.

The reason for the observed regression is that pre-commit `get()` actually ended up inadvertently marking the Failure obtained during read from non-existent file as handled, so it was never getting exploded. And now it does.

The script needs to be fixed by using `prompt` with no args instead.

Cheers,
ZZ

@p6rt
Copy link
Author

p6rt commented Jul 5, 2017

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

@p6rt
Copy link
Author

p6rt commented Jul 5, 2017

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

@p6rt p6rt closed this as completed Jul 5, 2017
@p6rt
Copy link
Author

p6rt commented Jul 5, 2017

From @zoffixznet

On Wed, 05 Jul 2017 02​:42​:18 -0700, cpan@​zoffix.com wrote​:

The script needs to be fixed by using `prompt` with no args instead.

After a discussion, wrote up a 6.d proposal[^2] to make $*ARGFILES be based on $*IN and not (@​*ARGS || $*IN) when inside sub MAIN()

[1] https://irclog.perlgeek.de/perl6-dev/2017-07-05#i_14827981
[2] Raku/old-design-docs@658d1e5c35

@p6rt p6rt added IO regression Issue did not exist previously labels Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
IO regression Issue did not exist previously
Projects
None yet
Development

No branches or pull requests

1 participant