FS#49840 - [urlwatch] Badly set up directories

Attached to Project: Community Packages
Opened by felix (fstirlitz) - Saturday, 25 June 2016, 10:55 GMT
Last edited by Balló György (City-busz) - Tuesday, 05 July 2016, 18:47 GMT
Task Type Bug Report
Category Upstream Bugs
Status Closed
Assigned To Balló György (City-busz)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

$ urlwatch --edit-hooks
Parsing failed:
======
[Errno 2] No such file or directory: '/usr/sbin/share/urlwatch/examples/hooks.py.example'
======

This task depends upon

Closed by  Balló György (City-busz)
Tuesday, 05 July 2016, 18:47 GMT
Reason for closing:  Upstream
Comment by Balló György (City-busz) - Monday, 27 June 2016, 19:17 GMT
I don't know how did you get this, because it works for me. Maybe you created a symlink from /usr/bin to /usr/sbin on your system?
Comment by felix (fstirlitz) - Wednesday, 29 June 2016, 19:18 GMT
$ ls -ld /usr/bin /usr/sbin
drwxr-xr-x 6 root root 180224 29 jun 18:00 /usr/bin
lrwxrwxrwx 1 root root 3 30 sep 2015 /usr/sbin -> bin
Comment by felix (fstirlitz) - Thursday, 30 June 2016, 06:25 GMT
I think I found it.

$ sed -ne '56,70p' /usr/bin/urlwatch
# Check if we are installed in the system already
(prefix, bindir) = os.path.split(os.path.dirname(os.path.abspath(sys.argv[0])))

if bindir == 'bin':
# Installed system-wide
examples_dir = os.path.join(prefix, 'share', pkgname, 'examples')
else:
# Assume we are not yet installed
sys.path.insert(0, os.path.join(prefix, bindir, 'lib'))
examples_dir = os.path.join(prefix, bindir, 'share', pkgname, 'examples')

urls_yaml_example = os.path.join(examples_dir, 'urls.yaml.example')
hooks_py_example = os.path.join(examples_dir, 'hooks.py.example')

$ echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin
$ ls -ld /usr/bin /usr/sbin
drwxr-xr-x 6 root root 180224 29 jun 18:00 /usr/bin
lrwxrwxrwx 1 root root 3 30 sep 2015 /usr/sbin -> bin
$

And so urlwatch discovers itself at /usr/sbin/urlwatch, which it fails to detect as a system directory.

The solution is to hardcode assuming system-wide installation, since my PATH is my own business.
Comment by Doug Newgard (Scimmia) - Thursday, 30 June 2016, 06:44 GMT
It's your own business, but if it's nonsense and that's what's causing the issue, that's your business as well.
Comment by felix (fstirlitz) - Thursday, 30 June 2016, 06:47 GMT
It's a perfectly sensible setting. What is nonsense is a package checking at runtime whether is installed system-wide, when it always is.
Comment by Doug Newgard (Scimmia) - Thursday, 30 June 2016, 06:51 GMT
No, having /usr/sbin in path is certainly not sensible and is non-standard.
Comment by Balló György (City-busz) - Thursday, 30 June 2016, 08:38 GMT
You can ask upstream developers to accept /usr/sbin as well when it checks if it's installed in the system:
https://github.com/thp/urlwatch/issues

Loading...