About the case sensitivity of level checkmarks (very specific)

Started by Forestidia86, December 05, 2017, 07:23:58 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Forestidia86

This one should only hit people that change replay files; is therefore a very specific and rare thing I think. So it's probably not important but I was shortly confused.

PointedTo and the verifier don't seem to be case sensitive (at least concerning subfolders) but the checkmarks seem to be.

I think as I dealt with "Five for Fighting" (FfF) I wanted to try out my solution to "Whispering Wind" (WW). To achieve that I copied the replay of WW and changed the $FILENAME to the respective one for FfF but wrote "vicious" with lowercase first letter and used pointedTo.
I saw quite early that my other solution won't work and tried other things finding a solution, which was saved in solved/lemforum/vicious/
The folder "vicious" was created with lowercase first letter and within the replay file the path was lowercase first letter for the rank subfolder as well.
The verifier had no problems but no checkmark was created even when I played the replay.
As I realized what could be the reason and changed "vicious" in the replay file to uppercase first letter the checkmark was created after playing the replay.

To reproduce this:

- copy a replay of a lemforum level to an instance of Lix that has in replays/solved/lemforum/ no subfolder for the rank of it (but the same player name of course)
- change the $FILENAME within the replay file to lowercase first letter for the rank
- use pointedTo to play it, cancel it somewhen and solve the rest of the level
->
- A subfolder of the rank should have been created in solved/lemforum/ with lowercase first letter and the replay file in there should have lowercase first letter for the rank subfolder as well
- There should be no checkmark for that level and playing that replay shouldn't create one.

- Now change the path in the replay to an uppercase first letter for the rank subfolder.
- Play the replay.
->
- Now the checkmark should appear.

I hope my description is accurate and reproduceable.

Simon

Issue #270

Thanks, excellent report.

Most likely, this arises from Windows's case-insensitivity vs. my implementation of filenames. PointedTo and the verifier merely ask the operating system to open a specific file, and Windows will happily fetch the file by its case-insensitive name. But the checkmarks are doled out by raw string comparison in Lix's Filename class, the operating system is never called.

I should probably make the Filename class case-insensitive on Windows and case-sensitive everywhere else.

-- Simon

Forestidia86

Quite interesting that it seems to be OS dependant.
The case sensitivity played at another point a role as well.
As I converted the oriental levels of Clam, then I had to change "Hatch" to "hatch" for example. The old tileset had uppercase first letter whereas the new one had lowercase first letter and the game didn't recognize the old names with uppercase.

Simon

Hmm, I'd prefer the tile lookup case-sensitive. If I allowed Hatch for hatch only on Windows, other OSes will declare the level broken for missing tiles. This would be worse than flat-out breaking everywhere, for clarity.

If the tile lookup stays case-sensistive, maybe the checkmarks should remain case-sensitive, too... or at least the Filename class is good as-is (it's used everywhere in the program), and the checkmark database should be case-insensitive.

It's more important that the data is interpreted the same everywhere (levels) than that the local progress adheres to OS-specific culture.

-- Simon

Forestidia86

#4
Hm, what led to the "problem" was my laziness not to write "vicious" with uppercase first letter.
PointedTo as well as the verifier nevertheless accepted that, which is probably already another interpretation of data than it would be on Linux I guess? And I didn't realize therefore at that point that case-sensitivity plays a role since everything seemed fine.

But I agree that's important that the data is understood the same across the OS, else people on Windows use case-insensitivity (like me), which then in worst case doesn't work for users with case-sensitive OS.

Simon

I'd like to keep the case-sensitivity of checkmarks. Replays should behave the same across operating systems.

It's an unfortunate extra that the wrong capitalization retrieves the correct file on Windows. Not sure if I should write extra code to disallow that. If I change anything, disallowing retrieval of (file with different capitalization) would be the right change.

-- Simon

Forestidia86

I can fully understand your position.
The only thing I noticed is that the mass verifier now explicitly seems to say that the checkmark is updated, though it isn't.

verifier.txt:
Result,Replay filename,Level filename,Player,Saved,Required,Skills,Phyus
(OK),replays/test/letsblockandblow-Forestidia-2017-12-05-065956 - Kopie.txt,levels/single/lemforum/lovely/letsblockandblow.txt,Forestidia,19,19,2,388
[...]
Statistics from 1 replays:
    1x (OK): replay solves the pointed-to level.
1 checkmarks for player `Forestidia' updated.

Simon

Okay, this message is a blatant lie then, and that's a bug. Good catch. Then I need extra care on Windows to avoid wrongly-cased matches during lookup of pointed-to level.

-- Simon

Forestidia86

One other oddity:
If you have a replay with lower case "lovely" and one with upper case "Lovely" the amount of levels is duplicated, since it lists all levels with lower case and with upper case directory name and says then "of 80" instead "of 40".

Simon

Nnnnnnnn. How many of these bugs are still hiding here. >_> I'm putting all these into #284, I'll attack them after the pointed-to lookup has become case-sensitive. But it's all low-priority.

-- Simon

Forestidia86

Just for reference I've attached a file where one can see how the duplication looks in verifier.txt. I used an instance of Lix where I haven't solved/checked this level, yet; so I got two checkmarks updated for the same level.
It seems as if the verifier sees it as two different levels due to the different directory name but nevertheless accesses the same level for verification. The same for the directory.

namida

Isn't case-sensitivity a file system matter, rather than an OS one? EG: If you were to run Linux Lix on a FAT32 partition, wouldn't that be case-insensitive?
My projects
2D Lemmings: NeoLemmix (engine) | Lemmings Plus Series (level packs) | Doomsday Lemmings (level pack)
3D Lemmings: Loap (engine) | L3DEdit (level / graphics editor) | L3DUtils (replay / etc utility) | Lemmings Plus 3D (level pack)
Non-Lemmings: Commander Keen: Galaxy Reimagined (a Commander Keen fangame)

Simon

Quotefile system matter, rather than an OS one?

Smart, I haven't thought about this. I'll have to research more, also I'd like to know how other cross-platform cultures handle the filename case issue.

-- Simon

Forestidia86

From github:
QuoteNeed to check: On Windows, you specify Hatch.H in a level file when the tile is really called hatch.H. Does the game load the tile with the wrongly-cased name?

Yeah it loads as far as I have tested. And yeah it seems to be from 0.9.7 on. But my first trouble with the checkmarks was with an earlier version (I think 0.9.4).

Simon