Skip to content

Commit

Permalink
fix pyinstaller detection for dir-mode, fixes borgbackup#5897
Browse files Browse the repository at this point in the history
"running under pyinstaller" detection is now as recommended by the pyinstaller docs.
  • Loading branch information
ThomasWaldmann committed Jul 10, 2021
1 parent 17f5c13 commit d94d8e0
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/borg/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -2445,10 +2445,9 @@ def prepare_subprocess_env(system, env=None):
# in the original env (in this case, the pyinstaller bootloader
# does *not* put ..._ORIG into the env either).
# in this case, we must kill LDLP.
# The directory used by pyinstaller is created by mkdtemp("_MEIXXXXXX"),
# we can use that to differentiate between the cases.
# We can recognize this via sys.frozen and sys._MEIPASS being set.
lp = env.get(lp_key)
if lp is not None and re.search(r'/_MEI......', lp):
if lp is not None and getattr(sys, 'frozen', False) and hasattr(sys, '_MEIPASS'):
env.pop(lp_key)
# security: do not give secrets to subprocess
env.pop('BORG_PASSPHRASE', None)
Expand Down

0 comments on commit d94d8e0

Please sign in to comment.