CRaC / criu

Other
28 stars 10 forks source link

WSL: unquoted $PATH value breaks under WSL #17

Open nbuwe opened 5 months ago

nbuwe commented 5 months ago

https://github.com/CRaC/criu/blob/daeef8f9dd173363ca077c18c803478d468fcdf2/Makefile#L252

Under WSL PATH may contain Windows directories with spaces in their names. Windows apps installed under C:\Program Files that add themselves to the Windows PATH has their entries visible/inherited on the Linux side as /mnt/c/Program Files/... entries in the Linux PATH.

The value of PATH passed to the env command should be quoted.

wkia commented 5 months ago

Hi @nbuwe, Thank you for reporting the issue. Actually criu is not intended to be built on WSL, so you may want to use a Linux container. May I ask why are you trying to build on WSL?

nbuwe commented 5 months ago

I may be mistaken, but WSL2 is a Linux container, isn't it? As far as I understand it uses a real Linux kernel (microsoft/WSL2-Linux-Kernel) and individual WSL guests are run as containers under the main Linux instance that runs microsoft/azurelinux internally.

wkia commented 5 months ago

Sorry for miscommunication, I meant docker Linux container of course, that you may want to use building criu. However, I'm wondering why are you trying to build criu on WSL. Is there a rational reason or a special use case? It'd be great if you share your scenarios for better understanding.

nbuwe commented 5 months ago

I'm not sure how familiar with WSL are you. If not - just think s/on WSL/under docker/. It's just a way to run almost any linux distro of your choice.

I'm not trying to "build criu on WSL", I'm just trying to "build criu". The "on WSL" part is tangential (it could have been "build criu under Ubuntu 22 under VirtualBox", "build criu on Alpine inside docker" and many other things). I just happened to be on WSL in that particular moment in time, b/c for $reasons I was traveling with the windows laptop, not the linux laptop, and not the macbook (where I can use VirtualBox). It's a red herring. Any environment that happens to have a directory with a space in its name in PATH will run into this problem. It just happens that in most linux environments that is not the case by convention, and under WSL it's very likely to be the case, that's all.

I don't really want the trivial quoting bug to diverge into a philosophical discussion of relative merits of dockerized builds vs. free-ranging builds.

rvansa commented 5 months ago

Here I agree with @nbuwe , despite spaces in path being evil. I've also cloned CRIU into /tmp/foo bar (with space) and I can't build from there either.