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

Install location is invalid on Linux if the ChocolateyInstall environment variable is not set #2370

Closed
TheCakeIsNaOH opened this issue Sep 18, 2021 · 1 comment

Comments

@TheCakeIsNaOH
Copy link
Member

What You Are Seeing?

If the ChocolateyInstall environment variable is not set when running on Linux, choco cannot find it's install location.

What is Expected?

That choco can correctly find it's install location even if ChocolateyInstall is not set.

How Did You Get This To Happen? (Steps to Reproduce)

  1. Build the docker container, targetting the build stage: docker build -t mono-choco --target build -f docker/Dockerfile.linux .
  2. Run the docker container as normal
  3. cd /opt
  4. mono /usr/local/src/choco/code_drop/chocolatey/console/choco.exe
  5. See that it is looking for the lib directory at C:/ProgramData/Chocolatey/lib instead of at /usr/local/src/choco/code_drop/chocolatey/console/lib
  6. export ChocolateyInstall=/usr/local/src/choco/code_drop/chocolatey/console
  7. Run mono /usr/local/src/choco/code_drop/chocolatey/console/choco.exe again
  8. See that now it is looking for /usr/local/src/choco/code_drop/chocolatey/console/lib, which is correct.

Output Log

Full Log Output without ChocolateyInstall

Chocolatey v0.11.1-15-g9318424b
Chocolatey is running on Linux v 5.10.0.0
Attempting to delete file "/usr/local/src/choco/code_drop/chocolatey/console/chocolatey.dll.old".
Attempting to delete file "/usr/local/src/choco/code_drop/chocolatey/console/choco.exe.old".
Command line: /usr/local/src/choco/code_drop/chocolatey/console/choco.exe --verbose --debug
Received arguments: --verbose --debug
RemovePendingPackagesTask is now ready and waiting for PreRunMessage.
Sending message 'PreRunMessage' out if there are subscribers...
[Pending] Removing all pending packages that should not be considered installed...
Directory 'C:/ProgramData/Chocolatey/lib' does not exist.
Sending message 'PostRunMessage' out if there are subscribers...
Not able to cleanup NuGet temp folders. Failure was Path to combine cannot be empty. Tried to combine null with ''. Method called from 'delete_directory'
Exiting with 1

Full Log Output with ChocolateyInstall

Chocolatey v0.11.1-15-g9318424b
Chocolatey is running on Linux v 5.10.0.0
Attempting to delete file "/usr/local/src/choco/code_drop/chocolatey/console/chocolatey.dll.old".
Attempting to delete file "/usr/local/src/choco/code_drop/chocolatey/console/choco.exe.old".
Attempting to create directory "/usr/local/src/choco/code_drop/chocolatey/console/helpers".
Attempting to create directory "/usr/local/src/choco/code_drop/chocolatey/console/helpers/functions".
Attempting to create directory "/usr/local/src/choco/code_drop/chocolatey/console/redirects".
Attempting to create directory "/usr/local/src/choco/code_drop/chocolatey/console/tools".
Command line: /usr/local/src/choco/code_drop/chocolatey/console/choco.exe --verbose --debug
Received arguments: --verbose --debug
RemovePendingPackagesTask is now ready and waiting for PreRunMessage.
Sending message 'PreRunMessage' out if there are subscribers...
[Pending] Removing all pending packages that should not be considered installed...
Directory '/usr/local/src/choco/code_drop/chocolatey/console/lib' does not exist.
Sending message 'PostRunMessage' out if there are subscribers...
Not able to cleanup NuGet temp folders. Failure was Path to combine cannot be empty. Tried to combine null with ''. Method called from 'delete_directory'
Exiting with `1`

@TheCakeIsNaOH
Copy link
Member Author

This appears to be caused by the front slash being trimmed off in application parameters:
#2025 (comment)

TheCakeIsNaOH added a commit to TheCakeIsNaOH/choco that referenced this issue Sep 18, 2021
Prevents the absolute path from being converted to a
relative path by the removal of the first forward slash.
Applicable to non-windows platforms, leaves Windows alone.

Allows choco to find it's install location without requiring
the ChocolateyInstall environment variable.

Co-Authored-By: Kim J. Nordmo <1474648+AdmiringWorm@users.noreply.github.com>
@gep13 gep13 added this to the vNext milestone Sep 19, 2021
gep13 pushed a commit to TheCakeIsNaOH/choco that referenced this issue Sep 19, 2021
Prevents the absolute path from being converted to a
relative path by the removal of the first forward slash.
Applicable to non-windows platforms, leaves Windows alone.

Allows choco to find it's install location without requiring
the ChocolateyInstall environment variable.

Co-Authored-By: Kim J. Nordmo <1474648+AdmiringWorm@users.noreply.github.com>
gep13 added a commit that referenced this issue Sep 19, 2021
(#2369 #2370) Do not trim forward slashs prefixes on Linux
@gep13 gep13 added 4 - Done and removed 3 - Review labels Sep 19, 2021
@gep13 gep13 closed this as completed Sep 19, 2021
gep13 pushed a commit that referenced this issue Sep 21, 2021
Prevents the absolute path from being converted to a
relative path by the removal of the first forward slash.
Applicable to non-windows platforms, leaves Windows alone.

Allows choco to find it's install location without requiring
the ChocolateyInstall environment variable.

Co-Authored-By: Kim J. Nordmo <1474648+AdmiringWorm@users.noreply.github.com>
TheCakeIsNaOH added a commit to TheCakeIsNaOH/choco that referenced this issue Sep 22, 2021
Prevents the absolute path from being converted to a
relative path by the removal of the first forward slash.
Applicable to non-windows platforms, leaves Windows alone.

Allows choco to find it's install location without requiring
the ChocolateyInstall environment variable.

Co-Authored-By: Kim J. Nordmo <1474648+AdmiringWorm@users.noreply.github.com>
@gep13 gep13 changed the title Install location is not gotten correctly on Linux if ChocolateyInstall is not set Install location is invalid on Linux if the ChocolateyInstall environment variable is not set Jan 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants