HaxeFoundation / haxelib

The Haxe library manager
https://lib.haxe.org/
MIT License
173 stars 77 forks source link

haxelib submit is case-sensitive #392

Open Aurel300 opened 7 years ago

Aurel300 commented 7 years ago

I have registered on haxelib as Aurel300 (uppercase A). Thinking usernames are not case-sensitive, I put

  "contributors": ["aurel300"]

In my haxelib.json. When submitting with haxelib submit zipped.zip, I got the error message:

Error: User 'aurel300' is not a developer of project 'docopt'

Changing the contributors field to ["Aurel300"] solved this issue. As far as I can tell, the issue is in haxelib/src/haxelib/server/Repo.hx on line 132:

if( d.userObj.name == user )
paulorobertocruz commented 6 years ago

Is this considered a problem?

Aurel300 commented 6 years ago

Isn't it a bug? AFAIK most of Haxelib should be case-insensitive. This could confuse people, it certainly confused me.

paulorobertocruz commented 6 years ago

I am asking because i am inclined to fix it and i think it is simple, but if this behavior is intended the code won't be merged. No harm in asking.

ibilon commented 6 years ago

This is not intended behavior, user and project names are supposed to be case insensitive.

RaidAndFade commented 6 years ago

This extends to another problem with machines that have case-sensitive file systems, Those machines require that you correctly capitalize the library being used for nearly all commands including when listing as dependencies in build.hxml.

This is definitely not intended behavior as it is different on case-insensitive machines, This is a side-effect of not checking case in any function related to libraries, and is a major inconvenience/bug.

uvtc commented 5 years ago

i would expect user and project names to case-sensitive (like Haxe itself, and most (?) filesystems), but at the same time that haxelib would warn and suggest corrections when/if you accidentally get case wrong.

@ibilon Why would it be intended behavior? That would seem to be a policy that would invite problems on case-sensitive filesystems. Does case-insensitivity it significantly improve user experience in some way I'm not seeing?

uvtc commented 5 years ago

Of course, you would not want to allow someone to upload a "CoolProj" library when "Coolproj" already exists (or create a "ThisUser" when "thisuser" already exists), but that would be something I'd expect haxelib to check for anyway.

Aurel300 commented 5 years ago

@uvtc Case-sensitivity in haxelib would cause problems on case-insensitive filesystems, not the other way around. ALibrary should be the same as alibrary, same for users, for ease of use with URL and case-insensitive filesystems. I think Haxelib should convert any project name to lowercase and just make that the canonical name. Requests, installs, updates, etc of projects should accept any case version, as long as the lowercased version matches.

uvtc commented 5 years ago

Case-sensitivity in haxelib would cause problems on case-insensitive filesystems, not the other way around.

I understand the desire to make it easier for users to install "ALibrary" by typing haxe install alibrary if they want, but I don't see how having haxelib be case-sensitive would cause a problem on a case-insensitive filesystem. Could you give an example?

I think Haxelib should convert any project name to lowercase and just make that the canonical name.

I would not want to upload a library NamedLike-This and have it later displayed on the lib.haxe.org as namedlike-this.

Requests, installs, updates, etc of projects should accept any case version, as long as the lowercased version matches.

That sounds ok, though I think it's also reasonable to require the user to type the name with the correct case.

Aurel300 commented 5 years ago

… how having haxelib be case-sensitive would cause a problem on a case-insensitive filesystem. Could you give an example?

That was the example. If there were two libraries, ALibrary and alibrary, and somebody on a case-insensitive system tried to install them both:

$ haxelib install ALibrary

So far so good, haxelib creates a new directory ALibrary (in your haxelib path) and installs the library into it.

$ haxelib install alibrary

And now haxelib tries to create the directory alibrary – which to the case-insensitive filesystem is the same as the directory ALibrary. At this point something bad will happen - maye files of one library get overridden, maybe haxelib complains that the library is already installed.

I would not want to upload a library NamedLike-This and have it later displayed on the lib.haxe.org as namedlike-this.

I don't think there is a single library that has uppercase letters. Perhaps there already is some lowercasing going on, I haven't checked. The name of the library is its identifier when installing and in URLs. You can stylise it however you want in the readme or the github repo.

uvtc commented 5 years ago

That was the example.

Ok. I didn't understand. I'd thought that upon lib creation/upload that haxelib would naturally do a lowercase compare of this lib name with all other existing lib names, making sure there were no duplicates, before allowing one to proceed.