Hi Karl,

currently fmtutil *moves* the .fmt and .log (and .fls) files from the
temporary directory to $TEXMFVAR.

This is all fine in most cases, but when a distribution activated
SELinux, moved files keep the attributes of the creationg directory
(/tmp) and not the special attributes for the target.

Please see https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=900580

While I personally don't use selinux, I understand the need. I first
thought to implement the restorecon call in the Debian specific part,
but this seems to be wrong, since other distributions might face the
same problem.

So what about exchanging 
  File::Copy::move
with
  File::Copy::copy
in fmtutil on installing the generated files. The temp dirs including
their content will be removed anyway.

Please see attached patch

All the best

Norbert

--
PREINING Norbert                               http://www.preining.info
Accelia Inc.     +    JAIST     +    TeX Live     +    Debian Developer
GPG: 0x860CDC13   fp: F7D8 A928 26E3 16A1 9FA0 ACF0 6CAC A448 860C DC13
diff --git a/Master/texmf-dist/scripts/texlive/fmtutil.pl b/Master/texmf-dist/scripts/texlive/fmtutil.pl
index 606eb34f854..f4859441bae 100755
--- a/Master/texmf-dist/scripts/texlive/fmtutil.pl
+++ b/Master/texmf-dist/scripts/texlive/fmtutil.pl
@@ -719,21 +719,21 @@ sub rebuild_one_format {
 
   TeXLive::TLUtils::mkdirhier($destdir);
   
-  if (!File::Copy::move( $logfile, "$destdir/$logfile")) {
-    print_deferred_error("Cannot move $logfile to $destdir.\n");
+  if (!File::Copy::copy( $logfile, "$destdir/$logfile")) {
+    print_deferred_error("Cannot copy $logfile to $destdir.\n");
   }
   if ($opts{'recorder'}) {
     # the recorder output is used by check-fmttriggers to determine
     # package dependencies for each format.  Unfortunately omega-based
     # engines gratuitiously changed the extension from .fls to .ofl.
     my $recfile = $fmt . ($fmt =~ m/^(aleph|lamed)$/ ? ".ofl" : ".fls");
-    if (!File::Copy::move( $recfile, "$destdir/$recfile")) {
-      print_deferred_error("Cannot move $recfile to $destdir.\n");
+    if (!File::Copy::copy( $recfile, "$destdir/$recfile")) {
+      print_deferred_error("Cannot copy $recfile to $destdir.\n");
     }
   }
 
   my $destfile = "$destdir/$fmtfile";
-  if (File::Copy::move( $fmtfile, $destfile )) {
+  if (File::Copy::copy( $fmtfile, $destfile )) {
     print_info("$destfile installed.\n");
     #
     # original fmtutil.sh did some magic trick for mplib-luatex.mem
@@ -780,10 +780,10 @@ sub rebuild_one_format {
     return $FMT_SUCCESS;
 
   } else {
-    print_deferred_error("Cannot move $fmtfile to $destfile.\n");
+    print_deferred_error("Cannot copy $fmtfile to $destfile.\n");
     if (-f $destfile) {
       # remove the empty file possibly left over if near-full file system.
-      print_verbose("Removing partial file after move failure: $destfile\n");
+      print_verbose("Removing partial file after copy failure: $destfile\n");
       unlink($destfile)
         || print_deferred_error("unlink($destfile) failed: $!\n");
     }

Reply via email to