Bug 168968 - External programs for notifications are not executed when absolute path is given
Summary: External programs for notifications are not executed when absolute path is given
Status: RESOLVED FIXED
Alias: None
Product: kdelibs
Classification: Frameworks and Libraries
Component: knotify (show other bugs)
Version: 4.1
Platform: unspecified Linux
: NOR normal
Target Milestone: ---
Assignee: kdelibs bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-08-12 12:19 UTC by Tomasz Jach
Modified: 2009-02-05 01:46 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Allows KNotify to run programs stored in the rc file as a URL. (638 bytes, patch)
2008-08-16 23:54 UTC, Michael Pyne
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Tomasz Jach 2008-08-12 12:19:07 UTC
Version:            (using KDE 4.1.0)
Installed from:    Unlisted Binary Package

How to Reproduce:
1. Launch kmail, go to Settings -> Notify settings.
2. Insert an absolute path to program as an external notificator (not sure about the translation - I'm using polish version).
3. Recieve mail.

The external app is not executed. 

Workaround:
Add your application to $PATH or make a symlink in a directory listed in $PATH and use only the name of the application instead of the whole absolute path.
Comment 1 Thomas McGuire 2008-08-16 16:58:49 UTC
Sounds like a kdelibs bug to me, this would happen in all KDE applications it seems.
Comment 2 Michael Pyne 2008-08-16 23:50:03 UTC
The problem is that the KNotify config widget stores a path as a KUrl.  KUrlRequester is nice and simply returns the text entered into the line edit if it is invalid.  But if it is a path or something that looks like a path it turns it into a real URL.  Which means that file:// gets prepended to the path when saved in the config file.

When KNotify later tries to execute that path /bin/sh will fail to do so since it is expecting a path and not a URL.

The way to fix this is either to store the path to the program as a path and not a URL or to have KNotify convert the URL to a path beforehand.  I will attach a patch that does the latter but I will leave the fix up to what Olivier would like to do.
Comment 3 Michael Pyne 2008-08-16 23:54:43 UTC
Created attachment 26887 [details]
Allows KNotify to run programs stored in the rc file as a URL.

Proposed fix, apply in kdebase.
Comment 4 Petr Kopecký 2008-12-07 13:04:56 UTC
I can confirm this bug on latest SVN trunk. Additionally there in not only a problem with script path but also with arguments.

Adding following script: /home/kde4tst/bin/kopete_osd.sh %s
Results to: Execute=file:///home/kde4tst/bin/kopete_osd.sh%20%25s
in $KDEDIR/share/kopete.notifyrc

This is wrong, but it works to manually modify the configuration file and change it to:
Execute=/home/kde4tst/bin/kopete_osd.sh %s
Comment 5 Michael Pyne 2009-02-05 01:45:41 UTC
SVN commit 921409 by mpyne:

Fix bug 168968 (External programs for notifications are not executed if a path is given) in trunk.

CCBUG:168968


 M  +1 -1      knotifyconfigactionswidget.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=921409
Comment 6 Michael Pyne 2009-02-05 01:46:50 UTC
SVN commit 921411 by mpyne:

Backport fix for bug 168968 to KDE 4.2.1.

BUG:168968


 M  +1 -1      knotifyconfigactionswidget.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=921411