[Freeipa-users] [work-around] sss_ssh_knownhostsproxy problem with sparkleshare due to setlocale()

Alexander Bokovoy abokovoy at redhat.com
Fri Sep 11 08:17:38 UTC 2015


On Fri, 11 Sep 2015, Karl Forner wrote:
>Hi,
>
>I kind of fixed my problem, but I share it there in case it can help others.
>
>I had problems with sparkleshare on my freeIPA-enrolled workstation, e.g. I
>got
>error messages like this:
>
>19:04:52 | Cmd | QB_resources | git ls-remote --heads --exit-code
>"ssh://xxxl@yyyy/secure/sparkleshare/resources" master
>19:04:52 | Git | projects | (Wed Sep  9 19:04:52:432246 2015)
>[/usr/bin/sss_ssh_knownhostsproxy] [main] (0x0020): set_locale() failed
>(5): Input/output error
>
>I went to see the source code of sss_ssh_knownhostsproxy, and it seems that
>the problem comes from these lines:
>   c = setlocale(LC_ALL, "");
>    if (c == NULL) {
>        return EIO;
>    }
>
>According to "man setlocale()", this is perfectly good:
>
>>        On startup of the main program, the portable "C" locale is
>selected as default.  A program may be made portable to all locales by
>calling:
>>           setlocale(LC_ALL, "");
> and
>> For glibc, first (regardless of
> >      category), the environment variable LC_ALL is inspected, next the
>environment variable with the same name as the  category  (LC_COLLATE,
>LC_CTYPE,  LC_MESSAGES,  LC_MONETARY,  LC_NUMERIC,
> >      LC_TIME) and finally the environment variable LANG.  The first
>existing environment variable is used.  If its value is not a valid locale
>specification, the locale is unchanged, and setlo‐
> >      cale() returns NULL.
>
>In my case, apparently setlocate() returns NULL. I could not reproduce this
>setlocale() call by myself, event trying to use the environment of the
>sparkleshare process (which by the way is a mono program).
>
>But I noticed that running sparkleshare as followed fixed the problem:
>   LC_ALL="en_US.UTF-8" mono "/usr/lib/sparkleshare/SparkleShare.exe"
>
>So I just edited my /etc/default/locale to permanently fix my problem.
>Nonetheless, I'd be curious the understand why the setlocale() call fails
>when sss_ssh_knownhostsproxy is called via git via sparkleshare (via mono).
Thanks for the report. Could you please file a bug against sssd to have
this fixed?

There are multiple cases when your own locale is different from the
remote environment and in cloud images you might not even have
additional locale information available, so when SSH is configured to
pass LC_* variables (like in Fedora or RHEL), they are forced in the
remote shell and the setlocale() result is often NULL. I'm stumbling
with this all the time.
-- 
/ Alexander Bokovoy




More information about the Freeipa-users mailing list