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
Failure in move_sqlite.py #3269
Comments
It would be quite interesting to see which column contains the invalid UTF-8. Is it a player name, which didn't get properly validated before writing the rank into the database. Was there an error while writing which corrupted a field (I don't think that happens with sqlite). Does the python script interprets a column as utf8 which should be binary (I think only the teamrank-TeamID column would fit for that) |
|
Honestly, I don't think these players have invalid names. My guess is that the string is being overwritten somewhere in the server before getting written to sqlite. Maybe we use an old buffer that is not allocated anymore? On other servers:
I guess it would help to try out if those names can be used on server. |
My guess: The server does name replacement for valid UTF-8 names by prepending (1), because another player is also on the server. This truncates the name at an invalid position, resulting in invalid UTF-8 at the end. Solution: Use str_utf8_copy at that place. |
You win, that's probably the reason. |
I guess for the ones in here I should just cut off the invalid utf8 at the end. @Zwelf got an easy command for that by chance? |
3285: Fix invalid server-assigned utf8 names with (1) prefix (fixes #3269) r=heinrich5991 a=def- ## Checklist - [ ] Tested the change ingame - [ ] Provided screenshots if it is a visual change - [ ] Tested in combination with possibly related configuration options - [ ] Written a unit test if it works standalone, system.c especially - [ ] Considered possible null pointers and out of bounds array indexing - [ ] Changed no physics that affect existing maps - [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional) Co-authored-by: def <dennis@felsin9.de>
Adding a line to ignore invalid utf-8 characters and trimming of trailing whitespace might do the job. I think this behaves like the utf8-trimming done in str_utf8_copy. And trimming the whitespace due to trailing whitspace is removed by the server as well. diff --git a/scripts/move_sqlite.py b/scripts/move_sqlite.py
index 902192193..cda741ade 100755
--- a/scripts/move_sqlite.py
+++ b/scripts/move_sqlite.py
@@ -34,6 +34,7 @@ def transfer(file_from, file_to):
cursor_to = conn_to.cursor()
conn_from = sqlite3.connect(file_from, isolation_level='EXCLUSIVE')
+ conn_from.text_factory = lambda b: b.decode(errors = 'ignore').rstrip()
for line in conn_from.iterdump():
cursor_to.execute(line)
print(line) |
Thanks, that seems to have worked. I guess we don't need to persist this workaround since the root cause is fixed. |
This issue is still occuring:
|
str_utf8_trim_right does not work for this, I'll try out what does. Hm, but we actually use str_utf8_copy and that should work. Maybe the servers were still running old version? |
It was running 1883546 (huh, pure base-10 digit commit ID). |
Too bad, then this is somehow still occuring. Any idea? The code in server.cpp looks correct to me now. |
heinrich recently fixed the utf8 trimming, so I believe this is fixed now. |
Does this mean we lost the ranks? Edit: Seems like not, good.
@Zwelf can you please take a look?
The text was updated successfully, but these errors were encountered: