prefix-dev / pixi

Package management made easy
https://pixi.sh
BSD 3-Clause "New" or "Revised" License
3.05k stars 169 forks source link

Pixi fails to handle paths with Unicode characters #1836

Open morags opened 1 month ago

morags commented 1 month ago

Checks

Reproducible example

Trying to run pixi shell on Windows 10 with a system path that contains non-ASCII characters produces the following errors:

At C:\Users\<username>\AppData\Local\Temp\.tmpNHOubZ.ps1:15 char:665
+ ... te;C:\Users\<gibberrish>\.cargo\bin;E:\<gibberrish>\<gibberrish>\Go\bin;D:\LLVM ...
+                                                           ~~~~~~~
Unexpected token '\Go\bin' in expression or statement.
At C:\Users\<username>\AppData\Local\Temp\.tmpNHOubZ.ps1:16 char:33
+ ${Env:PIXI_ENVIRONMENT_NAME} = "default"
+                                 ~~~~~~~~
Unexpected token 'default"
${Env:CONDA_PREFIX} = "E:\pixi-test\english\.pixi\envs\default"
$old_prompt = $function:prompt
function prompt {"' in expression or statement.
At C:\Users\<username>\AppData\Local\Temp\.tmpNHOubZ.ps1:19 char:52
+ function prompt {"(english) $($old_prompt.Invoke())"}
+                                                    ~~
The string is missing the terminator: ".
    + CategoryInfo          : ParserError: (:) [], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : UnexpectedToken

(Where the bits in angle brackets are placeholders for the actual values)

Running from within a project whose path contains non-ASCII characters produces, in addition, the following errors:

At C:\Users\<username>\AppData\Local\Temp\.tmpLUa9rb.ps1:6 char:24
+ ... ERT_DIR} = "E:\pixi-test\<gibberrish>\.pixi\envs\default\Library\ssl\ce ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Unexpected token 'E:\pixi-test\<gibberrish>\.pixi\envs\default\Library\ssl\certs"
${Env:PIXI_PROJECT_ROOT} = "E:\pixi-test\<gibberrish>"
${Env:__CONDA_OPENSSL_CERT_FILE_SET} = "1"
${Env:PIXI_PROJECT_NAME} = "<gibberrish>"
${Env:PIXI_ENVIRONMENT_NAME} = "default"
${Env:PIXI_EXE} = "C:\Users\<gibberish>\AppData\Local\pixi\bin\pixi.exe"
${Env:PIXI_IN_SHELL} = "1"
${Env:PIXI_ENVIRONMENT_PLATFORMS} = "win-64"
${Env:CONDA_PREFIX} = "E:\pixi-test\<gibberrish>\.pixi\envs\default"
${Env:SSL_CERT_FILE} = "E:\pixi-test\<gibberrish>\.pixi\envs\default\Library\ssl\cacert.pem"
${Env:__CONDA_OPENSSL_CERT_DIR_SET} = "1"
${Env:PIXI_PROJECT_VERSION} = "0.1.0"
$old_prompt = $function:prompt
function prompt {"' in expression or statement.
At C:\Users\<username>\AppData\Local\Temp\.tmpLUa9rb.ps1:19 char:23
+ function prompt {"(<gibberrish>) $($old_prompt.Invoke())"}
+                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The string is missing the terminator: '.
At C:\Users\<username>\AppData\Local\Temp\.tmpLUa9rb.ps1:19 char:57
+ function prompt {"(<gibberrish>) $($old_prompt.Invoke())"}
+                                                         ~
Missing closing ')' in expression.
    + CategoryInfo          : ParserError: (:) [], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : UnexpectedToken

Issue description

Trying to run pixi shell on a Windows 10 system where either the system path or project path contain non-ASCII characters results in errors.

Also see #1362.

Expected behavior

Pixi should activate the environment without error.

baszalmstra commented 1 month ago

Would you happen to have the symbols that you think cause this issue so I can reproduce this locally?

morags commented 1 month ago

Probably any permissible non-ASCII character. Try the following: français, עברית, 日本語.

ruben-arts commented 1 month ago

Side note, this works on linux :+1: