stevieb9 / berrybrew

Perlbrew for Windows!
Other
63 stars 9 forks source link

error message when upgrading berrybrew "unable to unlink old 'bin/bbapi.dll' " #295

Closed itcharlie closed 2 years ago

itcharlie commented 3 years ago

`PS C:\WINDOWS\system32> berrybrew.exe upgrade

Error upgrading berrybrew:

From https://github.com/stevieb9/berrybrew ca22825..9f34ddd master -> origin/master

stevieb9 commented 3 years ago

Thanks for reporting. I'll have a look at this today. Revamping the old upgrade routine was on my roadmap anyways.

stevieb9 commented 3 years ago

Version upgrade is 1.33 -> 1.34 (per commit ids) in this instance. Should probably test going back to 1.29, then merge the fix and test it again in 1.35.

itcharlie commented 3 years ago

> berrybrew.exe version 1.33

stevieb9 commented 3 years ago

So this is a git issue, and the most likely cause is that either bbapi.dll was in use at the time and couldn't be removed (highly unlikely unless you had the UI open), or that your user doesn't have write access to the directory that bbapi.dll is in (repo_dir/bin).

Can you please let me know if the UI was open at the time, and if not, what your directory permissions look like?

If you do have the UI open and exiting it (right-click the system tray icon and exit) fixes the problem, I'll write a check for this in the Upgrade() method.

stevieb9 commented 3 years ago

I was wrong in my last comment. The reason is that berrybrew is using the bbapi.dll file while running berrybrew upgrade. Hmmm, I wonder how I got this to work before...

What you can do for now is do a simple git pull. However, if you've changed your config files in the data directory, be sure to back them up first.

stevieb9 commented 3 years ago

For developer information, to repro:

git clone https://github.com/stevieb9/berrybrew bb133
cd bb133
git checkout ca228251
git switch -c new_branch
git push -u origin new_branch
git branch --set-upstream-to=origin/master new_branch
bin\bb upgrade

Error upgrading berrybrew:

error: unable to unlink old 'bin/bbapi.dll': Invalid argument
itcharlie commented 3 years ago

Yes I had the berrybrew ui open at the time, but now I ran an upgrade and see the following:

`> berrybrew.exe upgrade

Error upgrading berrybrew:

From https://github.com/stevieb9/berrybrew 135a6fe..0a279df v1.35 -> origin/v1.35 error: Your local changes to the following files would be overwritten by merge: Changes Changes.md README.md bin/berrybrew-ui.exe dev/build.bat dev/build_api.bat dev/build_bb.bat dev/build_tests.bat dev/build_ui.bat dev/create_installer.nsi dev/release.pl doc/Berrybrew API.md doc/Create a Development Build.md doc/Create a Release.md doc/Unit Testing.md doc/berrybrew.md download/berrybrew.zip download/berrybrewInstaller.exe src/berrybrew-ui.cs src/berrybrew.cs t/03-options.t t/setup_test_env.bat Please commit your changes or stash them before you merge. error: The following untracked working tree files would be overwritten by merge: dev/build_installer.pl dev/create_build_installer.nsi Please move or remove them before you merge. Aborting`

maybe the upgrade function should perform a git clean then a git restore before performing an update merge.

After clearing up the git repo I still see the error while not having the berrybrew UI running.

Note I am running the commands via an administrative powershell

`> berrybrew.exe upgrade

Error upgrading berrybrew:

error: unable to unlink old 'bin/bbapi.dll': Invalid argument`

itcharlie commented 3 years ago

I forgot to do a:

git pull

before performing the upgrade.

> berrybrew.exe upgrade

Successfully upgraded berrybrew

it works now :)

stevieb9 commented 3 years ago

Awesome! Yeah, internally there is a git pull, but it does backup of configs first. By far the easiest and safest way to upgrade is by using the installer. It properly merges config data and the like, and is backwards compatible with all previous versions of the software (and git isn't required to be installed).