devonfw / ide

Tool to automate setup and update of development environment (esp. for Java projects).
Apache License 2.0
33 stars 102 forks source link

devon ide update scripts: previous version of devon scripts installed in home directory instead of latest ones. #1312

Open hohwille opened 11 months ago

hohwille commented 11 months ago

Expected behavior

After running devon ide update scripts, I do not only want to have my current IDE installation updated to the latest version (if an update is available) but also have the global scripts ~/.devon/devon and ~/scripts/devon.bat updated to the latest version.

Actual behavior

On windows the scripts of the previous release that I did run the devon ide update scripts on are installed in my home directory. In case I have a very old instance of devonfw-ide this can cause problems as I then get that very old devon scripts installed globally that could break all my newly updated installations.

Steps to reproduce (bug) / Use Case of feature request (enhancement)

  1. go to an old installation of devonfw-ide on a Windows machine
  2. run devon ide update scripts
  3. run devon -v

Related/Dependent Issues

Comments/Hints:

From #1032: I guess a general problem is that we are obviously running the "old" version of the devon script to trigger the update. On windows this is causing issues with file locks as windows is locking the script while it is running so it cannot replace itself. As a workaround we do that asynchronously. Therefore, we cannot invoke the "fix" synchronously in this case. The magic spots related to this can be found here: https://github.com/devonfw/ide/blob/70baf93ecffb8967f34be86c3ac6f4465b911af3/scripts/src/main/resources/scripts/functions#L834 https://github.com/devonfw/ide/blob/70baf93ecffb8967f34be86c3ac6f4465b911af3/scripts/src/main/resources/scripts/functions#L777-L779

Affected version:

hohwille commented 11 months ago

Maybe a solution to this would be to move the following update logic to a new function: https://github.com/devonfw/ide/blob/70baf93ecffb8967f34be86c3ac6f4465b911af3/scripts/src/main/resources/scripts/command/ide#L54-L60

Then we invoke it in the old place but only if we are not on windows. Additionally here we also need to invoke it then: https://github.com/devonfw/ide/blob/70baf93ecffb8967f34be86c3ac6f4465b911af3/scripts/src/main/resources/scripts/functions#L779