texlive[66112] Master: switch to df -Pk in hopes of ignoring

commits+karl at tug.org commits+karl at tug.org
Fri Feb 24 00:28:27 CET 2023


Revision: 66112
          http://tug.org/svn/texlive?view=revision&revision=66112
Author:   karl
Date:     2023-02-24 00:28:27 +0100 (Fri, 24 Feb 2023)
Log Message:
-----------
switch to df -Pk in hopes of ignoring BLOCKSIZE etc. settings

Modified Paths:
--------------
    trunk/Master/install-tl
    trunk/Master/tlpkg/TeXLive/TLUtils.pm

Modified: trunk/Master/install-tl
===================================================================
--- trunk/Master/install-tl	2023-02-23 23:09:50 UTC (rev 66111)
+++ trunk/Master/install-tl	2023-02-23 23:28:27 UTC (rev 66112)
@@ -1047,7 +1047,9 @@
         tlwarn("$0: Insufficient disk space\n$msg\n"
           ." but continuing anyway per envvar TEXLIVE_INSTALL_NO_DISKCHECK\n");
       } else {
-        tldie("$0: DISK SPACE INSUFFICIENT!\n$msg\nAborting installation.\n");
+        tldie("$0: DISK SPACE INSUFFICIENT!\n$msg\nAborting installation.\n"
+            . "  To skip the check, set the environment variable\n"
+            . "  TEXLIVE_INSTALL_NO_DISKCHECK=1\n");
       }
     }
   }
@@ -3470,7 +3472,7 @@
 =item C<TEXLIVE_INSTALL_NO_DISKCHECK>
 
 If set to 1, omit free disk space check. By default, if a
-POSIX-compliant C<df> program (supporting C<-P>) is available, the
+POSIX-compliant C<df> program (supporting C<-Pk>) is available, the
 installer checks for available disk space in the selected installation
 location, and will abort installation if there is insufficient disk
 space, plus a margin of 100MB. An equivalent check is made on Windows

Modified: trunk/Master/tlpkg/TeXLive/TLUtils.pm
===================================================================
--- trunk/Master/tlpkg/TeXLive/TLUtils.pm	2023-02-23 23:09:50 UTC (rev 66111)
+++ trunk/Master/tlpkg/TeXLive/TLUtils.pm	2023-02-23 23:28:27 UTC (rev 66112)
@@ -879,20 +879,23 @@
   $td .= "/" if ($td !~ m!/$!);
   return (-1) if (! -e $td);
   debug("checking diskfree() in $td\n");
-  ($output, $retval) = run_cmd("df -P \"$td\"", POSIXLY_CORRECT => 1);
+  ($output, $retval) = run_cmd("df -Pk \"$td\"");
+    # With -k (mandated by POSIX), we should always get 1024-blocks.
+    # Otherwise, the POSIXLY_CORRECT envvar for GNU df would need to
+    # be set, to force 512-blocks; and the BLOCKSIZE envvar would need
+    # to be unset to avoid overriding.
   if ($retval == 0) {
     # Output format should be this:
-    # Filesystem      512-blocks       Used  Available Capacity Mounted on
-    # /dev/sdb3       6099908248 3590818104 2406881416      60% /home
+    # Filesystem      1024-blocks     Used Available Capacity Mounted on
+    # /dev/sdb3       209611780 67718736 141893044      33% /
     my ($h,$l) = split(/\n/, $output);
     my ($fs, $nrb, $used, $avail, @rest) = split(' ', $l);
-    debug("diskfree: df -P output: $output");
-    debug("diskfree: used=$used (512-block), avail=$avail (512-block)\n");
-    # $avail is in 512-byte blocks, so we need to divide by 2*1024 to
-    # obtain Mb. Require that at least 100M remain free.
-    return (int($avail / 2048));
+    debug("diskfree: df -Pk output: $output");
+    debug("diskfree: used=$used (1024-block), avail=$avail (1024-block)\n");
+    # $avail is in 1024-byte blocks, so we divide by 1024 to obtain Mb.
+    return (int($avail / 1024));
   } else {
-    # error in running df -P for whatever reason
+    # error in running df -P for whatever reason, just skip the check.
     return (-1);
   }
 }



More information about the tex-live-commits mailing list.