Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

drifting pirate ship crashes server #420

Open
stm2 opened this issue Dec 1, 2015 · 2 comments
Open

drifting pirate ship crashes server #420

stm2 opened this issue Dec 1, 2015 · 2 comments
Labels

Comments

@stm2
Copy link
Member

stm2 commented Dec 1, 2015

The following test causes a segfault (don't know why)
function test_pirate()
local r1 = region.create(0, 0, "ocean")
local r2 = region.create(1, 0, "ocean")
local f1 = faction.create("[email protected]", "human", "de")
local f2 = faction.create("[email protected]", "human", "de")
local u1 = unit.create(f1, r1, 1)
u1.ship = ship.create(r1, "boat")
u1.ship.owner = u1
u1:add_item("money", 100)
u1:set_skill("sailing", 5)

local u2 = unit.create(f2, r1, 1)
u2.ship = ship.create(r1, "boat")
u2:add_item("money", 100)

-- ship will drift and then attempt to do piracy ==> segfault
-- u2:set_skill("sailing", 5)
u2.ship.owner = u2

u2:add_order("PIRATERIE")

process_orders()
write_reports()

end

e2 run-tests (1) [C/C++ Application]
/home/steffen/git/server-stm/build-x86_64-gcc-Debug/eressea/eressea [1363] [cores: 1]
Thread [1] 1363 [core: 1](Suspended : Signal : SIGSEGV:Segmentation fault)
_IO_vfprintf_internal() at /build/buildd/eglibc-2.19/stdio-common/vfprintf.c:1,661 0x7ffff6abea03
_IO_vsnprintf() at /build/buildd/eglibc-2.19/libio/vsnprintf.c:119 0x7ffff6ae5579
slprintf() at /home/steffen/git/server-stm/src/util/bsdstring.c:121 0x4f2642
write_unitname() at /home/steffen/git/server-stm/src/kernel/unit.c:1,860 0x4e6e90
unitname() at /home/steffen/git/server-stm/src/kernel/unit.c:1,869 0x4e6eff
eval_unit() at /home/steffen/git/server-stm/src/reports.c:1,842 0x46263b
parse_symbol() at /home/steffen/git/server-stm/src/util/translation.c:222 0x4f8bc2
parse_string() at /home/steffen/git/server-stm/src/util/translation.c:290 0x4f8d90
parse() at /home/steffen/git/server-stm/src/util/translation.c:352 0x4f8fef
translate() at /home/steffen/git/server-stm/src/util/translation.c:397 0x4f928f
nr_render() at /home/steffen/git/server-stm/src/util/nrmessage.c:151 0x4f76fe
log_orders() at /home/steffen/git/server-stm/src/reports.c:2,249 0x464098
msg_create() at /home/steffen/git/server-stm/src/util/message.c:157 0x4f6cdb
msg_feedback() at /home/steffen/git/server-stm/src/kernel/messages.c:143 0x4d05ee
ship_ready() at /home/steffen/git/server-stm/src/move.c:1,726 0x43757a
sail() at /home/steffen/git/server-stm/src/move.c:1,814 0x437a41
move_cmd() at /home/steffen/git/server-stm/src/move.c:2,274 0x43962e
piracy_cmd() at /home/steffen/git/server-stm/src/piracy.c:208 0x43b0d0
move_pirates() at /home/steffen/git/server-stm/src/move.c:2,483 0x43a011
movement() at /home/steffen/git/server-stm/src/move.c:2,598 0x43a3de
<...more frames...>
gdb

@stm2 stm2 added the bug label Dec 1, 2015
@ennorehling
Copy link
Member

Ich kann das nicht nachvollziehen. Das Schiff treibt natürlich nicht ab, weil das ja Zufall ist, und Murphy's Gesetz sag, das es bei mir deshalb nicht auftritt.

Ich frage mich, ob das hier eigentlich klappt: u2.ship.owner = u2
Soweit mir bekannt, gibt es keine owner property an Schiffen.

Und natürlich hat sich die Regel zum Abtreiben geändert. Ich sollte das evtl. mit dem Code von 2015 testen, nicht mit meinem Kandidaten für 3.10.

@ennorehling
Copy link
Member

Der Test erzeugt mit einer älteren Version folgenden Report (ohne Crash):

Die Boot m74c (m74c) in Ozean (1,0) entdeckt ein Opfer im Westen.
Einheit fq17 (fq17) in Ozean (1,0): 'NACH Westen' - Der Kapitän muß ein
Segeltalent von mindestens 1 haben, um Boot m74c (m74c) zu befehligen.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants