Branch Coverage

blib/lib/Sys/Export/Unix.pm
Criterion Covered Total %
branch 185 388 47.6


line true false branch
26 13 0 !(@_ & 1) ? :
0 13 @_ == 1 && &isa_hash($_[0]) ? :
30 0 13 unless defined $attrs{'src'}
32 9 4 unless $attrs{'src'} =~ m[/\z]u
34 0 13 unless my $src_abs = abs_path($attrs{'src'})
35 10 3 unless $src_abs =~ m[/\z]u
38 0 13 unless defined $attrs{'dst'}
39 6 7 if (&isa_export_dst($attrs{'dst'})) { }
0 7 elsif (&isa_array($attrs{'dst'})) { }
44 0 0 if (uc $type eq 'CPIO') { }
51 0 7 unless my $dst_abs = abs_path($attrs{'dst'} =~ s[(?<=[^/])$][/]ru)
53 0 7 unless length $dst_abs > 1
64 7 6 if $attrs{'_dst'}->can("tmp")
71 1 25 if (defined $attrs{$_} and not &isa_userdb($attrs{$_}))
81 13 26 if exists $self->{$method}
85 39 0 unless my $r = delete $self->{$method}
98 23 0 $self->{'_dst'}->can('dst_abs') ? :
107 13 131 if (@_ > 1)
108 0 13 unless builtin::blessed($_[1]) and $_[1]->can("infof")
117 25 23 if (defined $abs and -d $self->src_abs . $abs) { }
120 6 17 if $warn
130 0 0 ref $value[0] eq 'ARRAY' ? :
0 2 if @value
137 0 4 if (@value)
146 1 1 if $self->src_abs eq "/"
156 0 0 ref $value[0] eq 'ARRAY' ? :
0 0 if @value
163 0 3 if (@value)
189 0 0 unless ($cmd =~ m[/]u or -x $src_abs . $cmd)
196 0 0 if (not $pid) { }
198 0 0 if ($src_abs ne "/")
211 0 0 if (length $err)
225 2 1 !keys(%$rw) ? :
241 1 0 unless eval { do { $self->{'_trace_deps'} //= $self->_build__trace_deps } }
257 0 12 if $self->{'_delayed_apply_stat'}
262 0 0 if @value
267 0 31 if ($self->log->is_info)
271 0 0 if @$widths > 10
285 0 2 if $orig =~ m[^[.]+/]u or $new =~ m[^[.]+/]u
288 0 2 if exists $rw->{$orig} and $rw->{$orig} ne $new
295 9 7 if $self->{'path_rewrite_map'}
306 9 65 $root eq '/' ? :
313 23 162 unless my(undef, undef, $mode) = lstat $abs
315 2 160 if ($part eq '..') { }
15 145 elsif (S_ISLNK($mode)) { }
317 2 0 if @abs > @base
320 0 15 if --$lim <= 0
321 0 15 unless defined(my $newpath = readlink $abs)
322 11 4 if $newpath =~ m[^/]u
330 11 40 if $abs ne $path
345 9 17 unless @path > 1
347 17 0 defined $parent ? :
353 0 0 if $self->{'_user_rewrite_map'}{$src}
355 0 0 unless (&isa_int($dst))
357 0 0 unless my $u = $dst_userdb->user($dst)
361 0 0 unless (&isa_int($src))
364 0 0 unless my $u = $src_userdb->user($src)
374 0 0 if $self->{'_group_rewrite_map'}{$src}
376 0 0 unless (&isa_int($dst))
378 0 0 unless my $g = $dst_userdb->group($dst)
382 0 0 unless (&isa_int($src))
385 0 0 unless my $g = $src_userdb->group($src)
397 0 0 if -f $self->src_abs . 'etc/passwd'
408 0 1 if defined $self->_dst->can("dst_abs") and -f $self->_dst->dst_abs . 'etc/passwd'
420 5 20 if (ref $self->{'add'})
430 13 30 if (&isa_hash($next)) { }
9 21 elsif (&isa_array($next)) { }
437 0 0 defined $file{'src_path'} ? :
0 0 defined $file{'name'} ? :
0 43 if $self->log->is_debug
443 27 16 if defined $file{'src_path'}
445 21 22 unless (defined $file{'name'} and defined $file{'mode'})
447 0 0 !defined($file{'mode'}) ? :
0 21 unless defined $src_path
449 1 20 if (exists $self->{'src_path_set'}{$src_path} and not defined $file{'name'})
454 0 20 if (not defined $real_src_path) { }
6 14 elsif ($real_src_path ne $src_path) { }
459 2 4 if (exists $self->{'src_path_set'}{$real_src_path})
466 18 0 unless (defined $file{'mode'})
468 0 18 unless @stat{"dev", "ino", "mode", "nlink", "uid", "gid", "rdev", "size", "atime", "mtime", "ctime"} = lstat $self->{'src_abs'} . $real_src_path
473 18 0 if (defined $file{'uid'} or defined $file{'gid'})
476 0 18 if $self->{'_user_rewrite_map'} or $self->{'_group_rewrite_map'}
482 4 14 if $real_src_path ne $src_path
486 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'}
489 1 39 if (defined $file{'user'} and not defined $file{'uid'})
495 32 8 if defined $file{'uid'}
497 1 39 if (defined $file{'group'} and not defined $file{'gid'})
503 31 9 if defined $file{'gid'}
506 0 40 if (exists $self->{'dst_path_set'}{$file{'name'}}) { }
509 0 0 unless ($self->_dst->can("dst_abs"))
511 0 0 if ref $action eq "CODE"
513 0 0 if ($action eq "ignore_if_same")
514 0 0 ($file{'src_path'} // '') eq $orig ? :
516 0 0 if ($action eq 'ignore') { }
0 0 elsif ($action eq 'overwrite') { }
0 0 elsif ($action eq 'croak') { }
523 0 0 length $orig ? :
532 9 31 if (length $dst_parent and not exists $self->{'dst_path_set'}{$dst_parent})
535 0 9 if ($self->_dst->can('dst_abs') and -d $self->_dst->dst_abs . $dst_parent) { }
543 3 6 !defined($file{'src_path'}) ? :
545 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) { }
555 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'})) { }
574 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)) { }
600 7 2 unless ref $_[0] eq "Regexp"
604 1 4 if (isa_filter $paths[0]) { }
3 1 elsif (isa_filter $paths[-1]) { }
611 2 3 if (ref $filter eq "Regexp")
618 0 56 if $seen{$_}++
619 56 0 if (@file{'dev', 'ino', 'mode', 'nlink', 'uid', 'gid', 'rdev', 'size', 'atime', 'mtime', 'ctime'} = lstat $_) { }
621 34 19 if length $_[0] and !defined($filter) || &$filter(\%file)
622 13 43 if ($is_dir and not delete $file{'prune'})
623 13 0 if (opendir my $dh, $src_abs . $_[0]) { }
624 10 3 length $_[0] ? :
633 1 4 unless @paths
640 13 77 if (not defined $ent) { }
51 39 elsif ($ent ne '.' and $ent ne '..') { }
654 0 2 if $name =~ m[/]u
656 2 5 if -x $self->src_abs . "$_/$name"
665 23 0 if &isa_hash($path)
683 8 14 if $path ne $rewrote
694 0 0 if ($dst_userdb or $self->{'_user_rewrite_map'} or $self->{'_group_rewrite_map'})
697 0 0 if ($dst_userdb and not defined $dst_uid)
699 0 0 unless my $src_user = $src_userdb->user($uid)
702 0 0 unless (defined $dst_uid)
703 0 0 unless my $dst_user = $dst_userdb->user($src_user->name)
711 0 0 if ($dst_userdb and not defined $dst_gid)
713 0 0 unless my $src_group = $src_userdb->group($gid)
716 0 0 unless (defined $dst_gid)
717 0 0 unless my $dst_group = $dst_userdb->group($src_group->name)
733 1 0 if ($file->{'nlink'} > 1 and $file->{'dev'} and $file->{'ino'})
734 0 1 if (defined($prev = $self->_link_map->{"$file->{'dev'}:$file->{'ino'}"})) { }
746 14 0 unless (defined $prev)
748 6 8 if (defined $file->{'data_path'}) { }
8 0 elsif (not ref $file->{'data'}) { }
752 0 8 unless defined $file->{'data'}
757 6 8 if length $file->{'src_path'}
766 0 6 if (substr(${$file->{'data'};}, 0, 4) eq "\177ELF") { }
1 5 elsif (${$file->{'data'};} =~ m[^#!\s*/(\S+)]u) { }
779 0 0 if length $path
780 0 0 if (-e $self->{'src_abs'} . $path . $libname)
793 0 0 if ($elf->{'dynamic'})
795 0 0 if ($elf->{'needed_libraries'})
798 0 0 if $lib
802 0 0 if (length $elf->{'interpreter'})
810 0 0 if ($self->_has_rewrites and defined $interpreter || @libs)
814 0 0 if (defined $interpreter and $interpreter =~ /^$rre/u)
819 0 0 if (grep /^$rre/u, @libs)
826 0 0 if (keys %rpath)
830 0 0 if (@patchelf) { }
849 0 1 unless my($interp) = ${$file->{'data'};} =~ m[^#!\s*/(\S+)]u
852 1 0 if ($self->_has_rewrites)
856 1 0 if ($dst_interp =~ s/^$rre/$self->{'path_rewrite_map'}{$1};/eu)
863 0 1 if ($interp =~ m[^(usr/)?bin/env\z]u)
864 0 0 unless my($name) = ${$file->{'data'};} =~ m[^#!\s*/\S+\s*(\S+)]u
866 0 0 if (defined(my $path = $self->src_which($name))) { }
876 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) { }
891 1 0 if ($self->_has_rewrites)
894 1 0 if (${$file->{'data'};} =~ /$rre/u)
911 0 0 if ($self->_can_trace_deps and length $file->{'src_path'})
914 0 0 if ($file->{'src_path'} =~ /.pm\z/u)
915 0 0 if (${$file->{'data'};} =~ /^(package|class) (\S+)/mu)
917 0 0 if (substr($file->{'src_path'} // "", -length($path)) eq $path)
925 0 0 if defined $deps
935 0 0 if ($self->_has_rewrites and ${$file->{'data'};} =~ $self->path_rewrite_regex)
947 5 0 unless (defined $file->{'data'})
949 0 5 unless length $file->{'data_path'}
950 0 5 unless defined(my $target = readlink $file->{'data_path'})
956 0 5 if (not $target =~ m[^/]u and substr($file->{'data_path'}, 0, length $self->{'src_abs'}) ne $self->{'src_abs'}) { }
962 2 3 unless $target =~ m[^/]u
966 4 1 if (defined $abs_target and lstat $self->{'src_abs'} . $abs_target) { }
975 1 4 if ($self->_has_rewrites and length $file->{'src_path'})
977 0 1 if ($file->{'data'} =~ m[^/]u) { }
1033 1 0 if (defined $file->{'rdev'} and not defined $file->{'rdev_major'} && defined $file->{'rdev_minor'})
1038 0 1 S_ISBLK($file->{'mode'}) ? :
1061 0 5 if ($ofs + $wrote != length $$content_ref)
1062 0 0 if ($wrote > 0) { }
0 0 elsif ($!{'EAGAIN'} or $!{'EINTR'}) { }
1066 0 5 unless $tmp->close
1075 2 0 $^O eq 'linux' ? :
0 2 S_ISBLK($mode) ? :
1077 0 2 unless system(@args) == 0
1103 0 0 unless my $pid = IPC::Open3::open3(undef, my $out_fh, my $err_fh = &Symbol::gensym(), @_)
1116 0 0 unless ($patchelf)
1118 0 0 unless $patchelf
1122 0 0 unless $wstat == 0