azerothcore / azerothcore-wotlk

Complete Open Source and Modular solution for MMO
http://www.azerothcore.org
GNU Affero General Public License v3.0
6.6k stars 2.64k forks source link

db-export does not keep the case #4343

Open FrancescoBorzi opened 3 years ago

FrancescoBorzi commented 3 years ago

After using the db-export with:

./bin/acore-db-export

The table ip2nationCountries has been saved as ip2nationcountries (not the lowercase c)

--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/96136581-db-export-does-not-keep-the-case?utm_campaign=plugin&utm_content=tracker%2F40032087&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F40032087&utm_medium=issues&utm_source=github).
Kitzunu commented 3 years ago

It has always been with lower-case c since I installed AC

FrancescoBorzi commented 3 years ago

It has always been with lower-case c since I installed AC

image

the core code has it uppercase and it didn't work for me in lowercase, because the core would complain

Kitzunu commented 3 years ago

Yea I understand, so it is very weird image

Zoidwaffle commented 3 years ago

I just tested this on Debian 10.

There's missing execute on the dump-parser. So first:

chmod +x deps/drassil/mysql-tools/bin/dump-parser

After that it runs and creates the file:

./data/sql/base/db_auth/ip2nationCountries.sql

So I suggest updating the execute bit, but the name seems to be fine for me.

There's also something with excessive forward slashes - when running the script you can see ...db_auth//account_a... and similar, where a single slash should be enough. I haven't found where all these are coming from - seems like the $TPATH variable, but this stuff is referencing and sourcing all over the place... And now my coffee break has already been longer than intended, so no more time for this right now :grin:

My system says: GNU bash, version 5.0.3(1)-release (x86_64-pc-linux-gnu), just as a reference.

Edit: I found a way to fix the 2 issues I found. I created a PR for those.

I don't think this solved the initial issue, but I was unable to confirm that issue at all...

Perhaps something useful can be found to help debug if running the script using bash -x ./bin/acore-db-export 2>&1?

Zoidwaffle commented 3 years ago

@FrancescoBorzi - could you try running it again in the latest version with -x? I'm really curious as to what is doing the conversion from capital to small letters.

FrancescoBorzi commented 3 years ago

@Zoidwaffle done, unfortunately the case bug is still present for me:

image

tested on latest master (https://github.com/azerothcore/azerothcore-wotlk/commit/fe2fad17c7ec93ef1692beb05b32aa3dbd90e6b0) right after having merged both your and my improvements

Zoidwaffle commented 3 years ago

@FrancescoBorzi OK, so testing the latest version:

$ ./bin/acore-db-export 
<...>
/home/azerothcore/azerothcore_source/deps/drassil/mysql-tools/shared-def: line 22: syntax error in conditional expression: unexpected token `)'
/home/azerothcore/azerothcore_source/deps/drassil/mysql-tools/shared-def: line 22: syntax error near `"Linux")'
/home/azerothcore/azerothcore_source/deps/drassil/mysql-tools/shared-def: line 22: `if [[ $(uname -s) == "Linux") ]] || [[ $(uname -s) == "Darwin" ]]; then

Notice the extra ")" that shouldn't be there.

It works just fine here once fixing the issue above - and the file ./data/sql/base/db_auth/ip2nationCountries.sql is created and the capital C remains.

Could you please check ./deps/drassil/mysql-tools/mysql-dump line 93, where it says: eval "$MYSQLDUMP$OPTS $DUMPOPTS '$MYSQL_DB' '$T' | $DUMPPARSER > $FILE" and then append a echo "$MYSQLDUMP$OPTS $DUMPOPTS '$MYSQL_DB' '$T' | $DUMPPARSER > $FILE" to see exactly what command is generated?

On my system here it's like: mysqldump -u <user> -p<pass> -h localhost --skip-comments --skip-set-charset --routines --extended-insert --order-by-primary --single-transaction --quick 'acore_auth' 'ip2nationCountries' | /home/azerothcore/azerothcore_source/deps/drassil/mysql-tools/bin/dump-parser > /home/azerothcore/azerothcore_source/data/sql/base/db_auth/ip2nationCountries.sql

so clearly the capital C has survived here - and I wonder if the same happens for you or not.

FrancescoBorzi commented 3 years ago

Could you please check ./deps/drassil/mysql-tools/mysql-dump line 93, where it says

@Zoidwaffle that part is commented out

Kitzunu commented 2 years ago

is this still valid? Do we have any db tables that use uppercase naming?