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
Version names truncated after move to git #7021
Comments
i'd rather make sure the string is cut in a way that the end is always included, as that tends to include the revision hash and makes the versions distinguishable. or make a hash of the complete string and transmit that. |
Possibly transmit just the revision hash (that should normally be enough), perhaps encoded in a way so more of the hash fits in 15 bytes, perhaps with some indicator bits for modified/non-modified checkout and release build or not. |
I tried summing up the packet structure as it currently is:
The MTU we work with is 1460 bytes, meaning there should be room for 18 bytes expansion. I suggest expanding server revision by 17 bytes to 32 bytes. |
A separate issue is the gamelog. It also uses the NETWORK_REVISION_LENGTH constant for the size of revision string it writes to the log, I'm not sure how safe it would be to increase the size here, is this ever written to a file as a binary format? Ideally the field should probably be sufficiently long to contain a full untruncated "display revision string" i.e. the one used in the title screen window. |
Game log is stored in the savegame IIRC OpenTTD/src/saveload/gamelog_sl.cpp Line 32 in b60b193
may be a problem |
OpenTTD/src/gamelog_internal.h Lines 36 to 49 in 82fc28f
This union definitely makes it difficult to change. Should probably just write a prefix of the revision hash to this. |
Builds of most non-master branches will currently print
dbg: [misc] String too long for destination buffer
messages to the console. This is a symptom of the version strings generated being longer than the 15 byte buffer allocated.This becomes relevant especially for network games. The server's version name is truncated to 15 bytes, which can lead to unrelated versions being indistinguishable, with a large risk of desyncs.
OpenTTD/src/network/core/game.h
Line 44 in 5ff6053
OpenTTD/src/network/core/config.h
Line 40 in 5ff6053
As far as I can tell, it should be possible to increase
NETWORK_REVISION_LENGTH
without breaking compatibility with older clients. TheRecv_string
function does handle data longer than the supplied buffer, and will truncate strings longer than the buffer.OpenTTD/src/network/core/packet.cpp
Lines 242 to 265 in 5ff6053
The main thing to watch out for with increasing
NETWORK_REVISION_LENGTH
is the MTU for UDP server discovery packets. Increasing it by 20 will cost one possible NewGRF for network games, but should cover most if not all cases.The text was updated successfully, but these errors were encountered: