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

Literal newlines in file names break packlists #8

Open
kentfredric opened this issue Dec 6, 2015 · 0 comments
Open

Literal newlines in file names break packlists #8

kentfredric opened this issue Dec 6, 2015 · 0 comments

Comments

@kentfredric
Copy link

Being a line-oriented file format, literal newlines in paths cause generated packlists to be wrong.

use strict;
use warnings;

use Test::More;

use ExtUtils::Packlist;
use File::Temp qw( tempfile );

my $packlist = ExtUtils::Packlist->new();

my $evil_path = "/some/evil\npath";
my $packfile  = tempfile;

$packlist->{$evil_path} = { type => 'file' };
$packlist->write($packfile);
my $new_packlist = ExtUtils::Packlist->new($packfile);

ok( exists $packlist->{$evil_path},
    "Original path found in packlist before writing" )
  or diag explain $packlist;

ok( exists $new_packlist->{$evil_path},
    "Original path found in packlist after reading" )
  or diag explain $new_packlist;

done_testing;
ok 1 - Original path found in packlist before writing
not ok 2 - Original path found in packlist after reading
#   Failed test 'Original path found in packlist after reading'
#   at /tmp/eup.pl line 22.
# bless( {
#   '/some/evil' => undef,
#   'path' => {
#     'type' => 'file'
#   }
# }, 'ExtUtils::Packlist' )
1..2
# Looks like you failed 1 test of 2
demerphq added a commit that referenced this issue May 18, 2017
Currently the packfile format simply does not allow for the data
it stores to contain a newline. Instead of allowing us to write
a broken packfile and then find out later it is unreadable we throw
an exception when we try to write.

This is part of a response to Issue #8.
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

1 participant