Public bug reported:
gvfs-open exits with error code 0 (success) even when there is error.
The following conditions should exit with error code > 0:
- File is not found
- File is found, but default application for opening it is not registred
Examples:
$ gvfs-open nofile.txt || echo "NOT FOUND!"
gvfs-open: file:///home/rodrigo/nofile.txt: error opening location: Error
stating file '/home/rodrigo/nofile.txt': No such file or directory
$ touch test.mdb ; gvfs-open nofile.txt || echo "NO ASSOCIATION!" ; rm test.mdb
gvfs-open: file:///home/rodrigo/nofile.txt: error opening location: Error
stating file '/home/rodrigo/nofile.txt': No such file or directory
In both situations exit code was 0, meaning success, even when gvfs-
open was clearly NOT successful. This makes gvfs-open hard to use in
scripts.
And the problem is even worse considering gvfs-open is used by xdg-open
A quick look at source code shows that it has a hardcoded "return 0" in
main() function. The open() function is "static void". Both could easily
be changed so open would be "static int open(...)", set a proper return
code, and main would test for it.
Using Maverick 10.10 64bits, gvfs 1.6.4-0ubuntu1.1
** Affects: gvfs (Ubuntu)
Importance: Undecided
Status: New
--
You received this bug notification because you are a member of Ubuntu
Desktop Bugs, which is subscribed to gvfs in Ubuntu.
https://bugs.launchpad.net/bugs/816804
Title:
gvfs-open exit code is 0 when file is not found and no default
application is registred
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/gvfs/+bug/816804/+subscriptions
--
desktop-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/desktop-bugs