-
-
Notifications
You must be signed in to change notification settings - Fork 484
Closed
Labels
androidThe issue relates to Android mobile support.The issue relates to Android mobile support.bugA crash or error in behavior.A crash or error in behavior.good first issueIs this your first time contributing? This could be a good place to start!Is this your first time contributing? This could be a good place to start!windowsThe issue relates to Microsoft Windows support.The issue relates to Microsoft Windows support.
Description
Describe the bug
If you run briefcase upgrade while java is running, Briefcase crashes out.
❯ briefcase upgrade -vv
Using JDK at C:\Users\user\AppData\Local\BeeWare\briefcase\Cache\tools\java17
Using Android SDK at C:\Users\user\AppData\Local\BeeWare\briefcase\Cache\tools\android_sdk
[upgrade] Briefcase will upgrade the following tools:
- Android SDK (android_sdk)
- Java JDK (java)
- RCEdit (rcedit)
[android_sdk] Upgrading Android SDK...
>>> Running Command:
>>> 'C:\Users\user\AppData\Local\BeeWare\briefcase\Cache\tools\android_sdk\cmdline-tools\9.0\bin\sdkmanager.bat' --update
>>> Working Directory:
>>> C:\Users\user\github\beeware\briefcase\tmp\helloworld
>>> Environment Overrides:
>>> ANDROID_HOME=C:\Users\user\AppData\Local\BeeWare\briefcase\Cache\tools\android_sdk
>>> ANDROID_SDK_ROOT=C:\Users\user\AppData\Local\BeeWare\briefcase\Cache\tools\android_sdk
>>> JAVA_HOME=C:\Users\user\AppData\Local\BeeWare\briefcase\Cache\tools\java17
[=== ] 10% Computing updates...
No updates available
[=======================================] 100% Computing updates...
>>> Return code: 0
[java] Upgrading Java JDK...
Removing old JDK install...
Log saved to C:\Users\user\github\beeware\briefcase\tmp\helloworld\logs\briefcase.2023_11_01-14_06_04.upgrade.log
Traceback (most recent call last):
File "C:\Users\user\.pyenv\pyenv-win\versions\3.10.11\lib\runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\Users\user\.pyenv\pyenv-win\versions\3.10.11\lib\runpy.py", line 86, in _run_code
exec(code, run_globals)
File "C:\Users\user\github\beeware\briefcase\venv-3.10-briefcase\Scripts\briefcase.exe\__main__.py", line 7, in <module>
File "C:\Users\user\github\beeware\briefcase\src\briefcase\__main__.py", line 25, in main
command(**options)
File "C:\Users\user\github\beeware\briefcase\src\briefcase\commands\upgrade.py", line 114, in __call__
tool.upgrade()
File "C:\Users\user\github\beeware\briefcase\src\briefcase\integrations\base.py", line 137, in upgrade
self.uninstall()
File "C:\Users\user\github\beeware\briefcase\src\briefcase\integrations\java.py", line 319, in uninstall
self.tools.shutil.rmtree(self.java_home)
File "C:\Users\user\.pyenv\pyenv-win\versions\3.10.11\lib\shutil.py", line 750, in rmtree
return _rmtree_unsafe(path, onerror)
File "C:\Users\user\.pyenv\pyenv-win\versions\3.10.11\lib\shutil.py", line 615, in _rmtree_unsafe
_rmtree_unsafe(fullname, onerror)
File "C:\Users\user\.pyenv\pyenv-win\versions\3.10.11\lib\shutil.py", line 620, in _rmtree_unsafe
onerror(os.unlink, fullname, sys.exc_info())
File "C:\Users\user\.pyenv\pyenv-win\versions\3.10.11\lib\shutil.py", line 618, in _rmtree_unsafe
os.unlink(fullname)
PermissionError: [WinError 5] Access is denied: 'C:\\Users\\user\\AppData\\Local\\BeeWare\\briefcase\\Cache\\tools\\java17\\bin\\java.dll'
Steps to reproduce
- Run
briefcase build android - Run
briefcase upgrade
Expected behavior
The exception is caught and a more meaningful error is presented to the user.
Screenshots
No response
Environment
- Operating System: Windows 11
- Python version: 3.10.11
- Software versions:
- Briefcase:
0.3.17.dev44+g0b10614f
- Briefcase:
Logs
Log
Date/Time: 2023-11-01 14:06:05
Command line: C:\Users\user\github\beeware\briefcase\venv-3.10-briefcase\Scripts\briefcase upgrade -vv
OS Release: Windows 10
OS Version: 10.0.22621
Architecture: AMD64
Platform: Windows-10-10.0.22621-SP0
Python exe: C:\Users\user\github\beeware\briefcase\venv-3.10-briefcase\Scripts\python.exe
Python version: 3.10.11 (tags/v3.10.11:7d4cc5a, Apr 5 2023, 00:38:17) [MSC v.1929 64 bit (AMD64)]
Virtual env: True
Conda env: False
Briefcase: 0.3.17.dev44+g0b10614f
Target platform: windows
Target format: None
Environment Variables:
ALLUSERSPROFILE=C:\ProgramData
APPDATA=C:\Users\user\AppData\Roaming
COMMONPROGRAMFILES=C:\Program Files\Common Files
COMMONPROGRAMFILES(X86)=C:\Program Files (x86)\Common Files
COMMONPROGRAMW6432=C:\Program Files\Common Files
COMPUTERNAME=VM-WIN11
COMSPEC=C:\Windows\system32\cmd.exe
DRIVERDATA=C:\Windows\System32\Drivers\DriverData
HOMEDRIVE=C:
HOMEPATH=\Users\user
LOCALAPPDATA=C:\Users\user\AppData\Local
LOGONSERVER=\\VM-WIN11
NUMBER_OF_PROCESSORS=4
ONEDRIVE=C:\Users\user\OneDrive
OS=Windows_NT
PATH=C:\Users\user\github\beeware\briefcase\venv-3.10-briefcase\Scripts;C:\Program Files\PowerShell\7;C:\Users\user\.pyenv\pyenv-win\shims;C:\Users\user\.pyenv\pyenv-win\versions\3.9.13;C:\Users\user\.pyenv\pyenv-win\versions\3.8.10;C:\Users\user\.pyenv\pyenv-win\versions\3.10.11;C:\Users\user\.pyenv\pyenv-win\versions\3.11.3;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files\Git\cmd;;C:\Program Files\dotnet\;C:\Program Files\starship\bin\;C:\Program Files\Docker\Docker\resources\bin;C:\Program Files\PowerShell\7\;C:\Users\user\.pyenv\pyenv-win\bin;C:\Users\user\.pyenv\pyenv-win\shims;C:\Users\user\AppData\Local\Microsoft\WindowsApps;C:\Users\user\.dotnet\tools;C:\Users\user\.dotnet\tools;C:\Users\user\AppData\Local\Programs\Microsoft VS Code\bin
PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC;.CPL
POWERSHELL_DISTRIBUTION_CHANNEL=MSI:Windows 10 Pro
PROCESSOR_ARCHITECTURE=AMD64
PROCESSOR_IDENTIFIER=AMD64 Family 25 Model 33 Stepping 0, AuthenticAMD
PROCESSOR_LEVEL=25
PROCESSOR_REVISION=2100
PROGRAMDATA=C:\ProgramData
PROGRAMFILES=C:\Program Files
PROGRAMFILES(X86)=C:\Program Files (x86)
PROGRAMW6432=C:\Program Files
PSMODULEPATH=C:\Users\user\Documents\PowerShell\Modules;C:\Program Files\PowerShell\Modules;c:\program files\powershell\7\Modules;C:\Program Files\WindowsPowerShell\Modules;C:\Windows\system32\WindowsPowerShell\v1.0\Modules
PUBLIC=C:\Users\Public
PYENV=C:\Users\user\.pyenv\pyenv-win\
PYENV_HOME=C:\Users\user\.pyenv\pyenv-win\
PYENV_ROOT=C:\Users\user\.pyenv\pyenv-win\
SESSIONNAME=Console
STARSHIP_SESSION_KEY=********************
STARSHIP_SHELL=pwsh
SYSTEMDRIVE=C:
SYSTEMROOT=C:\Windows
TEMP=C:\Users\user\AppData\Local\Temp
TMP=C:\Users\user\AppData\Local\Temp
USERDOMAIN=vm-win11
USERDOMAIN_ROAMINGPROFILE=vm-win11
USERNAME=user
USERPROFILE=C:\Users\user
VIRTUAL_ENV=C:\Users\user\github\beeware\briefcase\venv-3.10-briefcase
VIRTUAL_ENV_DISABLE_PROMPT=1
WINDIR=C:\Windows
WSLENV=WT_SESSION:WT_PROFILE_ID:
WT_PROFILE_ID={574e775e-4f2a-5b96-ac1e-a2962a402336}
WT_SESSION=b34cf4e9-ae43-4a8a-9fa7-e6157e73aac3
_OLD_VIRTUAL_PATH=C:\Program Files\PowerShell\7;C:\Users\user\.pyenv\pyenv-win\shims;C:\Users\user\.pyenv\pyenv-win\versions\3.9.13;C:\Users\user\.pyenv\pyenv-win\versions\3.8.10;C:\Users\user\.pyenv\pyenv-win\versions\3.10.11;C:\Users\user\.pyenv\pyenv-win\versions\3.11.3;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files\Git\cmd;;C:\Program Files\dotnet\;C:\Program Files\starship\bin\;C:\Program Files\Docker\Docker\resources\bin;C:\Program Files\PowerShell\7\;C:\Users\user\.pyenv\pyenv-win\bin;C:\Users\user\.pyenv\pyenv-win\shims;C:\Users\user\AppData\Local\Microsoft\WindowsApps;C:\Users\user\.dotnet\tools;C:\Users\user\.dotnet\tools;C:\Users\user\AppData\Local\Programs\Microsoft VS Code\bin
Briefcase Log:
[14:06:03] Using JDK at C:\Users\user\AppData\Local\BeeWare\briefcase\Cache\tools\java17 java.py:261
Using Android SDK at C:\Users\user\AppData\Local\BeeWare\briefcase\Cache\tools\android_sdk android_sdk.py:364
upgrade.py:104
[upgrade] Briefcase will upgrade the following tools: upgrade.py:104
- Android SDK (android_sdk) upgrade.py:109
- Java JDK (java) upgrade.py:109
- RCEdit (rcedit) upgrade.py:109
upgrade.py:113
[android_sdk] Upgrading Android SDK... upgrade.py:113
subprocess.py:711
>>> Running Command: subprocess.py:711
>>> 'C:\Users\user\AppData\Local\BeeWare\briefcase\Cache\tools\android_sdk\cmdline-tools\9.0\bin\sdkmanager.bat' --update subprocess.py:711
>>> Working Directory: subprocess.py:711
>>> C:\Users\user\github\beeware\briefcase\tmp\helloworld subprocess.py:711
>>> Environment Overrides: subprocess.py:711
>>> ANDROID_HOME=C:\Users\user\AppData\Local\BeeWare\briefcase\Cache\tools\android_sdk subprocess.py:711
>>> ANDROID_SDK_ROOT=C:\Users\user\AppData\Local\BeeWare\briefcase\Cache\tools\android_sdk subprocess.py:711
>>> JAVA_HOME=C:\Users\user\AppData\Local\BeeWare\briefcase\Cache\tools\java17 subprocess.py:711
[14:06:04] >>> Return code: 0 subprocess.py:711
upgrade.py:113
[java] Upgrading Java JDK... upgrade.py:113
Removing old JDK install... java.py:315
Main thread traceback:
╭─────────────────────────────────────────────────────────────────────── Traceback (most recent call last) ────────────────────────────────────────────────────────────────────────╮
│ C:\Users\user\github\beeware\briefcase\src\briefcase\__main__.py:25 in main │
│ │
│ 22 │ │ command = Command(logger=logger, console=console) │
│ 23 │ │ options = command.parse_options(extra=extra_cmdline) │
│ 24 │ │ command.parse_config(Path.cwd() / "pyproject.toml") │
│ ❱ 25 │ │ command(**options) │
│ 26 │ except HelpText as e: │
│ 27 │ │ logger.info() │
│ 28 │ │ logger.info(str(e)) │
│ │
│ ╭───────────────────────────────────────── locals ─────────────────────────────────────────╮ │
│ │ command = <briefcase.commands.upgrade.UpgradeCommand object at 0x000002D701B8D600> │ │
│ │ Command = <class 'briefcase.commands.upgrade.UpgradeCommand'> │ │
│ │ console = <briefcase.console.Console object at 0x000002D77EFFC0A0> │ │
│ │ extra_cmdline = ['-vv'] │ │
│ │ logger = <briefcase.console.Log object at 0x000002D77F040B50> │ │
│ │ options = {'list_tools': False, 'tool_list': []} │ │
│ │ result = 0 │ │
│ ╰──────────────────────────────────────────────────────────────────────────────────────────╯ │
│ │
│ C:\Users\user\github\beeware\briefcase\src\briefcase\commands\upgrade.py:114 in __call__ │
│ │
│ 111 │ │ │ if not list_tools: │
│ 112 │ │ │ │ for tool in tools_to_upgrade: │
│ 113 │ │ │ │ │ self.logger.info(f"Upgrading {tool.full_name}...", prefix=tool.name) │
│ ❱ 114 │ │ │ │ │ tool.upgrade() │
│ 115 │ │ else: │
│ 116 │ │ │ self.logger.info("Briefcase is not managing any tools.") │
│ 117 │
│ │
│ ╭─────────────────────────────────────────────── locals ───────────────────────────────────────────────╮ │
│ │ list_tools = False │ │
│ │ options = {} │ │
│ │ self = <briefcase.commands.upgrade.UpgradeCommand object at 0x000002D701B8D600> │ │
│ │ tool = <briefcase.integrations.java.JDK object at 0x000002D77EB9CD00> │ │
│ │ tool_list = [] │ │
│ │ tools_to_upgrade = [ │ │
│ │ │ <briefcase.integrations.android_sdk.AndroidSDK object at 0x000002D702A53E80>, │ │
│ │ │ <briefcase.integrations.java.JDK object at 0x000002D77EB9CD00>, │ │
│ │ │ <briefcase.integrations.rcedit.RCEdit object at 0x000002D702A50DC0> │ │
│ │ ] │ │
│ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────╯ │
│ │
│ C:\Users\user\github\beeware\briefcase\src\briefcase\integrations\base.py:137 in upgrade │
│ │
│ 134 │ │ if self.managed_install: ╭─────────────────────────────── locals ────────────────────────────────╮ │
│ 135 │ │ │ if not self.exists(): │ self = <briefcase.integrations.java.JDK object at 0x000002D77EB9CD00> │ │
│ 136 │ │ │ │ raise MissingToolError(self.full_name) ╰───────────────────────────────────────────────────────────────────────╯ │
│ ❱ 137 │ │ │ self.uninstall() │
│ 138 │ │ │ self.install() │
│ 139 │ │ else: │
│ 140 │ │ │ raise NonManagedToolError(self.full_name) │
│ │
│ C:\Users\user\github\beeware\briefcase\src\briefcase\integrations\java.py:319 in uninstall │
│ │
│ 316 │ │ │ if self.tools.host_os == "Darwin": ╭─────────────────────────────── locals ────────────────────────────────╮ │
│ 317 │ │ │ │ self.tools.shutil.rmtree(self.java_home.parent.parent) │ self = <briefcase.integrations.java.JDK object at 0x000002D77EB9CD00> │ │
│ 318 │ │ │ else: ╰───────────────────────────────────────────────────────────────────────╯ │
│ ❱ 319 │ │ │ │ self.tools.shutil.rmtree(self.java_home) │
│ 320 │
│ │
│ C:\Users\user\.pyenv\pyenv-win\versions\3.10.11\lib\shutil.py:750 in rmtree │
│ │
│ 747 │ │ │ onerror(os.path.islink, path, sys.exc_info()) │
│ 748 │ │ │ # can't continue even if onerror hook returns │
│ 749 │ │ │ return │
│ ❱ 750 │ │ return _rmtree_unsafe(path, onerror) │
│ 751 │
│ 752 # Allow introspection of whether or not the hardening against symlink │
│ 753 # attacks is supported on the current platform │
│ │
│ ╭──────────────────────────────────────────── locals ─────────────────────────────────────────────╮ │
│ │ ignore_errors = False │ │
│ │ onerror = <function rmtree.<locals>.onerror at 0x000002D702B0B0A0> │ │
│ │ path = WindowsPath('C:/Users/user/AppData/Local/BeeWare/briefcase/Cache/tools/java17') │ │
│ ╰─────────────────────────────────────────────────────────────────────────────────────────────────╯ │
│ │
│ C:\Users\user\.pyenv\pyenv-win\versions\3.10.11\lib\shutil.py:615 in _rmtree_unsafe │
│ │
│ 612 │ │ │ except OSError: │
│ 613 │ │ │ │ onerror(os.path.islink, fullname, sys.exc_info()) │
│ 614 │ │ │ │ continue │
│ ❱ 615 │ │ │ _rmtree_unsafe(fullname, onerror) │
│ 616 │ │ else: │
│ 617 │ │ │ try: │
│ 618 │ │ │ │ os.unlink(fullname) │
│ │
│ ╭─────────────────────────────────────────── locals ────────────────────────────────────────────╮ │
│ │ entries = [ │ │
│ │ │ <DirEntry 'bin'>, │ │
│ │ │ <DirEntry 'conf'>, │ │
│ │ │ <DirEntry 'include'>, │ │
│ │ │ <DirEntry 'jmods'>, │ │
│ │ │ <DirEntry 'legal'>, │ │
│ │ │ <DirEntry 'lib'>, │ │
│ │ │ <DirEntry 'NOTICE'>, │ │
│ │ │ <DirEntry 'release'> │ │
│ │ ] │ │
│ │ entry = <DirEntry 'bin'> │ │
│ │ fullname = 'C:\\Users\\user\\AppData\\Local\\BeeWare\\briefcase\\Cache\\tools\\java17\\bin' │ │
│ │ onerror = <function rmtree.<locals>.onerror at 0x000002D702B0B0A0> │ │
│ │ path = WindowsPath('C:/Users/user/AppData/Local/BeeWare/briefcase/Cache/tools/java17') │ │
│ │ scandir_it = <nt.ScandirIterator object at 0x000002D7020F5E20> │ │
│ ╰───────────────────────────────────────────────────────────────────────────────────────────────╯ │
│ │
│ C:\Users\user\.pyenv\pyenv-win\versions\3.10.11\lib\shutil.py:620 in _rmtree_unsafe │
│ │
│ 617 │ │ │ try: │
│ 618 │ │ │ │ os.unlink(fullname) │
│ 619 │ │ │ except OSError: │
│ ❱ 620 │ │ │ │ onerror(os.unlink, fullname, sys.exc_info()) │
│ 621 │ try: │
│ 622 │ │ os.rmdir(path) │
│ 623 │ except OSError: │
│ │
│ ╭──────────────────────────────────────────────── locals ─────────────────────────────────────────────────╮ │
│ │ entries = [ │ │
│ │ │ <DirEntry 'api-ms-win-core-console-l1-1-0.dll'>, │ │
│ │ │ <DirEntry 'api-ms-win-core-datetime-l1-1-0.dll'>, │ │
│ │ │ <DirEntry 'api-ms-win-core-debug-l1-1-0.dll'>, │ │
│ │ │ <DirEntry 'api-ms-win-core-errorhandling-l1-1-0.dll'>, │ │
│ │ │ <DirEntry 'api-ms-win-core-file-l1-1-0.dll'>, │ │
│ │ │ <DirEntry 'api-ms-win-core-file-l1-2-0.dll'>, │ │
│ │ │ <DirEntry 'api-ms-win-core-file-l2-1-0.dll'>, │ │
│ │ │ <DirEntry 'api-ms-win-core-handle-l1-1-0.dll'>, │ │
│ │ │ <DirEntry 'api-ms-win-core-heap-l1-1-0.dll'>, │ │
│ │ │ <DirEntry 'api-ms-win-core-interlocked-l1-1-0.dll'>, │ │
│ │ │ ... +110 │ │
│ │ ] │ │
│ │ entry = <DirEntry 'java.dll'> │ │
│ │ fullname = 'C:\\Users\\user\\AppData\\Local\\BeeWare\\briefcase\\Cache\\tools\\java17\\bin\\java.dll' │ │
│ │ onerror = <function rmtree.<locals>.onerror at 0x000002D702B0B0A0> │ │
│ │ path = 'C:\\Users\\user\\AppData\\Local\\BeeWare\\briefcase\\Cache\\tools\\java17\\bin' │ │
│ │ scandir_it = <nt.ScandirIterator object at 0x000002D7020F6920> │ │
│ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────╯ │
│ │
│ C:\Users\user\.pyenv\pyenv-win\versions\3.10.11\lib\shutil.py:618 in _rmtree_unsafe │
│ │
│ 615 │ │ │ _rmtree_unsafe(fullname, onerror) │
│ 616 │ │ else: │
│ 617 │ │ │ try: │
│ ❱ 618 │ │ │ │ os.unlink(fullname) │
│ 619 │ │ │ except OSError: │
│ 620 │ │ │ │ onerror(os.unlink, fullname, sys.exc_info()) │
│ 621 │ try: │
│ │
│ ╭──────────────────────────────────────────────── locals ─────────────────────────────────────────────────╮ │
│ │ entries = [ │ │
│ │ │ <DirEntry 'api-ms-win-core-console-l1-1-0.dll'>, │ │
│ │ │ <DirEntry 'api-ms-win-core-datetime-l1-1-0.dll'>, │ │
│ │ │ <DirEntry 'api-ms-win-core-debug-l1-1-0.dll'>, │ │
│ │ │ <DirEntry 'api-ms-win-core-errorhandling-l1-1-0.dll'>, │ │
│ │ │ <DirEntry 'api-ms-win-core-file-l1-1-0.dll'>, │ │
│ │ │ <DirEntry 'api-ms-win-core-file-l1-2-0.dll'>, │ │
│ │ │ <DirEntry 'api-ms-win-core-file-l2-1-0.dll'>, │ │
│ │ │ <DirEntry 'api-ms-win-core-handle-l1-1-0.dll'>, │ │
│ │ │ <DirEntry 'api-ms-win-core-heap-l1-1-0.dll'>, │ │
│ │ │ <DirEntry 'api-ms-win-core-interlocked-l1-1-0.dll'>, │ │
│ │ │ ... +110 │ │
│ │ ] │ │
│ │ entry = <DirEntry 'java.dll'> │ │
│ │ fullname = 'C:\\Users\\user\\AppData\\Local\\BeeWare\\briefcase\\Cache\\tools\\java17\\bin\\java.dll' │ │
│ │ onerror = <function rmtree.<locals>.onerror at 0x000002D702B0B0A0> │ │
│ │ path = 'C:\\Users\\user\\AppData\\Local\\BeeWare\\briefcase\\Cache\\tools\\java17\\bin' │ │
│ │ scandir_it = <nt.ScandirIterator object at 0x000002D7020F6920> │ │
│ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────╯ │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
PermissionError: [WinError 5] Access is denied: 'C:\\Users\\user\\AppData\\Local\\BeeWare\\briefcase\\Cache\\tools\\java17\\bin\\java.dll'
Additional context
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
androidThe issue relates to Android mobile support.The issue relates to Android mobile support.bugA crash or error in behavior.A crash or error in behavior.good first issueIs this your first time contributing? This could be a good place to start!Is this your first time contributing? This could be a good place to start!windowsThe issue relates to Microsoft Windows support.The issue relates to Microsoft Windows support.