News:

Use the "Forum Search"
It may help you to find anything in the forum ;).

Launchpad Bug #931181 - Ubuntu 11.10 version of 110.0.1 network games

Started by cheesehead, February 19, 2012, 02:28:15 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

cheesehead

Network games using the 110.0.1 version in Ubuntu 11.10 is affected by https://bugs.launchpad.net/ubuntu/+source/simutrans/+bug/931181 . If any Ubuntu 11.10 user could confirm the bug (or tell me what I'm doing wrong), I would be most appreciative.

Quote from: Dwachs
QuoteThe screenshot says that server and client run different version of the pak64 pakset. Paksets must be identical on both server and client.

Thanks for taking a look.
Good catch. First thing I checked, too. Both are r435 and they seem to diff as identical...

Dwachs

Quote from: cheesehead on February 19, 2012, 02:28:15 AM
Good catch. First thing I checked, too. Both are r435 and they seem to diff as identical...
The version text 'r435' is read from one single pak file in the pak/ directory. Although these files match, there are obviously differences in the pakset. Did you try with a fresh install? ie delete everything in pak/ then reinstall? Do you have files in ~/simutrans/pak ?
Parsley, sage, rosemary, and maggikraut.

cheesehead

Great question!

The Debian package installs the pak at /usr/share/games/simutrans/pak
My manual-install is at ~/simutrans110/simutrans/pak
$ deb-dir=/usr/share/games/simutrans
$ deb-pak=/usr/share/games/simutrans/pak
$ manual-pak=~/simutrans110/simutrans/pak



First, I looked for differences
$ diff -ra $deb-pak $manual-pak
(No output). No extra files in one pak.

Next, I took the manual-install pak64 at ~/simutrans110/simutrans/pak ,
and used it to replace the package-install pak64 at /usr/share/games/simutrans/pak
$ sudo mv $deb-pak ${deb-dir}/~pak.orig
$ sudo cp -r $manual-pak ${deb-dir}/
$ sudo chown -R root:root $deb-pak

The debian-packaged binary runs beautifully using the transplanted pak...but has the same pak-mismatch error when connecting to a server running the manual-pak.

I appreciate you running through this with me.
I'd really prefer this problem to be something boneheaded on my part instead of a bug!

Dwachs

I added a comment on the Launchpad website. It seems that the packaged version uses a different implementation of checksums. If checksums of paksets differ, the client is not allowed to join the server.

There is not much you can do. Use the official simutrans releases instead of the package one for network games.

Thanks for reporting. And for trying the stunt with copying the paksets, which gave the hint that there is something wrong with checksums.
Parsley, sage, rosemary, and maggikraut.

cheesehead

I think you're right.
I went back through the logs:

Succesful (Ubuntu 11.10) server:
Message: pakset_info_t::debug: PostOffice -> sha1 = B80C3C262A2758C8FC54FF129272F564B7DA8AAF

Succesful (Ubuntu 11.10) client:
Message: pakset_info_t::debug: PostOffice -> sha1 = B80C3C262A2758C8FC54FF129272F564B7DA8AAF

Failed (Manually-installed) server:
Message: pakset_info_t::debug: PostOffice -> sha1 = 263C0CB8C858272A12FF54FC64F57292AF8ADAB7

Failed (Ubuntu 11.10) client:
Message: pakset_info_t::debug: PostOffice -> sha1 = B80C3C262A2758C8FC54FF129272F564B7DA8AAF


Interesting double-check:
$ openssl sha1 ${manual-pak}/building.PostOffice.pak
SHA1(/home/me/simutrans110/simutrans/pak/building.PostOffice.pak)= 8b1b5caa71013474039f357094cd1716bd3800bd

$ openssl sha1 ${deb-pak}/building.PostOffice.pak
SHA1(/usr/share/games/simutrans/pak/building.PostOffice.pak)= 8b1b5caa71013474039f357094cd1716bd3800bd


So the those pakset items (and, by extension, likely the entire pakset) are identical. But they are indeed checksummed differently in the Debian-package install.



VS

Checksums used by Simutrans are done from only some data of the pak when loaded internally, so you can't replicate them outside the game... How convenient :P

My projects... Tools for messing with Simutrans graphics. Graphic archive - templates and some other stuff for painters. Development logs for most recent information on what is going on. And of course pak128!

Dwachs

On the other hand, you still can join network games with modified pak files, if the modifications do not affect gameplay (like authors name, all the graphics).
Parsley, sage, rosemary, and maggikraut.

VS

Absolutely! I agree with that :) I just wanted to make that known, since a few posts higher were listed some hashes of files, too...

My projects... Tools for messing with Simutrans graphics. Graphic archive - templates and some other stuff for painters. Development logs for most recent information on what is going on. And of course pak128!

