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

Windows: devon command line sets wrong environment variables (with tilde symbol) #433

Closed
yoktobit opened this issue Jul 23, 2020 · 3 comments · Fixed by #434
Closed

Windows: devon command line sets wrong environment variables (with tilde symbol) #433

yoktobit opened this issue Jul 23, 2020 · 3 comments · Fixed by #434
Labels
blocker severe bug that blocks users in their daily work and has to be fixed asap bug Something isn't working scripts related to shell scripts (bash and CMD) windows specific for Microsoft Windows OS

Comments

@yoktobit
Copy link

Expected behavior

Running the devon command line by calling it from the windows explorer context menu or by calling "devon" in any other command line, I would expect devon to set the environment variables for M2_REPO, MAVEN_HOME, MAVEN_OPTS and JAVA_HOME.

Actual behavior

The command sets the variables M2_REPO~, MAVEN_HOME~, MAVEN_OPTS~ and JAVA_HOME~
This leads to a lot of other errors like checking out the repo to a wrong folder or accessing wrong remote repos with wrong credentials.

Steps to reproduce (bug)

  1. update to latest devon
  2. open command line in some workspace
  3. run devon command
  4. run set
  5. see how environment variables are set wrong

Related/Dependent Issues

#395
#430

Comments/Hints:

By undoing #430 I could solve it temporarily (I have no whitespaces in my project folders).

Affected version:

2020.04.003

  • OS: Windows 10
@yoktobit yoktobit added the bug Something isn't working label Jul 23, 2020
@markusschuh
Copy link
Member

Good catch!
#430 includes a typo in line 91 of environment-project.bat

The line should be

set "replacement=%~2%="

which would remove any surrounding quotes. But the current script line

set "replacement=%2~%="

adds a "~" instead, what is the issue.

N,B.: This issue is a good example, why my enhancement proposal #261 for a simple DEVONFW_IDE_TRACE hook should be integrated into the scripts of devonfw-ide.

With that in place (I had to re-add it into my local - just updated - devonfw-ide again) I could identify the root cause of this issue by a few simple enough steps:

  1. set DEVONFW_IDE_TRACE=yes
  2. execute devon
  3. locate the first appearance of M2_REPO~ in the trace output ( => line 91)
  4. understand the code - and such identify the error
  5. set DEVONFW_IDE_TRACE=

@hohwille hohwille added blocker severe bug that blocks users in their daily work and has to be fixed asap bug Something isn't working and removed bug Something isn't working labels Jul 27, 2020
@hohwille hohwille added this to the release:2020.04.004 milestone Jul 27, 2020
@hohwille
Copy link
Member

@yoktobit thanks for reporting this issue.
@markusschuh thanks for your investigation.
I am quite confused how this severe bug was neither detected by me nor be the two core-team members that claimed to have tested PR #430
However, murphies law is with us of course and Windows CMD is one of the most confusing and error-prone lang so lets look ahead and get this fixed asap.

@hohwille
Copy link
Member

As you can see, I have created PR #434 with the fix as proposed by @markusschuh
Any feedback/review would be appreciated.
There is another bug with variable values containing whitespaces in bash that I will also need to fix. Then I will create another release asap to get these fixes out.

hohwille added a commit that referenced this issue Jul 27, 2020
prevent tilde symbol in variable name when export is used
@hohwille hohwille changed the title Windows 10: devon command line sets wrong environment variables (with tilde symbol) Windows: devon command line sets wrong environment variables (with tilde symbol) Jul 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocker severe bug that blocks users in their daily work and has to be fixed asap bug Something isn't working scripts related to shell scripts (bash and CMD) windows specific for Microsoft Windows OS
Projects
None yet
3 participants