[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#28639: 26.0.60; get-free-disk-space gives wrong number on OS X 10.8
From: |
YAMAMOTO Mitsuharu |
Subject: |
bug#28639: 26.0.60; get-free-disk-space gives wrong number on OS X 10.8 and later |
Date: |
Fri, 29 Sep 2017 13:01:40 +0900 |
User-agent: |
Wanderlust/2.14.0 (Africa) SEMI/1.14.6 (Maruoka) FLIM/1.14.8 (Shijō) APEL/10.6 Emacs/22.3 (sparc-sun-solaris2.8) MULE/5.0 (SAKAKI) |
The function `get-free-disk-space' in files.el gives free inode count
rather than free data block space on OS X 10.8 and later. This is
because it relies on the "df" command and parse the output as follows:
;; Assume that the "available" column is before the
;; "capacity" column. Find the "%" and scan backward.
(goto-char (point-min))
(forward-line 1)
(when (re-search-forward
"[[:space:]]+[^[:space:]]+%[^%]*$"
(line-end-position) t)
(goto-char (match-beginning 0))
(let ((endpt (point)))
(skip-chars-backward "^[:space:]")
(buffer-substring-no-properties (point) endpt)))))))))
The output on OS X 10.8 looks like this:
Filesystem 512-blocks Used Available Capacity iused ifree %iused
Mounted on
/dev/disk2 1996082176 172984304 1822585872 9% 2508930 4292458349 0%
/
devfs 371 371 0 100% 642 0 100%
/dev
map -hosts 0 0 0 100% 0 0 100%
/net
map auto_home 0 0 0 100% 0 0 100%
/home
So, `get-free-disk-space' adopts the "ifree" column rather than the
"Available" column.
One could use the "-P" option to suppress the inode columns. But this
doesn't seem to be smart (cf. Bug#6995).
Some platforms rely on the primitive function `file-system-info'
instead of the "df" output to get free space. How about implementing
`file-system-info' also for other platforms using the fsusage module
in Gnulib?
YAMAMOTO Mitsuharu
mituharu@math.s.chiba-u.ac.jp
In GNU Emacs 26.0.60 (build 1, x86_64-apple-darwin16.7.0, X toolkit, Xaw3d
scroll bars)
of 2017-09-29 built on YAMAMOTO-no-iMac-5K.local
Repository revision: af130f900fc499f71ea22f10ba055a75ce35ed4e
Windowing system distributor 'The X.Org Foundation', version 11.0.11804000
Recent messages:
Loading /usr/local/pkg/ProofGeneral/generic/proof-site.el (source)...done
For information about GNU Emacs and the GNU system, type C-h C-a.
Configured using:
'configure --without-ns --with-jpeg=no --with-gif=no --with-tiff=no
--with-gnutls=no PKG_CONFIG=/opt/local/bin/pkg-config
PKG_CONFIG_PATH=/usr/lib/pkgconfig:/opt/X11/lib/pkgconfig:/usr/local/lib/pkgconfig
PKG_CONFIG_LIBDIR='
Configured features:
XAW3D XPM PNG NOTIFY ACL LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB
TOOLKIT_SCROLL_BARS LUCID X11
Important settings:
value of $LANG: ja_JP.UTF-8
locale-coding-system: utf-8-unix
Major mode: Fundamental
Minor modes in effect:
TeX-PDF-mode: t
tooltip-mode: t
global-eldoc-mode: t
electric-indent-mode: t
mouse-wheel-mode: t
tool-bar-mode: t
menu-bar-mode: t
file-name-shadow-mode: t
blink-cursor-mode: t
auto-composition-mode: t
auto-encryption-mode: t
auto-compression-mode: t
buffer-read-only: t
line-number-mode: t
transient-mark-mode: t
Load-path shadows:
None found.
Features:
(shadow sort mail-extr emacsbug message subr-x puny dired dired-loaddefs
format-spec rfc822 mml mml-sec epa derived epg gnus-util rmail
rmail-loaddefs mm-decode mm-bodies mm-encode mail-parse rfc2231
mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums
mm-util mail-prsvr mail-utils elec-pair ccc proof-site proof-autoloads
pg-vars finder-inf info package epg-config url-handlers url-parse
auth-source cl-seq eieio eieio-core cl-macs eieio-loaddefs
password-cache url-vars seq byte-opt gv bytecomp byte-compile cconv
preview prv-emacs tex-buf latex easy-mmode edmacro kmacro cl-loaddefs
cl-lib tex-style tex crm advice easymenu tex-site auto-loads time-date
mule-util japan-util tooltip eldoc electric uniquify ediff-hook vc-hooks
lisp-float-type mwheel term/x-win x-win term/common-win x-dnd tool-bar
dnd fontset image regexp-opt fringe tabulated-list replace newcomment
text-mode elisp-mode lisp-mode prog-mode register page menu-bar
rfn-eshadow isearch timer select scroll-bar mouse jit-lock font-lock
syntax facemenu font-core term/tty-colors frame cl-generic cham georgian
utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean
japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european
ethiopic indian cyrillic chinese composite charscript charprop
case-table epa-hook jka-cmpr-hook help simple abbrev obarray minibuffer
cl-preloaded nadvice loaddefs button faces cus-face macroexp files
text-properties overlay sha1 md5 base64 format env code-pages mule
custom widget hashtable-print-readable backquote kqueue dynamic-setting
font-render-setting x-toolkit x multi-tty make-network-process emacs)
Memory information:
((conses 16 156179 7929)
(symbols 48 25864 2)
(miscs 40 82 79)
(strings 32 46730 1878)
(string-bytes 1 1235094)
(vectors 16 20402)
(vector-slots 8 629738 10352)
(floats 8 77 67)
(intervals 56 197 0)
(buffers 992 13))
- bug#28639: 26.0.60; get-free-disk-space gives wrong number on OS X 10.8 and later,
YAMAMOTO Mitsuharu <=