The International Simutrans Forum

 

Author Topic: Launchpad Bug #931181 - Ubuntu 11.10 version of 110.0.1 network games  (Read 4825 times)

0 Members and 1 Guest are viewing this topic.

Offline cheesehead

  • *
  • Posts: 20
  • Languages: EN
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
Quote
The 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...

Offline Dwachs

  • DevTeam, Coder/patcher
  • Administrator
  • *
  • Posts: 4863
  • Languages: EN, DE, AT
Re: Launchpad Bug #931181 - Ubuntu 11.10 version of 110.0.1 network games
« Reply #1 on: February 19, 2012, 07:10:34 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 ?

Offline cheesehead

  • *
  • Posts: 20
  • Languages: EN
Re: Launchpad Bug #931181 - Ubuntu 11.10 version of 110.0.1 network games
« Reply #2 on: February 19, 2012, 01:53:40 PM »
Great question!

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


First, I looked for differences
Code: [Select]
$ 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
Code: [Select]
$ 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!

Offline Dwachs

  • DevTeam, Coder/patcher
  • Administrator
  • *
  • Posts: 4863
  • Languages: EN, DE, AT
Re: Launchpad Bug #931181 - Ubuntu 11.10 version of 110.0.1 network games
« Reply #3 on: February 19, 2012, 02:36:01 PM »
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.

Offline cheesehead

  • *
  • Posts: 20
  • Languages: EN
Re: Launchpad Bug #931181 - Ubuntu 11.10 version of 110.0.1 network games
« Reply #4 on: February 20, 2012, 06:31:39 PM »
I think you're right.
I went back through the logs:

Succesful (Ubuntu 11.10) server:
Code: [Select]
Message: pakset_info_t::debug: PostOffice -> sha1 = B80C3C262A2758C8FC54FF129272F564B7DA8AAF
Succesful (Ubuntu 11.10) client:
Code: [Select]
Message: pakset_info_t::debug: PostOffice -> sha1 = B80C3C262A2758C8FC54FF129272F564B7DA8AAF
Failed (Manually-installed) server:
Code: [Select]
Message: pakset_info_t::debug: PostOffice -> sha1 = 263C0CB8C858272A12FF54FC64F57292AF8ADAB7
Failed (Ubuntu 11.10) client:
Code: [Select]
Message: pakset_info_t::debug: PostOffice -> sha1 = B80C3C262A2758C8FC54FF129272F564B7DA8AAF

Interesting double-check:
Code: [Select]
$ 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.



Offline VS

  • Senior Plumber (Devotee)
  • Devotees (Inactive)
  • *
  • Posts: 4856
  • Vladimír Slávik
    • VS's Simutrans site
  • Languages: CS,EN
Re: Launchpad Bug #931181 - Ubuntu 11.10 version of 110.0.1 network games
« Reply #5 on: February 20, 2012, 08:57:23 PM »
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

Offline Dwachs

  • DevTeam, Coder/patcher
  • Administrator
  • *
  • Posts: 4863
  • Languages: EN, DE, AT
Re: Launchpad Bug #931181 - Ubuntu 11.10 version of 110.0.1 network games
« Reply #6 on: February 20, 2012, 09:01:30 PM »
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).

Offline VS

  • Senior Plumber (Devotee)
  • Devotees (Inactive)
  • *
  • Posts: 4856
  • Vladimír Slávik
    • VS's Simutrans site
  • Languages: CS,EN
Re: Launchpad Bug #931181 - Ubuntu 11.10 version of 110.0.1 network games
« Reply #7 on: February 20, 2012, 09:48:36 PM »
Absolutely! I agree with that :) I just wanted to make that known, since a few posts higher were listed some hashes of files, too...

Offline cheesehead

  • *
  • Posts: 20
  • Languages: EN
Re: Launchpad Bug #931181 - Ubuntu 11.10 version of 110.0.1 network games
« Reply #8 on: February 20, 2012, 11:06:44 PM »
It 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.

Offline cheesehead

  • *
  • Posts: 20
  • Languages: EN
Re: Launchpad Bug #931181 - Ubuntu 11.10 version of 110.0.1 network games
« Reply #9 on: March 05, 2012, 08:54:00 PM »
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...

Offline cheesehead

  • *
  • Posts: 20
  • Languages: EN
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...

Offline cheesehead

  • *
  • Posts: 20
  • Languages: EN
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:
Code: [Select]
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:
Code: [Select]
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.
Code: [Select]
# 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.
Code: [Select]
$ 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.
Code: [Select]
$ simutrans/simutrans -debug 3 -object /usr/share/games/simutrans/pak &> ~/s-crossover.logResult: 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?


Offline kierongreen

  • Dev Team, Coder/patcher
  • Devotee
  • *
  • Posts: 2346
Some of the checksums are different between tests 1 and 3...

Offline Dwachs

  • DevTeam, Coder/patcher
  • Administrator
  • *
  • Posts: 4863
  • Languages: EN, DE, AT
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
Code: [Select]
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.

Offline cheesehead

  • *
  • Posts: 20
  • Languages: EN
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.