Subject: bug#23812: 25.0.95; Minor glitch in dired listing due to non English host language

From: Lele Gaifax <[email-masked]>
Date: Tue, 21 Jun 2016 10:31:59 +0200

When I enter in a `dired` mode, I see something like the following at the top
of the buffer:

  /home/lele/something:
  total used in directorye 8 available 24407396
  drwxrwxr-x 2 lele lele 4096 giu 21 10:02 .
  drwxr-xr-x 5 lele lele 4096 giu 21 10:02 ..

Note the “directorye” glitch: I think it is caused by the fact that the
function `insert-directory` in lisp/files.el assumes the underlying `ls`
command operates in an English environment, in particular in the first line
where it emits with the disk space usage, and perform a simple replace of
"total" with "total used in directory".

This is what I get with a plain `ls -la`:

  $ ls -la
  totale 8
  drwxrwxr-x 2 lele lele 4096 giu 21 10:02 .
  drwxr-xr-x 5 lele lele 4096 giu 21 10:02 ..

while it assumes an output like:

  $ LANG=en ls -la
  total 8
  drwxrwxr-x 2 lele lele 4096 Jun 21 10:02 .
  drwxr-xr-x 5 lele lele 4096 Jun 21 10:02 ..

Given that the function unconditionally inserts an English phrase, the
easiest-but-consistent workaround could be explicitly executing `ls` with
`$LANG` set to "en".

A more elaborated approach could be extracting only the number in the first
line of the `ls` output instead of matching "total": in this way it would
support also languages that swap the order (that is, that translate that line
to something equivalent “8 bytes in total”).

Thank you,
ciao, lele.

In GNU Emacs 25.0.95.2 (x86_64-pc-linux-gnu, GTK+ Version 3.20.6)
 of 2016-06-14 built on nautilus
Repository revision: f5261917191336d052ad8586b2d9fd62ba46c3c4
Windowing system distributor 'The X.Org Foundation', version 11.0.11803000
System Description:	Debian GNU/Linux unstable (sid)

Configured using:
 'configure --prefix /usr/local/emacs25'

Configured features:
XPM JPEG TIFF GIF PNG SOUND DBUS GSETTINGS NOTIFY GNUTLS LIBXML2 FREETYPE XFT
ZLIB TOOLKIT_SCROLL_BARS GTK3 X11

Important settings:
  value of $LANG: it_IT.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Dired by name

-- 
nickname: Lele Gaifax | Quando vivrò di quello che ho pensato ieri
real: Emanuele Gaifas | comincerò ad aver paura di chi mi copia.
[email-masked]  |                 -- Fortunato Depero, 1929.