Skip to content

Literal newlines in file names break packlists #8

Open
@kentfredric

Description

@kentfredric

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions