Loadfs and Unloadfs: Weird case sensibility management -
Zamaroht - 29.12.2009
I actually find it a bit hard to explain this bug in words, so I'll use examples instead.
Let's suppose there is a properly compiled filterscript in the filterscripts directory named "FilterScript.amx" (notice the capital letters).
Now, suppose I write the following commands, either in console or ingame using /rcon:
Example 1:
loadfs FilterScript -
Works
unloadfs FilterScript -
Works
Example 2:
loadfs filterscript -
Works
unloadfs filterscript -
Works
Example 3:
loadfs FiLTErsCrIpt -
Works
unloadfs FiLTErsCrIpt -
Works
So far, it's noticable that there isn't any case sensitivity at all. The problem comes up in the following examples:
Example 4:
loadfs filterscript -
Works
unloadfs FilterScript -
Doesn't Work
unloadfs FiLTErsCrIpt -
Doesn't Work
unloadfs filterscript -
Works
Example 5:
loadfs FilterScript -
Works
unloadfs filterscript -
Doesn't Work
unloadfs FiLTErsCrIpt -
Doesn't Work
unloadfs FilterScript -
Works
That is, even although loadfs can be used either with the correct capitalisation or not, unloadfs has to be called with the exact same string, incluiding correct capitals, than the one used with loadfs, wheter or not it was loaded with the correct capitals.
This makes an irregularity, since loadfs
is not case sensitive regarding the file name, but unloadfs
is case sensitive regarding loadfs.
It's not a major bug (if it's considered a bug), but it can lead to confusion.
Re: Loadfs and Unloadfs: Weird case sensibility management -
ev0lution - 29.12.2009
I had this problem in 0.2X as well.
It's because
loadfs doesn't care about case-sensitivity when loading a file, however in memory it's loaded as whatever you typed after "loadfs".
It's a bigger problem than what you showed, loadfs will load the script as many times as typed with different capitalisation.
For example:
loadfs filterscript
loadfs Filterscript
loadfs FIlterscript
loadfs FILterscript
loadfs FILTerscript
Now you have 5 scripts loaded, all the same script from filterscript.amx.
Depending on the script, it can cause the server/script to malfunction because of the duplicate items in each loaded script.
unloadfs will now be able to unload all of them, but no other case variations of them.
For example:
unloadfs filterscript
unloadfs Filterscript
unloadfs FIlterscript
unloadfs FILterscript
unloadfs FILTerscript
Those will all work, however any other case variations will not.
For a slightly better example, I quickly checked this on a SA-MP 0.3R4 Windows server with the "base.amx" filterscript that comes with the server.
I can assure you I only had "base.amx", all lowercase, in my filterscripts directory.
Quote:
Console input: loadfs base
[10:06:24] --Base FS loaded. "base", the original, is loaded
[10:06:24] Filterscript 'base.amx' loaded.
Console input: loadfs Base
[10:06:26] --Base FS loaded. "Base", from "base", is loaded
[10:06:26] Filterscript 'Base.amx' loaded.
Console input: loadfs BAse
[10:06:29] --Base FS loaded. "BAse", from "base", is loaded
[10:06:29] Filterscript 'BAse.amx' loaded.
Console input: loadfs BASe
[10:06:31] --Base FS loaded. "BASe", from "base", is loaded
[10:06:31] Filterscript 'BASe.amx' loaded.
Console input: loadfs BASE
[10:06:33] --Base FS loaded. "BASE", from "base", is loaded
[10:06:33] Filterscript 'BASE.amx' loaded.
Console input: unloadfs BaSe
[10:06:46] Filter script 'BaSe.amx' unload failed. "BaSe" was not loaded previously, despite the others with the same name but different case
Console input: unloadfs BASE
[10:06:49] Filterscript 'BASE.amx' unloaded. "BASE" was loaded previously
Console input: unloadfs BASe
[10:06:52] Filterscript 'BASe.amx' unloaded. "BASe" was loaded previously
Console input: unloadfs BAse
[10:06:54] Filterscript 'BAse.amx' unloaded. "BAse" was loaded previously
Console input: unloadfs Base
[10:06:57] Filterscript 'Base.amx' unloaded. "Base" was loaded previously
Console input: unloadfs base
[10:06:59] Filterscript 'base.amx' unloaded. "base" was loaded previously
|