Skip to content

cockpit: fix subprocess invocation in frozen binaries#9331

Merged
ThomasWaldmann merged 1 commit intoborgbackup:masterfrom
ThomasWaldmann:fix-cockpit-commandline
Feb 14, 2026
Merged

cockpit: fix subprocess invocation in frozen binaries#9331
ThomasWaldmann merged 1 commit intoborgbackup:masterfrom
ThomasWaldmann:fix-cockpit-commandline

Conversation

@ThomasWaldmann
Copy link
Member

@ThomasWaldmann ThomasWaldmann commented Feb 14, 2026

When running as a Pyinstaller-made binary, sys.executable points to the borg binary itself. Invoking it with "-m borg" resulted in an incorrect command line (e.g., "borg -m borg ..."), which confused the argument parser in the subprocess.

This change checks sys.frozen to determine the correct invocation:

  • If frozen: [sys.executable, ...args]
  • If not frozen: [sys.executable, "-m", "borg", ...args]

Fixes #9277.

When running as a Pyinstaller-made binary, sys.executable points to the
borg binary itself. Invoking it with "-m borg" resulted in an incorrect
command line (e.g., "borg -m borg ..."), which confused the argument
parser in the subprocess.

This change checks sys.frozen to determine the correct invocation:
- If frozen: [sys.executable, ...args]
- If not frozen: [sys.executable, "-m", "borg", ...args]
@codecov
Copy link

codecov bot commented Feb 14, 2026

Codecov Report

❌ Patch coverage is 0% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 75.92%. Comparing base (94d56e1) to head (054194f).
⚠️ Report is 11 commits behind head on master.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
src/borg/cockpit/runner.py 0.00% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #9331      +/-   ##
==========================================
- Coverage   75.93%   75.92%   -0.02%     
==========================================
  Files          86       86              
  Lines       14780    14782       +2     
  Branches     2202     2203       +1     
==========================================
  Hits        11223    11223              
- Misses       2880     2882       +2     
  Partials      677      677              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ThomasWaldmann ThomasWaldmann merged commit 079aebb into borgbackup:master Feb 14, 2026
17 of 19 checks passed
@ThomasWaldmann ThomasWaldmann deleted the fix-cockpit-commandline branch February 14, 2026 21:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

borg2: pyinstaller cockpit argparsing confused

1 participant