unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
To: 28639@debbugs.gnu.org
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	[thread overview]
Message-ID: <wl7ewiywyj.wl%mituharu@math.s.chiba-u.ac.jp> (raw)

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))





             reply	other threads:[~2017-09-29  4:01 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-29  4:01 YAMAMOTO Mitsuharu [this message]
2017-09-29 17:11 ` bug#28639: 26.0.60; get-free-disk-space gives wrong number on OS X 10.8 and later Eli Zaretskii
2017-09-29 19:38   ` Paul Eggert
2017-09-29 20:11     ` Eli Zaretskii
2017-10-02  5:50       ` Paul Eggert
2017-10-02  8:34         ` Michael Albinus
2017-10-02 15:57           ` Paul Eggert
2017-10-02 16:11             ` Michael Albinus
2017-10-02 16:40               ` Eli Zaretskii
2017-10-03 14:18                 ` Michael Albinus
2017-10-02 16:03           ` Eli Zaretskii
2017-10-02 15:57         ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=wl7ewiywyj.wl%mituharu@math.s.chiba-u.ac.jp \
    --to=mituharu@math.s.chiba-u.ac.jp \
    --cc=28639@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).