ENTITIES/mcl_boats: Fix server crash when boat passenger sneaks #91

Merged
erlehmann merged 1 commits from fix-boat-passenger-sneaking-crash into master 2021-06-19 00:01:36 +02:00
Owner
Problem

TRACKING ISSUE: #89

This patch fixes a crash that occurs when a player who is not a driver of a boat sneaks.

Solution

Instead of “detach_player” (a function that does not exist), “detach_object” (a function that does exist) is called when the player sneaks inside a boat. This makes the player exit the boat.

Details

This seems to be a simple typo/brainfart in the original code.

Most likely, code paths involving two players in a boat were never tested exhaustively.

Testing Steps
Verify the crash happens (skip if you did it once)
  1. With Mineclonia commit 6c311d5528, create a new world called “boatcrash” in the Minetest GUI. Then exit minetest.
  2. Start a Minetest dedicated server without a GUI with the command minetest --server --worldname boatcrash.
  3. Start a second instance of Minetest. Connect to the server at 127.0.0.1 using a username and password of “a”.
  4. As user “a”, place a boat and enter it by right clicking it.
  5. Start a third instance of Minetest. Connect to the server at 127.0.0.1 using a username and password of “b”.
  6. As user “b”, enter the boat with user “a” in it.
  7. As user “b”, press the sneak key.
  8. Observe the game crashing.
Verify that the patch actually fixes the crash
  1. With Mineclonia commit 764ff5512a, create a new world called “boatcrash2” in the Minetest GUI. Then exit minetest.
  2. Start a Minetest dedicated server without a GUI with the command minetest --server --worldname boatcrash2.
  3. Start a second instance of Minetest. Connect to the server at 127.0.0.1 using a username and password of “a”.
  4. As user “a”, place a boat and enter it by right clicking it.
  5. Start a third instance of Minetest. Connect to the server at 127.0.0.1 using a username and password of “b”.
  6. As user “b”, enter the boat with user “a” in it.
  7. As user “b”, press the sneak key.
  8. User “b” should exit the boat, i.e. be unattached from it and be able to move freely.
  9. As user “a”, move the boat around a bit, then also press the sneak key.
  10. User “a” should exit the boat, i.e. be unattached from it and be able to move freely.
To do
  • Fill out PR template
  • Create testing instructions
  • Verify testing instructions
##### Problem TRACKING ISSUE: #89 This patch fixes a crash that occurs when a player who is not a driver of a boat sneaks. ##### Solution Instead of “detach_player” (a function that does not exist), “detach_object” (a function that does exist) is called when the player sneaks inside a boat. This makes the player exit the boat. ##### Details This seems to be a simple typo/brainfart in the original code. Most likely, code paths involving two players in a boat were never tested exhaustively. ##### Testing Steps ###### Verify the crash happens (skip if you did it once) 1. With Mineclonia commit 6c311d552865288e6eeb3a398b26fea1445a46b2, create a new world called “boatcrash” in the Minetest GUI. Then exit minetest. 2. Start a Minetest dedicated server without a GUI with the command `minetest --server --worldname boatcrash`. 3. Start a second instance of Minetest. Connect to the server at 127.0.0.1 using a username and password of “a”. 4. As user “a”, place a boat and enter it by right clicking it. 5. Start a third instance of Minetest. Connect to the server at 127.0.0.1 using a username and password of “b”. 6. As user “b”, enter the boat with user “a” in it. 7. As user “b”, press the sneak key. 8. *Observe the game crashing.* ###### Verify that the patch actually fixes the crash 1. With Mineclonia commit 764ff5512a26bc66cbe94a39b8132a57fe940f7f, create a new world called “boatcrash2” in the Minetest GUI. Then exit minetest. 2. Start a Minetest dedicated server without a GUI with the command `minetest --server --worldname boatcrash2`. 3. Start a second instance of Minetest. Connect to the server at 127.0.0.1 using a username and password of “a”. 4. As user “a”, place a boat and enter it by right clicking it. 5. Start a third instance of Minetest. Connect to the server at 127.0.0.1 using a username and password of “b”. 6. As user “b”, enter the boat with user “a” in it. 7. As user “b”, press the sneak key. 8. User “b” should exit the boat, i.e. be unattached from it and be able to move freely. 9. As user “a”, move the boat around a bit, then also press the sneak key. 10. User “a” should exit the boat, i.e. be unattached from it and be able to move freely. ##### To do - [x] Fill out PR template - [x] Create testing instructions - [x] Verify testing instructions
erlehmann force-pushed fix-boat-passenger-sneaking-crash from fd9467c0b0 to 764ff5512a 2021-06-18 19:11:26 +02:00 Compare
erlehmann changed title from WIP: ENTITIES/mcl_boats: Fix server crash when boat passenger sneaks to ENTITIES/mcl_boats: Fix server crash when boat passenger sneaks 2021-06-18 19:31:04 +02:00
erlehmann requested review from cora 2021-06-18 19:34:33 +02:00
cora approved these changes 2021-06-19 00:01:10 +02:00
cora left a comment
Member

