in unshare mode, the unshared process might not have enough permissions to rmdir root directory -- try again as normal user
This commit is contained in:
parent
3922851636
commit
7bad5fb1e6
1 changed files with 16 additions and 1 deletions
17
mmdebstrap
17
mmdebstrap
|
@ -4460,7 +4460,14 @@ sub main() {
|
||||||
if ($file eq '') {
|
if ($file eq '') {
|
||||||
warning "general error: $message";
|
warning "general error: $message";
|
||||||
} else {
|
} else {
|
||||||
warning "problem unlinking $file: $message";
|
# the unshared process might not have
|
||||||
|
# sufficient permissions to remove the root
|
||||||
|
# directory. We attempt its removal later, so
|
||||||
|
# don't warn if its removal fails now.
|
||||||
|
if ($file ne $options->{root}) {
|
||||||
|
warning
|
||||||
|
"problem unlinking $file: $message";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4469,6 +4476,14 @@ sub main() {
|
||||||
);
|
);
|
||||||
waitpid $pid, 0;
|
waitpid $pid, 0;
|
||||||
$? == 0 or error "remove_tree failed";
|
$? == 0 or error "remove_tree failed";
|
||||||
|
# in unshare mode, the toplevel directory might've been created in
|
||||||
|
# a directory that the unshared user cannot change and thus cannot
|
||||||
|
# delete. If the root directory still exists after remove_tree
|
||||||
|
# above, we attempt its removal again outside as the normal user.
|
||||||
|
if (-e $options->{root}) {
|
||||||
|
rmdir "$options->{root}"
|
||||||
|
or error "cannot rmdir $options->{root}: $!";
|
||||||
|
}
|
||||||
} elsif (
|
} elsif (
|
||||||
any { $_ eq $options->{mode} }
|
any { $_ eq $options->{mode} }
|
||||||
('root', 'fakechroot', 'proot', 'chrootless')
|
('root', 'fakechroot', 'proot', 'chrootless')
|
||||||
|
|
Loading…
Reference in a new issue