summaryrefslogtreecommitdiff
path: root/Master/tlpkg/TeXLive/TLPDB.pm
diff options
context:
space:
mode:
authorNorbert Preining <preining@logic.at>2023-09-15 13:11:11 +0000
committerNorbert Preining <preining@logic.at>2023-09-15 13:11:11 +0000
commit918dc82333976a755c079a3e7e092613f73ade18 (patch)
treefe252dd4a9159e5b0b1f3e34f19eb8e74e9ab68e /Master/tlpkg/TeXLive/TLPDB.pm
parent6701ce2c59ac18347d73a7252042ae9ba58ab082 (diff)
tlmgr: on update test that we can remove files (deal with ro dirs)
git-svn-id: svn://tug.org/texlive/trunk@68283 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/tlpkg/TeXLive/TLPDB.pm')
-rw-r--r--Master/tlpkg/TeXLive/TLPDB.pm23
1 files changed, 18 insertions, 5 deletions
diff --git a/Master/tlpkg/TeXLive/TLPDB.pm b/Master/tlpkg/TeXLive/TLPDB.pm
index 1c02039e4ab..3d72e4c2b71 100644
--- a/Master/tlpkg/TeXLive/TLPDB.pm
+++ b/Master/tlpkg/TeXLive/TLPDB.pm
@@ -2107,14 +2107,27 @@ sub remove_package {
0, # tlpdbopt_desktop_integration, desktop part
$localtlpdb->option("post_code"));
}
- #
- my @removals = &TeXLive::TLUtils::removed_dirs (@goodfiles);
+ # we want to check whether we can actually remove files
+ # there might be various reasons that this fails, like texmf-dist
+ # directory suddently becoming ro (for whatever definition of
+ # suddenly).
+ my (%by_dirs, %removed_dirs) = &TeXLive::TLUtils::all_dirs_and_removed_dirs (@goodfiles);
+ my @removals = keys %removed_dirs;
+
+ # we have already check for the existence of the dirs returned
+ for my $d (keys %by_dirs) {
+ if (! &TeXLive::TLUtils::dir_writable($d)) {
+ tlwarn("TLPDB: directories are not writable, cannot remove files: $d\n");
+ return 0;
+ }
+ }
+
# now do the removal
for my $entry (@goodfiles) {
- unlink $entry;
+ unlink $entry or tlwarn("Could not unlink $entry: $!\n");
}
for my $d (@removals) {
- rmdir $d;
+ rmdir $d or tlwarn("Could not remove directory $d: $!\n")
}
$localtlpdb->remove_tlpobj($pkg);
TeXLive::TLUtils::announce_execute_actions("disable", $tlp);
@@ -3000,4 +3013,4 @@ GNU General Public License Version 2 or later.
### tab-width: 2
### indent-tabs-mode: nil
### End:
-# vim:set tabstop=2 expandtab autoindent: #
+# vim:set tabstop=2 shiftwidth=2 expandtab autoindent: #