Open jordwalke opened 7 years ago
Just posting some insights from @andreypopp :
"But we can also move artifacts from the global cache's _install directory
to the local project's _install directory!"
> That may be fragile. You need to account for null byte.
> Currently the only replace happens from _inttmp to _install (same length path).
Not sure how this going to work with different length path
(you don't want to corrupt binaries!)(edited)
> If len(src) > len(repl) you can just leave padding but what if it's the otherwise?
I was thinking that we could ensure that the store was something like:
~/.esy/store/_install__________________________really_long -> ~/.esy/store/_install
~/.esy/store/_insttmp__________________________really_long -> ~/.esy/store/_instmp
~/.esy/store/_install
~/.esy/store/_insttmp
Where we always build into the really long directories, and only provide short versions as symlinks for convenience. Then we know that we can relocate to any destination, but ensuring that we create the padded length at the destination site. For example, perhaps you might end up relocating artifacts from the cache to:
└── node_modules/
└── myDep/
├── _install/ -> ./_install_____just_enough_padding___/
└── _install_____just_enough_padding___/
└── bin/app.exe
Also, we only even need to pad like this when we detect that a relocation was even necessary. If no string replace occurred, then no funny directory padding needs to take place.
Another way to smooth this process out, is if you detect up front whether or not the paths will provide enough padding, and then do not use the cache at all when:
I imagine we can incrementally work our way to the ideal workflow, even if as a first step we just refuse to build or something.
Clarifying some requirements:
x
length, as long as there's a clear error message that says why a particular artifact can't be relocated, and as long as that error occurs if some artifact even had to be relocated in the first place.Downgrading to mid-pri, not because it's not important but because:
Still important, but just slightly behind all the other stuff marked HIGH pri.
Now that @IwanKaramazow has an example of a fast C string replacement implementation, we can more quickly relocate artifacts that could include paths in them. Right now we use
python
, and that has some issues:Currently, we only rewrite artifacts to achieve atomicity - moving from a holding cell where we perform the build
_insttmp
to_install
- in order to make sure that binaries don't include paths from the global cache's_insttmp
directory, to the global cache's_install
directory (but only on success).But we can also move artifacts from the global cache's
_install
directory to the local project's_install
directory! This has many benefits: