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

IO::Path.perl produces incorrect expression structure #4885

Closed
p6rt opened this issue Dec 17, 2015 · 5 comments
Closed

IO::Path.perl produces incorrect expression structure #4885

p6rt opened this issue Dec 17, 2015 · 5 comments
Labels

Comments

@p6rt
Copy link

p6rt commented Dec 17, 2015

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

Searchable as RT126950$

@p6rt
Copy link
Author

p6rt commented Dec 17, 2015

From zefram@fysh.org

IO​::Path.perl produces output of the general form
$a.IO(​:SPEC($b),​:CWD($c)), but it turns out that this expression doesn't
actually replicate the SPEC and CWD attributes​:

"foo".IO(​:SPEC(IO​::Spec​::Unix), :CWD("/bar")).perl
q|foo|.IO(​:SPEC(IO​::Spec​::Unix),​:CWD</home/zefram/usr/rakudo/rakudo>)
"foo".IO(​:SPEC(IO​::Spec​::Win32), :CWD("C​:\\bar")).perl
q|foo|.IO(​:SPEC(IO​::Spec​::Unix),​:CWD</home/zefram/usr/rakudo/rakudo>)

Empirically, it would work to instead generate a IO​::Path.new expression​:

IO​::Path.new("foo", :CWD("/bar")).perl
q|foo|.IO(​:SPEC(IO​::Spec​::Unix),​:CWD</bar>)
IO​::Path.new("foo", :SPEC(IO​::Spec​::Win32), :CWD("C​:\\bar")).perl
q|foo|.IO(​:SPEC(IO​::Spec​::Win32),​:CWD<C​:\\bar>)

This is distinct from the string quoting issues that arise in the same
code and are being addressed in [perl #​126935].

-zefram

@p6rt
Copy link
Author

p6rt commented Dec 17, 2015

From @lizmat

On 17 Dec 2015, at 18​:13, Zefram (via RT) <perl6-bugs-followup@​perl.org> wrote​:

# New Ticket Created by Zefram
# Please include the string​: [perl #​126950]
# in the subject line of all future correspondence about this issue.
# <URL​: https://rt-archive.perl.org/perl6/Ticket/Display.html?id=126950 >

IO​::Path.perl produces output of the general form
$a.IO(​:SPEC($b),​:CWD($c)), but it turns out that this expression doesn't
actually replicate the SPEC and CWD attributes​:

"foo".IO(​:SPEC(IO​::Spec​::Unix), :CWD("/bar")).perl
q|foo|.IO(​:SPEC(IO​::Spec​::Unix),​:CWD</home/zefram/usr/rakudo/rakudo>)
"foo".IO(​:SPEC(IO​::Spec​::Win32), :CWD("C​:\\bar")).perl
q|foo|.IO(​:SPEC(IO​::Spec​::Unix),​:CWD</home/zefram/usr/rakudo/rakudo>)

Empirically, it would work to instead generate a IO​::Path.new expression​:

IO​::Path.new("foo", :CWD("/bar")).perl
q|foo|.IO(​:SPEC(IO​::Spec​::Unix),​:CWD</bar>)
IO​::Path.new("foo", :SPEC(IO​::Spec​::Win32), :CWD("C​:\\bar")).perl
q|foo|.IO(​:SPEC(IO​::Spec​::Win32),​:CWD<C​:\\bar>)

This is distinct from the string quoting issues that arise in the same
code and are being addressed in [perl #​126935].

FWIW, I’m not ready to drop the .IO form, because we may want to be able to override that coercer in the future.

Liz

@p6rt
Copy link
Author

p6rt commented Dec 17, 2015

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

@p6rt
Copy link
Author

p6rt commented Jun 5, 2017

From @zoffixznet

On Thu, 17 Dec 2015 09​:13​:52 -0800, zefram@​fysh.org wrote​:

IO​::Path.perl produces output of the general form
$a.IO(​:SPEC($b),​:CWD($c)), but it turns out that this expression doesn't
actually replicate the SPEC and CWD attributes​:

"foo".IO(​:SPEC(IO​::Spec​::Unix), :CWD("/bar")).perl
q|foo|.IO(​:SPEC(IO​::Spec​::Unix),​:CWD</home/zefram/usr/rakudo/rakudo>)
"foo".IO(​:SPEC(IO​::Spec​::Win32), :CWD("C​:\\bar")).perl
q|foo|.IO(​:SPEC(IO​::Spec​::Unix),​:CWD</home/zefram/usr/rakudo/rakudo>)

Empirically, it would work to instead generate a IO​::Path.new expression​:

IO​::Path.new("foo", :CWD("/bar")).perl
q|foo|.IO(​:SPEC(IO​::Spec​::Unix),​:CWD</bar>)
IO​::Path.new("foo", :SPEC(IO​::Spec​::Win32), :CWD("C​:\\bar")).perl
q|foo|.IO(​:SPEC(IO​::Spec​::Win32),​:CWD<C​:\\bar>)

This is distinct from the string quoting issues that arise in the same
code and are being addressed in [perl #​126935].

-zefram

Thank you for the report. This was a month or so ago, as part of the IO grant.

Tests now exist in https://github.com/perl6/roast/blob/a5d933fcefd97ab15b2b2c3cefc8ec7e67a9179c/S32-io/io-path.t#L58-L91

Closing.

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

p6rt commented Jun 5, 2017

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

@p6rt p6rt added the Bug label Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant