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

.abspath and .absolute are broken for files with leading dashes (‘-foo’.IO.abspath) #5531

Closed
p6rt opened this issue Aug 4, 2016 · 4 comments

Comments

@p6rt
Copy link

p6rt commented Aug 4, 2016

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

Searchable as RT128840$

@p6rt
Copy link
Author

p6rt commented Aug 4, 2016

From @AlexDaniel

Code​:
dd ‘-a’.IO.absolute

Output​:
""

Obviously, that's not how it should work. Files with leading dashes are totally OK and this should not happen.

From https://github.com/rakudo/rakudo/blob/nom/src/core/IO/Path.pm#L51 :

    method abspath() {
        $!abspath //= $!path.starts-with('-')
          ?? ''
          !! $!SPEC.rel2abs($!path,$!CWD);
    }

Perhaps it is there for a reason, but definitely not for a good one.

The commit that introduced it seems to be 5870906 (it has been like this since 2014)

If somebody has stumbled upon this, then the temporary workaround might be to prepend ‘./’ to your paths.

IRC log​: http://irclog.perlgeek.de/perl6/2016-08-04#i_12967414

@p6rt
Copy link
Author

p6rt commented Aug 4, 2016

From @AlexDaniel

On 2016-08-04 07​:19​:29, alex.jakimenko@​gmail.com wrote​:

Code​:
dd ‘-a’.IO.absolute

Output​:
""

Obviously, that's not how it should work. Files with leading dashes
are totally
OK and this should not happen.

From https://github.com/rakudo/rakudo/blob/nom/src/core/IO/Path.pm#L51
:

method abspath() {
$!abspath //= $!path.starts-with('-')
?? ''
!! $!SPEC.rel2abs($!path,$!CWD);
}

Perhaps it is there for a reason, but definitely not for a good one.

The commit that introduced it seems to be 5870906 (it has been like
this since
2014)

If somebody has stumbled upon this, then the temporary workaround
might be to
prepend ‘./’ to your paths.

IRC log​: http://irclog.perlgeek.de/perl6/2016-08-04#i_12967414

Fixed by lizmat++ in 02fdcf9a1f. Tests needed.

@p6rt
Copy link
Author

p6rt commented Sep 9, 2016

From @zoffixznet

Tests added in Raku/roast@7428736eeb

@p6rt
Copy link
Author

p6rt commented Sep 9, 2016

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

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

No branches or pull requests

1 participant