cheesehead

Quote from: Dwachs on February 19, 2012, 02:36:01 PMIt seems that the packaged version uses a different implementation of checksums.

Confirmed.

The Debian patch that changed sha-1 is: http://anonscm.debian.org/gitweb/?p=pkg-games/simutrans.git;a=blob_plain;f=debian/patches/sha1-replacement.diff.

I compiled r4359 (110.0.1) with the patch, and the binary can join (and serve) games played by the debian-packaged binary, but throws the pakset error when attempting to join a manually-installed version.

I compiled r4359 without the patch, and the binary had the opposite compatibility.

cheesehead

In https://bugs.launchpad.net/ubuntu/+source/simutrans/+bug/931181/comments/11 , Ansgar noticed that the hashes are the same, but the endianness seems different.

Perhaps it's a bug in one implementation of SHA1. I must dig into this when I have more time in a few weeks. I'm quite new-and-slow at C, but learning...

cheesehead

Update: On 29 Apr 2012, a patch was committed to the Debian git repo to fix this issue.

I tried installing the resulting (Debian Sid) packages today in Ubuntu 12.04, but got a missing-dependency error. Oh, well.

I also tried building the package from the Debian git source. It builds just fine in Debian 6, and the resulting debs run just fine in Ubuntu 12.04...but the original bug is still there. Check the source...yes, the commit is there.

Still working on it...

cheesehead

Update:

The Original SHA1 implementation by Debian does indeed seem to be fixed. Thanks again to Dwachs for noticing the key clue, and to Ansgar for all the hard work to patch the problem successfully.

Here's the hash from the Debian package of Simutrans 111.2.2 in Debian 7:
Message: pakset_info_t::debug: PostOffice -> sha1 = 263C0CB8C858272A12FF54FC64F57292AF8ADAB7

And here's the corresponding hash from a manually installed Simutrans 111.2.2 on the same system:
Message: pakset_info_t::debug: PostOffice -> sha1 = 263C0CB8C858272A12FF54FC64F57292AF8ADAB7

(They are identical)

But there's still a problem. The Debian-packaged game still won't connect to, say, Timothy's entropy server games.

Test #1: Install Debian packages in Debian 7.
# apt-get install simutrans simutrans-pak64
$ simutrans -debug 3 &> s-package.log

Result: Fails to connect to the a.64.simutrans.entropy.me.uk server game. The UI claims the same pakset incompatibility as before. Debug logfile: http://pastebin.ubuntu.com/984143/.

Test #2: Manually install from sourceforge in Debian 7.
$ mkdir manual
$ cd manual
$ wget http://sourceforge.net/projects/simutrans/files/simutrans/111-2-2/simulinux-111-2-2.zip
$ wget http://sourceforge.net/projects/simutrans/files/pak64/111-2/simupak64-111-2.zip
$ unzip simulinux-111-2-2.zip
$ unzip simupak64-111-2.zip
$ chmod -R +Xr simutrans/pak       # This fixes the pakset's permissions
$ simutrans/simutrans -debug 3 &> ~/s-manual.log

Result: Succesful connect to the a.64.simutrans.entropy.me.uk server game. Debug logfile: http://pastebin.ubuntu.com/984162/.


Test #3: Check the pakset. Try the manually-installed game with the packaged pakset.
$ simutrans/simutrans -debug 3 -object /usr/share/games/simutrans/pak &> ~/s-crossover.log
Result: Succesful connection to the a.64.simutrans.entropy.me.uk server game. Debug logfile http://pastebin.ubuntu.com/984244/.

So the packaged pakset is not the problem. It's the correct version, and compiled properly. The problem is in Simutrans itself somewhere...

What should I look at next to help the process?


kierongreen

Some of the checksums are different between tests 1 and 3...

Dwachs

I could not reproduce this here on my machine. If you look into the log-files, you see that the checksum for IL-76 are different. On my computer I got

IL-76 -> sha1 = 385C583F818F09631B2374EFF1BF867F8A623D75

for both the debian version (source code taken from here: https://launchpad.net/ubuntu/+source/simutrans/111.2.2-1)  and the current simutrans trunk version. This checksum is the same as you got for your third try. No idea, where the bug is.

Are you sure that the apt-get command installed the correct version?

Could you try to compile the source from the debian page ? You will have to apply the patches from simutrans_111.2.2-1.debian.tar.xz to the source from simutrans_111.2.2.orig.tar.xz.
Parsley, sage, rosemary, and maggikraut.

cheesehead

I'm pretty sure it's the right version, according to http://packages.qa.debian.org/s/simutrans.html, and "apt-cache show simutrans", and the first line of the log.

Thanks for noticing the still-different hashes, and for compiling from the Debian source. I'll try that when I return in a couple days from a trip.