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

journalctl3.py path resolve issues #151

Open
jimbobmcgee opened this issue Oct 6, 2022 · 1 comment
Open

journalctl3.py path resolve issues #151

jimbobmcgee opened this issue Oct 6, 2022 · 1 comment

Comments

@jimbobmcgee
Copy link

Similar to issue #118, if one installs systemctl3.py and journalctl3.py to, for example, /opt/systemd-alt and then symlinks them to the usual /bin (or /usr/bin) locations, journalctl3.py will complain because it cannot find systemctl3.py.

Consider...

lrwxrwxrwx 1 root root 48 Oct  6 03:54 /bin/journalctl -> /opt/systemd-alt/journalctl3.py
lrwxrwxrwx 1 root root 47 Oct  6 03:21 /bin/systemctl -> /opt/systemd-alt/systemctl3.py

In #118, it complains if systemctl3.py has not been saved as systemctl3.py, because of:

systemctl_py = "systemctl3.py"

In this case, however, it complains if journalctl is a symlink, because of:

path = os.path.dirname(sys.argv[0])

In the above example, os.path.dirname(sys.argv[0]) resolves to /usr/bin/systemctl3.py, which isn't the correct location.

I think this can be resolved by altering #L19 to:

path = os.path.dirname(os.path.realpath(sys.argv[0]))

...but, as I am not a Python guy by trade, I do not know if there may be a more-reliable way to resolve the systemctl script from the within the journalctl script (besides maybe an array of 'reasonable' locations)...?

If the above is sane enough, perhaps it can be patched in a future release?

@franknipoz412
Copy link

Thanks for sharing this issue. It seems like there might be a compatibility problem between the installed version of systemctl3.py and journalctl3.py. Have you considered using the Windsor Replacement for systemctl and journalctl instead? It might resolve the issue you are facing and provide a more reliable solution."

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

No branches or pull requests

2 participants