Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

extend alr printenv with Msys paths #1758

Open
RREE opened this issue Sep 12, 2024 · 5 comments
Open

extend alr printenv with Msys paths #1758

RREE opened this issue Sep 12, 2024 · 5 comments
Labels
type: feature New feature or request
Milestone

Comments

@RREE
Copy link

RREE commented Sep 12, 2024

Describe the bug
Currently alr printenv does not support output in the Msys path convention, i.e. in the form like /e/alire/gprbuild_22.0.1_c842bbc5/bin:/e/alire/gnat_arm_elf_14.2.1_2c52e01a/bin:... instead of the current form e:\alire\gprbuild_22.0.1_c842bbc5\bin;e:\alire\gnat_arm_elf_14.2.1_2c52e01a\bin;...

To Reproduce
run alr printenv --unix in a Msys2 environment (mingw/ucrt64)

Expected Behavior
alr printenv --msys should print

export PATH="/e//alire/gprbuild_22.0.1_c842bbc5/bin:/e/alire/gnat_arm_elf_14.2.1_2c52e01a/bin:..."

alr version

$ alr version
APPLICATION
alr version:               2.0.1
libalire version:          2.0.1
compilation date:          2024-03-21 11:09:31
compiled with version:     13.2.0

CONFIGURATION
settings folder:           C:\Users\Rolf\AppData\Local\alire\settings
cache folder:              e:\alire
vault folder:              e:\alire\releases
build folder:              e:\alire\builds
temp folder:               E:\msys64\tmp
force flag:                FALSE
non-interactive flag:      FALSE
community index branch:    stable-1.3.0
compatible index versions: ^1.1 & <=1.3.0
indexes folder:            C:\Users\Rolf\AppData\Local\alire\settings\indexes
indexes metadata:          OK
index #1:                  (community) git+https://github.com/alire-project/alire-index#stable-1.3.0
toolchain folder:          e:\alire
toolchain assistant:       disabled
tool #1 gnat:              gnat_native=14.2.1
tool #2 gprbuild:          gprbuild=22.0.1
system package manager:    E:\msys64\usr\bin\pacman.exe
distro detection disabled: FALSE

WORKSPACE
root status:               VALID
root release:              hello=0.1.0-dev
root load error:           none
root folder:               H:\Ada\rp2040\hello
current folder:            H:\Ada\rp2040\hello

SYSTEM
distribution:              MSYS2
host-arch:                 X86_64
os:                        WINDOWS
target:                    NATIVE
toolchain:                 USER
word-size:                 BITS_64
@mosteo
Copy link
Member

mosteo commented Sep 13, 2024

Besides the incongruence, does this cause problems? I thought Msys understood both formats.

@RREE
Copy link
Author

RREE commented Sep 13, 2024

Yes, it does create a problem. I cannot (easily) set my PATH including the alire crates.

After running eval $(alr printenv --unix) the environment variable PATH contains a value in the Windows format (';'-separator). The Msys2 shell (bash) expects a Unix format (':'-separator). I cannot start any command anymore.