I did:

Verify the crash happens (skip if you did it once)
  • 1. With Mineclonia commit 6c311d5528, create a new world called “boatcrash” in the Minetest GUI. Then exit minetest.

  • 2. Start a Minetest dedicated server without a GUI with the command minetest --server --worldname boatcrash.

  • 3. Start a second instance of Minetest. Connect to the server at 127.0.0.1 using a username and password of “a”.

  • 4. As user “a”, place a boat and enter it by right clicking it.

  • 5. Start a third instance of Minetest. Connect to the server at 127.0.0.1 using a username and password of “b”.

  • 6. As user “b”, enter the boat with user “a” in it.

  • 7. As user “b”, press the sneak key.

  • 8. Observe the game crashing.

Verify that the patch actually fixes the crash
  • 1. With Mineclonia commit 764ff5512a, create a new world called “boatcrash2” in the Minetest GUI. Then exit minetest.

  • 2. Start a Minetest dedicated server without a GUI with the command minetest --server --worldname boatcrash2.

  • 3. Start a second instance of Minetest. Connect to the server at 127.0.0.1 using a username and password of “a”.

  • 4. As user “a”, place a boat and enter it by right clicking it.

  • 5. Start a third instance of Minetest. Connect to the server at 127.0.0.1 using a username and password of “b”.

  • 6. As user “b”, enter the boat with user “a” in it.

  • 7. As user “b”, press the sneak key.

  • 8. User “b” should exit the boat, i.e. be unattached from it and be able to move freely.

  • 9. As user “a”, move the boat around a bit, then also press the sneak key.

  • 10. User “a” should exit the boat, i.e. be unattached from it and be able to move freely.

I did: ###### Verify the crash happens (skip if you did it once) - [x] 1. With Mineclonia commit 6c311d552865288e6eeb3a398b26fea1445a46b2, create a new world called “boatcrash” in the Minetest GUI. Then exit minetest. - [x] 2. Start a Minetest dedicated server without a GUI with the command `minetest --server --worldname boatcrash`. - [x] 3. Start a second instance of Minetest. Connect to the server at 127.0.0.1 using a username and password of “a”. - [x] 4. As user “a”, place a boat and enter it by right clicking it. - [x] 5. Start a third instance of Minetest. Connect to the server at 127.0.0.1 using a username and password of “b”. - [x] 6. As user “b”, enter the boat with user “a” in it. - [x] 7. As user “b”, press the sneak key. - [x] 8. *Observe the game crashing.* ###### Verify that the patch actually fixes the crash - [x] 1. With Mineclonia commit 764ff5512a26bc66cbe94a39b8132a57fe940f7f, create a new world called “boatcrash2” in the Minetest GUI. Then exit minetest. - [x] 2. Start a Minetest dedicated server without a GUI with the command `minetest --server --worldname boatcrash2`. - [x] 3. Start a second instance of Minetest. Connect to the server at 127.0.0.1 using a username and password of “a”. - [x] 4. As user “a”, place a boat and enter it by right clicking it. - [x] 5. Start a third instance of Minetest. Connect to the server at 127.0.0.1 using a username and password of “b”. - [x] 6. As user “b”, enter the boat with user “a” in it. - [x] 7. As user “b”, press the sneak key. - [x] 8. User “b” should exit the boat, i.e. be unattached from it and be able to move freely. - [x] 9. As user “a”, move the boat around a bit, then also press the sneak key. - [x] 10. User “a” should exit the boat, i.e. be unattached from it and be able to move freely.
erlehmann merged commit 86c1f37296 into master 2021-06-19 00:01:36 +02:00
erlehmann deleted branch fix-boat-passenger-sneaking-crash 2021-06-19 00:02:22 +02:00
This repo is archived. You cannot comment on pull requests.
No description provided.