[Tilesathome] Windows Client on dual core / windows ", " problem

Ed Loach ed at loach.me.uk
Tue Oct 7 16:24:56 BST 2008


> I can't reproduce the issue on Linux and nobody on Windows has
> figured
> it out neither.
> 
> Patches welcome ...

OK. I get the problem on my German copy of XP Pro, and am trawling
through the code. The displaying the first request with .s and the
second with ,s is more of a symptom though. The requests arrive as
X, Y, Z and the N/S/E/W coordinates are only calculated a few lines
before the request detail is displayed. The problem must be to do
with switching locales and not switching back to what was there
before, I'm guessing.

So, sometime between the first request is displayed and the second,
something changes. I've seen references to locale before, so
searched the code for that.

Tileset.pm, downloadData contains:
    # temporarily turn off locales
    no locale;
    my $bbox = sprintf("%f,%f,%f,%f",
      $W1, $S1, $E1, $N1);
    use locale;
which looks to me like it turns off locales and then back on (based
on the comment)

Tilesgen.pl AddBounds contains:
    no locale;                # use dot as separator even for
Germans!
But doesn't restore the locale lower down in that method. Could this
be the issue?

Otherwise it is down to the code to do with inkscape:
        my $locale = $Config->get("InkscapeLocale");
        my $oldLocale;
        if ($locale ne "0") {
                $oldLocale=setlocale(LC_ALL, $locale);
        } 

        $Cmd = sprintf("%s%s \"%s\" -z -w %d -h %d
--export-area=%f:%f:%f:%f --export-png=\"%s\" \"%s\" > %s", 
        $Config->get("i18n") ? "LC_ALL=C " : "",
        $Config->get("Niceness"),
        $Config->get("Inkscape"),
        $SizeX,
        $SizeY,
        $Left,$Y1,$Right,$Y2,
        $FullSplitPngFile,
        $svgFile,
        $stdOut);

        if ($locale ne "0") {
                setlocale(LC_ALL, $oldLocale);
        }
Where it looks like the Windows Tiles At home client sets
InkscapeLocale to InkscapeLocale = german in TilesAtHome.conf (and
i18n=0).

In this Inkscape code, is the idea that it formats the $Cmd string
using a specific locale? As I've said, I'm not fluent in Perl, but
how I read it the code above gets "german" from the config, sets
oldLocale to German, builds $Cmd, then sets the locale to german
after the $Cmd has been built. I would have thought we would have
wanted something more like:
        my $locale = $Config->get("InkscapeLocale");
        my $oldLocale=setlocale(LC_CTYPE);
        if ($locale ne "0") {
                setlocale(LC_ALL, $locale);
        }
before, and then the bit afterwards would restore the locale to what
it was before, wouldn't it? (Example based on code at
http://www.xav.com/perl/lib/Pod/perllocale.html )

I have debug switched on (I think), and get messages like this in
the console which seem to be inkscape related (forgive strange
wordwrap):

[#1   0% tile] Rendering...
  "C:\Programme\TilesAtHome\inkscape\inkscape.exe" -z -w 256 -h 256
--export-area=0,000000:0,000000:878,900000:878,904720
--export-png="C:\Programme\TilesAtHome\tmp\12_2035_1352_QdfMt\split-
z12-1352.png"
"C:\Programme\TilesAtHome\tmp\12_2035_1352_QdfMt\output-z12.svg" >
C:\Programme\TilesAtHome\tmp\12_2035_1352_QdfMt\split-z12-1352.stdou
t
[#1   0% tile] Splitting split-z12-1352.png (1 x 1)...
[#1   0% tile]  -> tile_12_2035_1352.png...
Job No. 1 1,0 % done.
[#1   1% tile] Rendering...

Do any of the comments above suggest a possible source to the
problem? If not I might have to do more reading about Perl syntax...

I might try some code tweaks when it finishes the current request
and retest.

Ed






More information about the Tilesathome mailing list