Disable msys mangling in sgx-lkl-docker, when detected #69
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi there - first off, thanks for a great solution for TEE development. This project is great! 🎉
In using this locally, I've found a few issues when running using docker+win10 in non-WSL bash environments (specific msys, via git-for-windows) This PR resolves those issues, by controlling how msys-like environments (and only these) handle path mangling, and informing them to simply not do this. With mangling disabled, paths resolve correctly, and msys doesn't mess with things unnecessarily.
For me, these few lines are the difference between this project working out of the box, and requiring some fiddling, so I thought I'd try and see if you folks were open to landing a quality of life fix like this. 🙏
Background Details 📝
By default, these msys environments try to help the user, by converting things like
/bin/bash
toC:/Program Files/Git/usr/bin/bash
. It's quite smart about when to do this, but you can see it occur with the following example:This is because
docker
expands todocker.exe
(as we don't have docker in msys, only in the windows host itself) and msys detects this difference, and tries to help. It assumes that if we're calling anexe
and giving a path to something that is also technically anexe
(in this case,/bin/bash
, since it knows that locally/bin/bash
is actuallyC:/Program Files/Git/usr/bin/bash.exe
) we want to pass the path to theexe
, rather than the actual given literal path. So it applies this transformation for us, and when docker runs it gets theexe
path, not the/bin/bash
literal.This fails to execute inside the docker environment, as there is no
C:/Program Files/Git/usr/bin/bash.exe
, there is only/bin/bash
.One workaround is to replace all instances of
/bin/bash
with//bin/bash
, which prevents this msys behavior and should not cause issues in most linux distros it seems, as that first/
is ignored. This however, would be a much more significant change.The proposed workaround here, is to simply set the flag that msys uses to determine if it should execute this behavior such that it's informed not to. This looks like
MSYS_NO_PATHCONV=1
.