$ uname -a
MINGW64_NT-10.0-19045 P5 3.5.3-d8b21b8c.x86_64 2024-07-09 18:03 UTC x86_64 Msys
$ alr printenv --unix
Warning: Unexpected folder in toolchain crates path: e:\alire\builds
Warning: Unexpected folder in toolchain crates path: e:\alire\releases
export ALIRE="True"
export ATOMIC_ALIRE_PREFIX="e:\alire\builds\atomic_0.5.0_14c344cc\86cf22cd32485d84b86791b195872d4d17
7e44b1d97e006eb515e2a39dedcfba"
export BBQUEUE_ALIRE_PREFIX="e:\alire\builds\bbqueue_0.3.2_5e5007cf\81341dc459063fa87e30ca20a54df8b8
fadac33e4130f2c1af48c8534630d9da"
export CORTEX_M_ALIRE_PREFIX="e:\alire\builds\cortex_m_0.5.0_39667d15\012728f65b63f441eaf09dac5c5528
d073f5a4e375d9f9b08313f5ec95c615bd"
export CPLUS_INCLUDE_PATH="E:\msys64\mingw64\include"
export C_INCLUDE_PATH="E:\msys64\mingw64\include"
export GNAT_ARM_ELF_ALIRE_PREFIX="e:\alire\gnat_arm_elf_14.2.1_2c52e01a"
export GPRBUILD_ALIRE_PREFIX="e:\alire\gprbuild_22.0.1_c842bbc5"
export GPR_PROJECT_PATH="H:\Ada\rp2040\hello;e:\alire\builds\atomic_0.5.0_14c344cc\86cf22cd32485d84b
86791b195872d4d177e44b1d97e006eb515e2a39dedcfba;e:\alire\builds\bbqueue_0.3.2_5e5007cf\81341dc459063
fa87e30ca20a54df8b8fadac33e4130f2c1af48c8534630d9da;e:\alire\builds\cortex_m_0.5.0_39667d15\012728f6
5b63f441eaf09dac5c5528d073f5a4e375d9f9b08313f5ec95c615bd;e:\alire\builds\hal_0.3.1_58bb6bd7\25664c9c
7cc8782def9c8693764aa19a9b4b73f0753bc58d3074debb1d8424ae;e:\alire\builds\pico_bsp_2.0.0_fb355059\693
4806f14fc610c36e3c3c545de54486545b8077206cd4ca8904f309042d768;e:\alire\builds\rp2040_hal_2.3.0_3ff0c
107\b9370c0de8f7bfcf0c9aec430c9caec8df99d68af885d710888aef9e322e67bc;e:\alire\builds\usb_embedded_0.
3.0_ed111b35\06eed8a502a536a6cddc44c061a86a450421f3287b866bba67e7ab442537973a"
export HAL_ALIRE_PREFIX="e:\alire\builds\hal_0.3.1_58bb6bd7\25664c9c7cc8782def9c8693764aa19a9b4b73f0
753bc58d3074debb1d8424ae"
export HELLO_ALIRE_PREFIX="H:\Ada\rp2040\hello"
export LIBRARY_PATH="E:\msys64\mingw64\lib"
export PATH="e:\alire\gprbuild_22.0.1_c842bbc5\bin;e:\alire\gnat_arm_elf_14.2.1_2c52e01a\bin;E:\msys
64\usr\bin;E:\msys64\usr\local\bin;C:\Program Files\Alire\bin;E:\msys64\ucrt64\bin;E:\msys64\usr\loc
al\bin;E:\msys64\usr\bin;E:\msys64\usr\bin;C:\Windows\System32;C:\Windows;C:\Windows\System32\Wbem;C
:\Windows\System32\WindowsPowerShell\v1.0\;E:\msys64\usr\bin\site_perl;E:\msys64\usr\bin\vendor_perl
;E:\msys64\usr\bin\core_perl;E:\msys64\mingw64\bin"
export PICO_BSP_ALIRE_PREFIX="e:\alire\builds\pico_bsp_2.0.0_fb355059\6934806f14fc610c36e3c3c545de54
486545b8077206cd4ca8904f309042d768"
export RP2040_HAL_ALIRE_PREFIX="e:\alire\builds\rp2040_hal_2.3.0_3ff0c107\b9370c0de8f7bfcf0c9aec430c
9caec8df99d68af885d710888aef9e322e67bc"
export USB_EMBEDDED_ALIRE_PREFIX="e:\alire\builds\usb_embedded_0.3.0_ed111b35\06eed8a502a536a6cddc44
c061a86a450421f3287b866bba67e7ab442537973a"

Despite the switch --unix the output is in Windows format. That is why I ask for a --msys2 option.

$ eval $(alr printenv --unix)
Warning: Unexpected folder in toolchain crates path: e:\alire\builds
Warning: Unexpected folder in toolchain crates path: e:\alire\releases

Rolf@P5 UCRT64 /h/Ada/rp2040/hello
$ echo $PATH
e:\alire\gprbuild_22.0.1_c842bbc5\bin;e:\alire\gnat_arm_elf_14.2.1_2c52e01a\bin;E:\msys64\usr\bin;E:\msys64\usr\local\bin;C:\Program Files\Alire\bin;E:\msys64\ucrt64\bin;E:\msys64\usr\local\bin;E:\msys64\usr\bin;E:\msys64\usr\bin;C:\Windows\System32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;E:\msys64\usr\bin\site_perl;E:\msys64\usr\bin\vendor_perl;E:\msys64\usr\bin\core_perl;E:\msys64\mingw64\bin

Rolf@P5 UCRT64 /h/Ada/rp2040/hello
$ alr
-bash: alr: command not found

Rolf@P5 UCRT64 /h/Ada/rp2040/hello
$ ls
-bash: ls: command not found

@mosteo
Copy link
Member

mosteo commented Sep 16, 2024

I see, thanks.

@mosteo mosteo added the type: feature New feature or request label Sep 16, 2024
@mosteo mosteo added this to the 2.x milestone Sep 16, 2024
@RREE
Copy link
Author

RREE commented Sep 16, 2024

I am not so sure anymore that it is a good idea. The environment variables of alr printenv are mostly read by Windows programs on a Windows PC. They probably expect Windows path conventions. It is only bash that expects PATH to be in Unix format. I can perhaps create a workaround with the help of cygpath.

But we still have the bug that --unix still prints in Windows format

@mosteo
Copy link
Member

mosteo commented Sep 17, 2024

Yes, it's as you say, --unix showing Windows-style paths is a bit strange. At the very least it should use forward slashes and colon separators.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: feature New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants