Branch Coverage

blib/lib/Sys/Export/Unix.pm
Criterion Covered Total %
branch 181 376 48.1


line true false branch
25 7 0 !(@_ & 1) ? :
0 7 @_ == 1 && &isa_hash($_[0]) ? :
29 0 7 unless defined $attrs{'src'}
30 0 7 unless my $abs_src = abs_path($attrs{'src'} =~ s[(?<=[^/])$][/]ru)
32 1 6 $abs_src eq '/' ? :
34 0 7 unless defined $attrs{'dst'}
35 2 5 if (&isa_export_dst($attrs{'dst'})) { }
0 5 elsif (&isa_array($attrs{'dst'})) { }
40 0 0 if (uc $type eq 'CPIO') { }
47 0 5 unless my $dst_abs = abs_path($attrs{'dst'} =~ s[(?<=[^/])$][/]ru)
49 0 5 unless length $dst_abs > 1
60 5 2 if $attrs{'_dst'}->can("tmp")
66 1 13 if (defined $attrs{$_} and not &isa_userdb($attrs{$_}))
77 21 0 unless my $r = delete $self->{$method}
90 23 0 $self->{'_dst'}->can('dst_abs') ? :
103 2 1 !keys(%$rw) ? :
117 0 6 if $self->{'_delayed_apply_stat'}
122 0 0 if @value
128 0 0 if (@_ > 1)
148 0 7 if (ref $dest and $dest->can('info')) { }
7 0 elsif (my $i_lev = $LOG_LEVELS{uc $dest}) { }
149 0 0 $dest->is_info ? :
150 0 0 $dest->is_debug ? :
151 0 0 $dest->is_trace ? :
153 7 0 $LOG_LEVELS{'INFO'} <= $i_lev ? :
154 1 6 $LOG_LEVELS{'DEBUG'} <= $i_lev ? :
155 1 6 $LOG_LEVELS{'TRACE'} <= $i_lev ? :
162 31 0 if ($self->{'_log_info'})
166 1 30 if @$widths > 10
180 0 2 if $orig =~ m[^[.]+/]u or $new =~ m[^[.]+/]u
183 0 2 if exists $rw->{$orig} and $rw->{$orig} ne $new
190 9 7 if $self->{'path_rewrite_map'}
201 1 22 $root eq '/' ? :
208 0 69 unless my(undef, undef, $mode) = lstat $abs
210 0 69 if ($part eq '..') { }
13 56 elsif (S_ISLNK($mode)) { }
212 0 0 if @abs > @base
215 0 13 if --$lim <= 0
216 0 13 unless defined(my $newpath = readlink $abs)
217 11 2 if $newpath =~ m[^/]u
226 0 23 if $self->{'log_trace'} and $abs ne $path
236 8 17 unless @path > 1
238 17 0 defined $parent ? :
244 0 0 if $self->{'_user_rewrite_map'}{$src}
246 0 0 unless (&isa_int($dst))
248 0 0 unless my $u = $dst_userdb->user($dst)
252 0 0 unless (&isa_int($src))
255 0 0 unless my $u = $src_userdb->user($src)
265 0 0 if $self->{'_group_rewrite_map'}{$src}
267 0 0 unless (&isa_int($dst))
269 0 0 unless my $g = $dst_userdb->group($dst)
273 0 0 unless (&isa_int($src))
276 0 0 unless my $g = $src_userdb->group($src)
288 0 0 if -f $self->src_abs . 'etc/passwd'
299 0 1 if defined $self->_dst->can("dst_abs") and -f $self->_dst->dst_abs . 'etc/passwd'
311 6 20 if (ref $self->{'add'})
321 13 31 if (&isa_hash($next)) { }
9 22 elsif (&isa_array($next)) { }
329 14 0 defined $file{'src_path'} ? :
2 12 defined $file{'name'} ? :
14 30 if $self->{'_log_debug'}
331 22 22 unless (defined $file{'name'} and defined $file{'mode'})
333 0 0 defined $file{'mode'} ? :
0 22 unless defined $src_path
335 2 20 if (exists $self->{'src_path_set'}{$src_path} and not defined $file{'name'})
336 0 2 if $self->{'_log_debug'}
343 0 20 if (not defined $real_src_path) { }
6 14 elsif ($real_src_path ne $src_path) { }
344 0 0 if $self->{'_log_debug'}
346 5 1 if $self->{'_log_debug'}
348 2 4 if (exists $self->{'src_path_set'}{$real_src_path})
350 2 0 if $self->{'_log_debug'}
355 18 0 unless (defined $file{'mode'})
357 0 18 unless @stat{"dev", "ino", "mode", "nlink", "uid", "gid", "rdev", "size", "atime", "mtime", "ctime"} = lstat $self->{'src_abs'} . $real_src_path
362 18 0 if (defined $file{'uid'} or defined $file{'gid'})
365 0 18 if $self->{'_user_rewrite_map'} or $self->{'_group_rewrite_map'}
371 4 14 if $real_src_path ne $src_path
375 1 39 if (defined $file{'user'} and not defined $file{'uid'})
381 32 8 if defined $file{'uid'}
383 1 39 if (defined $file{'group'} and not defined $file{'gid'})
389 31 9 if defined $file{'gid'}
392 0 40 if (exists $self->{'dst_path_set'}{$file{'name'}}) { }
395 0 0 unless ($self->_dst->can("dst_abs"))
397 0 0 if ref $action eq "CODE"
399 0 0 if ($action eq "ignore_if_same")
400 0 0 ($file{'src_path'} // '') eq $orig ? :
402 0 0 if ($action eq 'ignore') { }
0 0 elsif ($action eq 'overwrite') { }
0 0 elsif ($action eq 'croak') { }
403 0 0 if $self->{'_log_debug'}
406 0 0 if $self->{'_log_debug'}
409 0 0 length $orig ? :
418 9 31 if (length $dst_parent and not exists $self->{'dst_path_set'}{$dst_parent})
419 2 7 if $self->{'_log_debug'}
421 0 9 if ($self->_dst->can('dst_abs') and -d $self->_dst->dst_abs . $dst_parent) { }
422 0 0 if $self->{'_log_debug'}
429 3 6 !defined($file{'src_path'}) ? :
431 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) { }
433 2 1 if $self->{'_log_debug'}
441 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'})) { }
446 0 1 if $self->{'_log_debug'}
450 0 3 if $self->{'_log_debug'}
461 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)) { }
476 7 2 unless ref $_[0] eq "Regexp"
480 1 4 if (isa_filter $paths[0]) { }
3 1 elsif (isa_filter $paths[-1]) { }
487 2 3 if (ref $filter eq "Regexp")
494 0 38 if $seen{$_}++
495 38 0 if (@file{'dev', 'ino', 'mode', 'nlink', 'uid', 'gid', 'rdev', 'size', 'atime', 'mtime', 'ctime'} = lstat $_) { }
497 24 11 if length $_[0] and !defined($filter) || &$filter(\%file)
498 12 26 if ($is_dir and not delete $file{'prune'})
499 12 0 if (opendir my $dh, $src_abs . $_[0]) { }
500 9 3 length $_[0] ? :
509 1 4 unless @paths
516 12 57 if (not defined $ent) { }
33 36 elsif ($ent ne '.' and $ent ne '..') { }
532 13 0 if &isa_hash($path)
551 0 22 if $self->{'_log_trace'} and $path ne $rewrote
561 0 0 if ($dst_userdb or $self->{'_user_rewrite_map'} or $self->{'_group_rewrite_map'})
564 0 0 if ($dst_userdb and not defined $dst_uid)
566 0 0 unless my $src_user = $src_userdb->user($uid)
569 0 0 unless (defined $dst_uid)
570 0 0 unless my $dst_user = $dst_userdb->user($src_user->name)
578 0 0 if ($dst_userdb and not defined $dst_gid)
580 0 0 unless my $src_group = $src_userdb->group($gid)
583 0 0 unless (defined $dst_gid)
584 0 0 unless my $dst_group = $dst_userdb->group($src_group->name)
600 1 13 if ($file->{'nlink'} > 1 and defined $file->{'data_path'})
601 0 1 if (defined($prev = $self->_link_map->{"$file->{'dev'}:$file->{'ino'}"})) { }
603 0 0 if $self->{'_log_debug'}
614 14 0 unless (defined $prev)
616 6 8 unless (defined $file->{'data'})
618 0 6 unless defined $file->{'data_path'}
623 0 14 if (substr($file->{'data'}, 0, 4) eq "\177ELF") { }
2 12 elsif ($file->{'data'} =~ m[^#!\s*/]u) { }
637 0 0 if length $path
638 0 0 if (-e $self->{'src_abs'} . $path . $libname)
639 0 0 if $self->{'_log_trace'}
650 0 0 if ($elf->{'dynamic'})
652 0 0 if $self->{'_log_debug'}
653 0 0 if ($elf->{'needed_libraries'})
656 0 0 if $lib
660 0 0 if (length $elf->{'interpreter'})
667 0 0 if $self->{'_log_debug'}
670 0 0 if ($self->_has_rewrites and length $file->{'src_path'} and defined $interpreter)
673 0 0 if (grep /^$rre/u, $interpreter, @libs) { }
685 0 0 if $self->{'_log_debug'}
691 0 0 if length $rpath
697 0 0 if $self->{'_log_debug'}
704 0 2 unless my($interp) = $file->{'data'} =~ m[^#!\s*/(\S+)]u
708 1 1 if ($self->_has_rewrites and length $file->{'src_path'})
711 1 0 if ($interp =~ s/^$rre/$self->{'path_rewrite_map'}{$1};/eu)
718 1 0 if ($file->{'data'} =~ /$rre/u)
721 1 0 if ($interp =~ m[/(bash|ash|dash|sh)$]u) { }
747 5 0 unless (exists $file->{'data'})
749 0 5 unless exists $file->{'data_path'}
750 0 5 unless defined($file->{'data'} = readlink $file->{'data_path'})
755 0 5 if (not $file->{'data'} =~ m[^/]u and substr($file->{'data_path'}, 0, length $self->{'src_abs'}) ne $self->{'src_abs'}) { }
757 0 0 if $self->{'_log_debug'}
762 3 2 $file->{'data'} =~ m[^/]u ? :
765 4 1 if (defined $abs_target and lstat $self->{'src_abs'} . $abs_target) { }
766 3 1 if $self->{'_log_debug'}
769 1 0 if $self->{'_log_debug'}
774 1 4 if ($self->_has_rewrites and length $file->{'src_path'})
776 0 1 if ($file->{'data'} =~ m[^/]u) { }
832 1 0 if (defined $file->{'rdev'} and not defined $file->{'rdev_major'} && defined $file->{'rdev_minor'})
837 0 1 S_ISBLK($file->{'mode'}) ? :
858 0 6 unless open my $fh, "<:raw", $_[1]
861 0 6 unless sysread($fh, $_[0] //= "", $size) == $size
869 0 5 if ($ofs + $wrote != length $$content_ref)
870 0 0 if ($wrote > 0) { }
0 0 elsif ($!{'EAGAIN'} or $!{'EINTR'}) { }
874 0 5 unless $tmp->close
892 2 0 $^O eq 'linux' ? :
0 2 S_ISBLK($mode) ? :
894 0 2 unless system(@args) == 0
920 0 0 unless my $pid = IPC::Open3::open3(undef, my $out_fh, my $err_fh = &Symbol::gensym(), @_)
932 0 0 if $self->{'_log_trace'}
933 0 0 unless ($patchelf)
935 0 0 unless $patchelf
939 0 0 unless $wstat == 0