* bug#19251: 24.4; LANG not applied in shell command
@ 2014-12-02 9:57 Sebastien Vauban
2014-12-02 10:22 ` Ivan Shmakov
[not found] ` <mailman.15132.1417515793.1147.bug-gnu-emacs@gnu.org>
0 siblings, 2 replies; 4+ messages in thread
From: Sebastien Vauban @ 2014-12-02 9:57 UTC (permalink / raw)
To: 19251-ubl+/3LiMTaZdePnXv/OxA
Hello,
I'm trying to automate the update of some Git project with:
--8<---------------cut here---------------start------------->8---
(defun config-update ()
"Update config."
(interactive)
(message "Updating config...")
(cd config--directory)
(let ((ret (shell-command-to-string "LANG=en_US git pull --rebase")))
(if (string-match "Already up-to-date." ret)
(message "Configuration already up-to-date.")
(princ ret)
(message "Configuration updated."))))
--8<---------------cut here---------------end--------------->8---
On my machine (Windows 8 with Cygwin), that works as expected.
On one friend's machine (some Linux variant), whatever the answer of
`git pull' (something new or nothing new), he will always have the
impression that the project has just been updated:
┌────
│ Updating config...
│ La branche courante master est à jour.
│
│ Configuration updated.
└────
This is because my function looks for the string "Already up-to-date" in
Git's output, and his output is in French -- while I forced LANG to
en_US.
So, why is LANG not respected in `shell-command-to-string'?
Best regards,
Seb
--
Sebastien Vauban
^ permalink raw reply [flat|nested] 4+ messages in thread
* bug#19251: 24.4; LANG not applied in shell command
2014-12-02 9:57 bug#19251: 24.4; LANG not applied in shell command Sebastien Vauban
@ 2014-12-02 10:22 ` Ivan Shmakov
[not found] ` <mailman.15132.1417515793.1147.bug-gnu-emacs@gnu.org>
1 sibling, 0 replies; 4+ messages in thread
From: Ivan Shmakov @ 2014-12-02 10:22 UTC (permalink / raw)
To: 19251; +Cc: 19251-submitter
>>>>> Sebastien Vauban writes:
[…]
> This is because my function looks for the string "Already up-to-date"
> in Git's output, and his output is in French – while I forced LANG to
> en_US.
> So, why is LANG not respected in `shell-command-to-string'?
The LC_ALL environment variable takes precedence over LANG (or
any other LC_ variables, for that matter.) Back a decade ago,
I’ve seen RedHat-derived distributions using LC_ALL (instead of
LANG) to set the locale, so that could be the issue.
My suggestion would be to use LC_ALL=C instead of a LANG
override.
BTW, on GNU/Linux, the ‘locale’ command helps troubleshooting
such issues.
--
FSF associate member #7257 http://boycottsystemd.org/ … 3013 B6A0 230E 334A
^ permalink raw reply [flat|nested] 4+ messages in thread
* bug#19251: 24.4; LANG not applied in shell command
[not found] ` <mailman.15132.1417515793.1147.bug-gnu-emacs-mXXj517/zsQ@public.gmane.org>
@ 2014-12-02 12:22 ` Sebastien Vauban
2014-12-02 12:50 ` Ivan Shmakov
0 siblings, 1 reply; 4+ messages in thread
From: Sebastien Vauban @ 2014-12-02 12:22 UTC (permalink / raw)
To: 19251-ubl+/3LiMTaZdePnXv/OxA
Ivan Shmakov wrote:
>> Sebastien Vauban writes:
>
>> This is because my function looks for the string "Already up-to-date"
>> in Git's output, and his output is in French – while I forced LANG to
>> en_US.
>>
>> So, why is LANG not respected in `shell-command-to-string'?
>
> The LC_ALL environment variable takes precedence over LANG (or
> any other LC_ variables, for that matter.) Back a decade ago,
> I’ve seen RedHat-derived distributions using LC_ALL (instead of
> LANG) to set the locale, so that could be the issue.
>
> My suggestion would be to use LC_ALL=C instead of a LANG
> override.
I first tried LC_ALL=en_US. No success.
Your suggestion LC_ALL=C did work. Thanks!
(This can be closed -- and Emacs did the right thing btw)
Best regards,
Seb
--
Sebastien Vauban
^ permalink raw reply [flat|nested] 4+ messages in thread
* bug#19251: 24.4; LANG not applied in shell command
2014-12-02 12:22 ` Sebastien Vauban
@ 2014-12-02 12:50 ` Ivan Shmakov
0 siblings, 0 replies; 4+ messages in thread
From: Ivan Shmakov @ 2014-12-02 12:50 UTC (permalink / raw)
To: 19251-done, control
tags 19251 + notabug
close 19251
thanks
>>>>> Sebastien Vauban writes:
>>>>> Ivan Shmakov wrote:
[…]
>> My suggestion would be to use LC_ALL=C instead of a LANG override.
> I first tried LC_ALL=en_US. No success.
> Your suggestion LC_ALL=C did work. Thanks!
Setting LC_ALL to en_US requests that specific locale, which may
or may not be available on the target system. (E. g., per [1].)
On the contrary, LC_ALL=C effectively requests any localizations
to be disabled.
[1] http://manpages.debian.net/cgi-bin/man.cgi?format=html&manpath=testing&sektion=5&query=locale.gen
> (This can be closed – and Emacs did the right thing btw)
ACK; closing as ‘notabug’.
--
FSF associate member #7257 http://boycottsystemd.org/ … 3013 B6A0 230E 334A
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-12-02 12:50 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-12-02 9:57 bug#19251: 24.4; LANG not applied in shell command Sebastien Vauban
2014-12-02 10:22 ` Ivan Shmakov
[not found] ` <mailman.15132.1417515793.1147.bug-gnu-emacs@gnu.org>
[not found] ` <mailman.15132.1417515793.1147.bug-gnu-emacs-mXXj517/zsQ@public.gmane.org>
2014-12-02 12:22 ` Sebastien Vauban
2014-12-02 12:50 ` Ivan Shmakov
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).