From adf8c6b61c7ac99670ee441c8ddcbfbbbb893920 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Thu, 23 Feb 2023 23:28:27 +0000 Subject: switch to df -Pk in hopes of ignoring BLOCKSIZE etc. settings git-svn-id: svn://tug.org/texlive/trunk@66112 c570f23f-e606-0410-a88d-b1316a301751 --- Master/tlpkg/TeXLive/TLUtils.pm | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) (limited to 'Master/tlpkg/TeXLive/TLUtils.pm') diff --git a/Master/tlpkg/TeXLive/TLUtils.pm b/Master/tlpkg/TeXLive/TLUtils.pm index ab0d5ddc9c5..a03ca61ced6 100644 --- a/Master/tlpkg/TeXLive/TLUtils.pm +++ b/Master/tlpkg/TeXLive/TLUtils.pm @@ -879,20 +879,23 @@ sub diskfree { $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); } } -- cgit v1.2.3