[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: GNU Parallel Bug Reports --tmux does not pass locale correctly (need
From: |
Matti Niemenmaa |
Subject: |
Re: GNU Parallel Bug Reports --tmux does not pass locale correctly (needed since tmux 2.2) |
Date: |
Sun, 16 Apr 2017 15:39:35 +0300 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.0 |
On 2017-04-16 14:49, Ole Tange wrote:
On Sat, Apr 15, 2017 at 9:04 PM, Matti Niemenmaa
<address@hidden> wrote:
--tmux doesn't work for me at all as of tmux 2.2. The "Maximal used size of
command" is computed incorrectly and so no command can be run:
$ parallel --tmux --show-limits echo ::: x
Maximal size of command: 131049
Maximal used size of command: -16
Yup, it is clearly wrong.
$ LANG= LC_ALL= LC_CTYPE= tmux
tmux: need UTF-8 locale (LC_CTYPE) but have ANSI_X3.4-1968
I compiled 2.3 from source and could not reproduce this.
My guess is that you have the en_US.UTF-8 locale installed, which tmux
will default to. Check the output from 'locale -a': on my system
en_US.utf8 is not listed.
The underlying cause within GNU parallel is that ::qqx is used to call tmux,
and ::qqx strips out locale information from the environment.
Note that everything will seem to work if you have the en_US.UTF-8 locale
available, because tmux will fall back to that in the absence of locale
information. On my system that locale is not installed, which culminates in
the failure.
Adding LC_CTYPE to @keep inside ::qqx fixes the issue.
I am reluctant to copy $LC_CTYPE as I need the output from ::qqx to be
predictable, and locales can change the output.
So I suggest:
@@ -4228,6 +4228,7 @@ sub qqx {
@address@hidden = @address@hidden;
local(%ENV);
%ENV = %env;
+ $ENV{'LC_ALL'} = 'C';
if($Global::debug) {
return qx{ @_ && true };
} else {
Will this work, too?
I'm afraid not. As commented at https://github.com/tmux/tmux/issues/815
"tmux requires either en_US.UTF-8 to be available or a different UTF-8
locale to be specified in LC_ALL." C is not a UTF-8 locale, so this does
not fix the issue.
(And if you can find a virtual machine image on which you can
reproduce the error, please let me know.)
Any system without an en_US.UTF-8 locale should do it. Will a Docker
image do for an example?
# docker pull base/devel # Arch Linux
# docker run -i -t --entrypoint bash base/devel
(Inside the Docker container now:)
# pacman -Syu libevent
<snip>
# curl -LO
https://github.com/tmux/tmux/releases/download/2.3/tmux-2.3.tar.gz
<snip>
# cd tmux-2.3
# ./configure && make
<snip>
# ./tmux
tmux: need UTF-8 locale (LC_CTYPE) but have ANSI_X3.4-1968
And to verify that GNU Parallel fails in these conditions:
# curl -LO http://ftpmirror.gnu.org/parallel/parallel-20170322.tar.bz2
# cd parallel-20170322
# ./configure && make
# PATH=../tmux-2.3:$PATH src/parallel --tmux --show-limits echo ::: x
sh: ps: command not found
Maximal size of command: 131049
Maximal used size of command: -16
<snip rest of output>
— Matti