Coder Social home page Coder Social logo

Case insensitive filesystems about panamax HOT 3 OPEN

panamax-rs avatar panamax-rs commented on June 7, 2024
Case insensitive filesystems

from panamax.

Comments (3)

k3d3 avatar k3d3 commented on June 7, 2024

Oh shoot, I never noticed it downloaded crates case-sensitively. Since crates.io-index stores everything lowercase, I think it's fine to modify the creates directory to make everything lowercase.

As far as a non-breaking transition, that might be a bit tougher. The two options I can think of are:

  1. Run a one-time function to lowercase everything, and change panamax serve and the nginx config to lowercase the filename,
  2. Only make future syncs download to lowercase files, and change panamax serve to try accessing normally, then as lowercase (since otherwise Linux would break, I think). I don't believe there's an nginx equivalent, but I'd be okay dropping that as a requirement.

Any thoughts on either of those two solutions?

from panamax.

rene-d avatar rene-d commented on June 7, 2024

Well, it's a little more complicated than I thought... And finally, I'm not sure that it really prevents panamax from serving crates, if the mirror has been made on a case insensitive filesystem. My problem occurred when I rsync from Linux to a Windows formatted external disk: crates/an has been replaced by crates/An.

cargo seems to use a URI with lowercase and uppercase characters. For example:

GET /crates/An/xi/Anxiety/0.0.0/Anxiety-0.0.0.crate
GET /crates/bv/e-/bve-native/0.0.0-Placeholder/bve-native-0.0.0-Placeholder.crate 

e.g. in "http://mirror/crates/{prefix}/{crate}/{version}/{crate}-{version}.crate", prefix, crate and version use the lower and upper case characters found in the index entry. However, the entry is in an/xi/anxiety file.

No easy solutions... Probably the best one is to change {prefix} to {lowerprefix} which seems to be added two years ago (ref) and to make the prefix part of the crates/ tree in lowercase. The crate name and its version will remain unchanged. It will work because package names are unique regardless of the case of the letters.

Dealing with case-insensitive filenames/filesystems is a pain. With Go modules, it's very complicated too: in the download uri, uppercase letters are replaced with an exclamation mark followed by the letter's lowercase equivalent: github.com/BurntSushi → github.com/!burnt!sushi 😐

from panamax.

k3d3 avatar k3d3 commented on June 7, 2024

So it looks like in crates.io-index, all crate names are lowercase, but they have different casing in the names within the JSON. Additionally, as far as I can tell, there's no way to register a crate of the same name with differing case.

In that case (pun not intended), it should be just a matter of downloading every crate as lowercase, and modifying warp to lowercase all URLs.

As an aside, it's strange that {lowerprefix} exists, but not {lowercrate}.

from panamax.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.