Branch Coverage

blib/lib/Sys/Export/Unix.pm
Criterion Covered Total %
branch 179 370 48.3


line true false branch
26 9 0 !(@_ & 1) ? :
0 9 @_ == 1 && &isa_hash($_[0]) ? :
30 0 9 unless defined $attrs{'src'}
31 0 9 unless my $abs_src = abs_path($attrs{'src'} =~ s[(?<=[^/])$][/]ru)
33 2 7 $abs_src eq '/' ? :
35 0 9 unless defined $attrs{'dst'}
36 3 6 if (&isa_export_dst($attrs{'dst'})) { }
0 6 elsif (&isa_array($attrs{'dst'})) { }
41 0 0 if (uc $type eq 'CPIO') { }
48 0 6 unless my $dst_abs = abs_path($attrs{'dst'} =~ s[(?<=[^/])$][/]ru)
50 0 6 unless length $dst_abs > 1
61 6 3 if $attrs{'_dst'}->can("tmp")
68 1 17 if (defined $attrs{$_} and not &isa_userdb($attrs{$_}))
74 2 7 $abs_src eq '/' ? :
85 27 0 unless my $r = delete $self->{$method}
98 23 0 $self->{'_dst'}->can('dst_abs') ? :
107 9 160 if (@_ > 1)
108 0 9 unless builtin::blessed($_[1]) and $_[1]->can("infof")
115 9 1 if @value
120 9 11 if (@value)
123 32 40 unless length $_ and -d $self->src_abs . $_
145 0 0 unless ($cmd =~ m[/]u or -x $src_abs . $cmd)
152 0 0 if (not $pid) { }
154 0 0 if ($src_abs ne "/")
167 0 0 if (length $err)
181 2 1 !keys(%$rw) ? :
197 1 0 unless eval { do { $self->{'_trace_deps'} //= $self->_build__trace_deps } }
213 0 8 if $self->{'_delayed_apply_stat'}
218 0 0 if @value
223 0 31 if ($self->log->is_info)
227 0 0 if @$widths > 10
241 0 2 if $orig =~ m[^[.]+/]u or $new =~ m[^[.]+/]u
244 0 2 if exists $rw->{$orig} and $rw->{$orig} ne $new
251 9 7 if $self->{'path_rewrite_map'}
262 31 64 $root eq '/' ? :
269 32 187 unless my(undef, undef, $mode) = lstat $abs
271 2 185 if ($part eq '..') { }
27 158 elsif (S_ISLNK($mode)) { }
273 2 0 if @abs > @base
276 0 27 if --$lim <= 0
277 0 27 unless defined(my $newpath = readlink $abs)
278 16 11 if $newpath =~ m[^/]u
286 46 17 if $abs ne $path
297 9 17 unless @path > 1
299 17 0 defined $parent ? :
305 0 0 if $self->{'_user_rewrite_map'}{$src}
307 0 0 unless (&isa_int($dst))
309 0 0 unless my $u = $dst_userdb->user($dst)
313 0 0 unless (&isa_int($src))
316 0 0 unless my $u = $src_userdb->user($src)
326 0 0 if $self->{'_group_rewrite_map'}{$src}
328 0 0 unless (&isa_int($dst))
330 0 0 unless my $g = $dst_userdb->group($dst)
334 0 0 unless (&isa_int($src))
337 0 0 unless my $g = $src_userdb->group($src)
349 0 0 if -f $self->src_abs . 'etc/passwd'
360 0 1 if defined $self->_dst->can("dst_abs") and -f $self->_dst->dst_abs . 'etc/passwd'
372 5 20 if (ref $self->{'add'})
382 13 30 if (&isa_hash($next)) { }
9 21 elsif (&isa_array($next)) { }
389 0 0 defined $file{'src_path'} ? :
0 0 defined $file{'name'} ? :
0 43 if $self->log->is_debug
395 27 16 if defined $file{'src_path'}
397 21 22 unless (defined $file{'name'} and defined $file{'mode'})
399 0 0 !defined($file{'mode'}) ? :
0 21 unless defined $src_path
401 1 20 if (exists $self->{'src_path_set'}{$src_path} and not defined $file{'name'})
406 0 20 if (not defined $real_src_path) { }
6 14 elsif ($real_src_path ne $src_path) { }
411 2 4 if (exists $self->{'src_path_set'}{$real_src_path})
418 18 0 unless (defined $file{'mode'})
420 0 18 unless @stat{"dev", "ino", "mode", "nlink", "uid", "gid", "rdev", "size", "atime", "mtime", "ctime"} = lstat $self->{'src_abs'} . $real_src_path
425 18 0 if (defined $file{'uid'} or defined $file{'gid'})
428 0 18 if $self->{'_user_rewrite_map'} or $self->{'_group_rewrite_map'}
434 4 14 if $real_src_path ne $src_path
438 0 6 if not defined $file{'data'} || defined $file{'data_path'} and defined $file{'real_src_path'} and -e $self->{'src_abs'} . $file{'real_src_path'}
441 1 39 if (defined $file{'user'} and not defined $file{'uid'})
447 32 8 if defined $file{'uid'}
449 1 39 if (defined $file{'group'} and not defined $file{'gid'})
455 31 9 if defined $file{'gid'}
458 0 40 if (exists $self->{'dst_path_set'}{$file{'name'}}) { }
461 0 0 unless ($self->_dst->can("dst_abs"))
463 0 0 if ref $action eq "CODE"
465 0 0 if ($action eq "ignore_if_same")
466 0 0 ($file{'src_path'} // '') eq $orig ? :
468 0 0 if ($action eq 'ignore') { }
0 0 elsif ($action eq 'overwrite') { }
0 0 elsif ($action eq 'croak') { }
475 0 0 length $orig ? :
484 9 31 if (length $dst_parent and not exists $self->{'dst_path_set'}{$dst_parent})
487 0 9 if ($self->_dst->can('dst_abs') and -d $self->_dst->dst_abs . $dst_parent) { }
495 3 6 !defined($file{'src_path'}) ? :
497 3 6 if (not $self->_has_rewrites) { }
4 2 elsif (not length $src_parent or $self->get_dst_for_src($src_parent) ne $dst_parent) { }
507 1 3 if (@dir{'dev', 'ino', 'mode', 'nlink', 'uid', 'gid', 'rdev', 'size', 'atime', 'mtime', 'ctime'} = lstat $self->{'src_abs'} . $dst_parent and S_ISDIR($dir{'mode'})) { }
526 14 17 if (S_ISREG($mode)) { }
10 7 elsif (S_ISDIR($mode)) { }
5 2 elsif (S_ISLNK($mode)) { }
1 1 elsif (S_ISBLK($mode) or S_ISCHR($mode)) { }
0 1 elsif (S_ISFIFO($mode)) { }
1 0 elsif (S_ISSOCK($mode)) { }
0 0 elsif (S_ISWHT($mode)) { }
541 7 2 unless ref $_[0] eq "Regexp"
545 1 4 if (isa_filter $paths[0]) { }
3 1 elsif (isa_filter $paths[-1]) { }
552 2 3 if (ref $filter eq "Regexp")
559 0 55 if $seen{$_}++
560 55 0 if (@file{'dev', 'ino', 'mode', 'nlink', 'uid', 'gid', 'rdev', 'size', 'atime', 'mtime', 'ctime'} = lstat $_) { }
562 33 19 if length $_[0] and !defined($filter) || &$filter(\%file)
563 13 42 if ($is_dir and not delete $file{'prune'})
564 13 0 if (opendir my $dh, $src_abs . $_[0]) { }
565 10 3 length $_[0] ? :
574 1 4 unless @paths
581 13 76 if (not defined $ent) { }
50 39 elsif ($ent ne '.' and $ent ne '..') { }
595 0 1 if $name =~ m[/]u
597 1 0 if -x $self->src_abs . "$_/$name"
606 22 0 if &isa_hash($path)
624 8 14 if $path ne $rewrote
635 0 0 if ($dst_userdb or $self->{'_user_rewrite_map'} or $self->{'_group_rewrite_map'})
638 0 0 if ($dst_userdb and not defined $dst_uid)
640 0 0 unless my $src_user = $src_userdb->user($uid)
643 0 0 unless (defined $dst_uid)
644 0 0 unless my $dst_user = $dst_userdb->user($src_user->name)
652 0 0 if ($dst_userdb and not defined $dst_gid)
654 0 0 unless my $src_group = $src_userdb->group($gid)
657 0 0 unless (defined $dst_gid)
658 0 0 unless my $dst_group = $dst_userdb->group($src_group->name)
674 1 0 if ($file->{'nlink'} > 1 and $file->{'dev'} and $file->{'ino'})
675 0 1 if (defined($prev = $self->_link_map->{"$file->{'dev'}:$file->{'ino'}"})) { }
687 14 0 unless (defined $prev)
689 6 8 if (defined $file->{'data_path'}) { }
8 0 elsif (not ref $file->{'data'}) { }
693 0 8 unless defined $file->{'data'}
698 6 8 if length $file->{'src_path'}
707 0 6 if (substr(${$file->{'data'};}, 0, 4) eq "\177ELF") { }
1 5 elsif (${$file->{'data'};} =~ m[^#!\s*/(\S+)]u) { }
720 0 0 if length $path
721 0 0 if (-e $self->{'src_abs'} . $path . $libname)
734 0 0 if ($elf->{'dynamic'})
736 0 0 if ($elf->{'needed_libraries'})
739 0 0 if $lib
743 0 0 if (length $elf->{'interpreter'})
752 0 0 if ($self->_has_rewrites and length $file->{'src_path'} and defined $interpreter)
755 0 0 if (grep /^$rre/u, $interpreter, @libs) { }
773 0 0 if length $rpath
786 0 1 unless my($interp) = ${$file->{'data'};} =~ m[^#!\s*/(\S+)]u
789 1 0 if ($self->_has_rewrites)
793 1 0 if ($dst_interp =~ s/^$rre/$self->{'path_rewrite_map'}{$1};/eu)
800 0 1 if ($interp =~ m[^(usr/)?bin/env\z]u)
801 0 0 unless my($name) = ${$file->{'data'};} =~ m[^#!\s*/\S+\s*(\S+)]u
803 0 0 if (defined(my $path = $self->src_which($name))) { }
813 0 1 if ($interp =~ m[/perl[0-9.]*\z]u) { }
1 0 elsif ($interp =~ m[/(bash|ash|dash|sh)\z]u) { }
0 0 elsif ($self->_has_rewrites and ${$file->{'data'};} =~ $self->path_rewrite_regex) { }
828 1 0 if ($self->_has_rewrites)
831 1 0 if (${$file->{'data'};} =~ /$rre/u)
848 0 0 if ($self->_can_trace_deps and length $file->{'src_path'})
851 0 0 if ($file->{'src_path'} =~ /.pm\z/u)
852 0 0 if (${$file->{'data'};} =~ /^(package|class) (\S+)/mu)
854 0 0 if (substr($file->{'src_path'} // "", -length($path)) eq $path)
862 0 0 if defined $deps
872 0 0 if ($self->_has_rewrites and ${$file->{'data'};} =~ $self->path_rewrite_regex)
884 5 0 unless (defined $file->{'data'})
886 0 5 unless length $file->{'data_path'}
887 0 5 unless defined(my $target = readlink $file->{'data_path'})
893 0 5 if (not $target =~ m[^/]u and substr($file->{'data_path'}, 0, length $self->{'src_abs'}) ne $self->{'src_abs'}) { }
899 2 3 unless $target =~ m[^/]u
903 4 1 if (defined $abs_target and lstat $self->{'src_abs'} . $abs_target) { }
912 1 4 if ($self->_has_rewrites and length $file->{'src_path'})
914 0 1 if ($file->{'data'} =~ m[^/]u) { }
970 1 0 if (defined $file->{'rdev'} and not defined $file->{'rdev_major'} && defined $file->{'rdev_minor'})
975 0 1 S_ISBLK($file->{'mode'}) ? :
998 0 5 if ($ofs + $wrote != length $$content_ref)
999 0 0 if ($wrote > 0) { }
0 0 elsif ($!{'EAGAIN'} or $!{'EINTR'}) { }
1003 0 5 unless $tmp->close
1012 2 0 $^O eq 'linux' ? :
0 2 S_ISBLK($mode) ? :
1014 0 2 unless system(@args) == 0
1040 0 0 unless my $pid = IPC::Open3::open3(undef, my $out_fh, my $err_fh = &Symbol::gensym(), @_)
1053 0 0 unless ($patchelf)
1055 0 0 unless $patchelf
1059 0 0 unless $wstat == 0