Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BiT system tray icon process may use wrong config file and share path due to missing --config and --share-path arguments #1405

Open
aryoda opened this issue Feb 7, 2023 · 3 comments
Assignees
Labels
Bug HELP-WANTED Used by 24pullrequests.com to suggest issues Infrastructure Low relevant, but not urgent Notifications desktop, email, GUI/tray status messages

Comments

@aryoda
Copy link
Contributor

aryoda commented Feb 7, 2023

Observation

Backintime CLI allows

  • to pass the path to a backup config file via the --config argument
  • and to pass the location of the lock and status files via the --share-path argument:

#define config argument
configArgsParser = argparse.ArgumentParser(add_help = False)
configArgsParser.add_argument('--config',
metavar = 'PATH',
type = str,
action = 'store',
help = 'Read config from %(metavar)s. ' +
'Default = ~/.config/backintime/config')
configArgsParser.add_argument('--share-path',
metavar = 'PATH',
type = str,
action = 'store',
help = 'Write runtime data (locks, messages, log and mountpoints) to %(metavar)s.')

If the system tray icon plugin is installed the values of the --config and --share-path arguments are not passed to newly spawned system tray icon process:

path = os.path.join(tools.backintimePath('qt'), 'qtsystrayicon.py')
self.process = subprocess.Popen([sys.executable, path, self.snapshots.config.currentProfile()])

Impact

  • The system tray icon may not be shown at all since no lock file is found (which indicates a running backup job)
  • Unit tests do not show the system tray icon or do show the wrong progress status if a backup job is running for the already installed BiT. E.g. this unit test:
    # execute backup and verify output
    proc = subprocess.Popen(["./backintime",
    "--config", "test/config",
    "--share-path", self.sharePath,
    "backup"],
    stdout=subprocess.PIPE,
    stderr=subprocess.PIPE)

Expected Behavior

  • Pass the --config and --share-path arguments from backintime to the system tray icon process
  • The system tray icon process must parse and use the values if the arguments are passed
@aryoda aryoda added Bug Low relevant, but not urgent Testing Notifications desktop, email, GUI/tray status messages labels Feb 7, 2023
@aryoda
Copy link
Contributor Author

aryoda commented Feb 7, 2023

Could be fixed together with the master issue #1306 or separately...

@aryoda aryoda self-assigned this Feb 7, 2023
@aryoda
Copy link
Contributor Author

aryoda commented Mar 5, 2023

There are also other code locations that ignore the --config argument, mainly everything that directly or indirectly spawns a sub process passing a config id is under suspicion, e.g.:

  • env = os.environ.copy()
    env['SSH_ASKPASS'] = 'backintime-askpass'
    env['ASKPASS_PROFILE_ID'] = self.profile_id
    env['ASKPASS_MODE'] = self.mode

@buhtz buhtz added this to the 1.3.5 / 1.4.0 milestone Mar 19, 2023
@buhtz
Copy link
Member

buhtz commented Jul 6, 2023

Just an idea without knowing the details. But if it is possible it would be the cleanest if systrayicon.py never touch the the config file. Maybe all needed config values should be handed over via arguments. Don't know how much arguments that have to be.

@buhtz buhtz added the HELP-WANTED Used by 24pullrequests.com to suggest issues label Jun 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug HELP-WANTED Used by 24pullrequests.com to suggest issues Infrastructure Low relevant, but not urgent Notifications desktop, email, GUI/tray status messages
Projects
None yet
Development

No branches or pull requests

2 participants