Bug 9978 - shotwell does not start when /bin is before /usr/bin in path
Summary: shotwell does not start when /bin is before /usr/bin in path
Status: RESOLVED FIXED
Alias: None
Product: Mageia
Classification: Unclassified
Component: RPM Packages (show other bugs)
Version: Cauldron
Hardware: x86_64 Linux
Priority: Normal normal
Target Milestone: Mageia 3
Assignee: Mageia Bug Squad
QA Contact:
URL: http://redmine.yorba.org/issues/5181
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-05-04 14:41 CEST by man draker
Modified: 2013-05-13 17:57 CEST (History)
2 users (show)

See Also:
Source RPM:
CVE:
Status comment:


Attachments
Error Messages thrown by Shotwell, when started with /bin in PATH (4.25 KB, text/plain)
2013-05-09 14:49 CEST, man draker
Details

Description man draker 2013-05-04 14:41:02 CEST
When installed from Mageia-3-RC-x86_64-DVD.iso with LXDE as only UI and started the default way, the user PATH looks like:

"/usr/local/bin:/bin:/usr/bin:/usr/games:usr/lib64/qt4/bin:home/man-draker"

In consequence at least shotwell refuses to start.

Wheras started in runlevel 3, the PATH looks like:

"/usr/local/bin:/usr/bin:/usr/games:usr/lib64/qt4/bin:home/man-draker"
without the /bin at the second position.

There may be other Applications affected.
Comment 1 man draker 2013-05-04 14:48:16 CEST
When the DM ist switched to LXDM to XDM, the PATH changes to
"/bin:/usr/local/bin:/usr/bin:/usr/games:usr/lib64/qt4/bin:home/man-draker"
and the problem with shotwell remaines.

Target Milestone: --- => Mageia 3

Comment 2 man draker 2013-05-04 14:59:42 CEST
Workaround until solved: Install and use KDM.
Comment 3 Manuel Hiebel 2013-05-05 12:15:22 CEST
Colin maybe you have an ideas ? (sorry if you are not the best person don't know :/)

CC: sysadmin-bugs => mageia
Component: Release (media or process) => RPM Packages

Comment 4 Colin Guthrie 2013-05-05 15:10:19 CEST
The fact that /bin is in the path should be irrelevant. It's the same as /usr/bin - just a symlink. Does this *really* cause the problems you suggest or is there perhaps some other explanation?
Comment 5 David Walser 2013-05-05 16:44:34 CEST
This isn't the first report that having /bin in the PATH can cause issues, and some work has been done (at least some of which looks like by Luc Menut) to remove it from the default paths in Mageia.  KDM is one of the packages it was fixed in...I guess it needs fixed in LXDM and XDM too.  (See Bug 7119 for example)
Comment 6 Olivier Blin 2013-05-09 02:05:38 CEST
It should not be an issue to have /bin in the PATH
shotwell should be fixed.
What is the exact issue?

CC: (none) => mageia

Comment 7 Colin Guthrie 2013-05-09 10:09:35 CEST
FWIW, I've noticed such paths appearing automatically in some config files. I guess maybe msec is modifying them? Again tho', as I mentioned in comment 4 and as blino just said also, it shouldn't cause any problems and if it does it sounds like a bug in the programs doing some kind of manual interpretation of $PATH...
Comment 8 man draker 2013-05-09 14:49:00 CEST
Created attachment 3911 [details]
Error Messages thrown by Shotwell, when started with /bin in PATH

In reply to Comment 6
Comment 9 Colin Guthrie 2013-05-09 15:48:58 CEST
Can't reproduce here.

[colin@jimmy ~]$ shotwell 2>&1 | grep /bin
[colin@jimmy ~]$ echo $PATH
/usr/lib64/ccache/bin:/usr/local/bin:/usr/bin:/bin:/usr/games:/usr/lib64/qt4/bin:/home/shared/scripts/:/home/colin/shared/scripts:/usr/sbin:/usr/local/bin:/home/colin/bin
[colin@jimmy ~]$ 

I strongly suspect the cause is not to do with the $PATH or if it is, it's a very strange one. Looking for icon files in your path is generally wrong anyway. I suspect you've maybe set some XDG_* variable somehow or have some other stale file. Perhaps try to reproduce with a clean/new user account?
Comment 10 Olivier Blin 2013-05-09 15:58:52 CEST
Colin: make sure you have /bin before /usr/bin in your PATH to reproduce.
I can reproduce after switching them using your PATH.

This is a bug in shotwell.

Summary: MGA3 RC inserts "/bin:" into Userpath when started in RunLevel 5 => shotwell does not start when /bin is before /usr/bin in path

Comment 11 Colin Guthrie 2013-05-09 16:05:29 CEST
Yeah reproduced here now I do that. Nasty... Smells like it is in shotwell but grepping the source doesn't find any use of PATH. Perhaps it's in vala?
Comment 12 Colin Guthrie 2013-05-09 16:28:54 CEST
OK, so it's not *technically* $PATH related... if I run /usr/bin/shotwell, all is well, if I run /bin/shotwell it breaks, regardless of PATH.

I guess it's some kind of parsing of the basename. It's not likely to be in vala, so could very well be in shotwell itself.

Looking closer it's in
util/system.vala:

// Return the directory in which Shotwell is installed, or null if uninstalled.
File? get_sys_install_dir(File exec_dir) {
    File prefix_dir = File.new_for_path(Resources.PREFIX);
    return exec_dir.has_prefix(prefix_dir) ? prefix_dir : null;
}

This ultimately falls back to null and then uses the bin dir... This is code to allow running uninstalled (e.g. for devs testing builds).

Prepping a patch now.
Comment 13 Olivier Blin 2013-05-09 16:33:38 CEST
I think it is not only the piece of code you mentioned, but also these:

./src/AppDirs.vala:        File exec_file = File.new_for_path(Environment.find_program_in_path(arg0));
./src/International.vala:        File.new_for_path(Environment.find_program_in_path(args[0])).get_parent().get_child(

In src/AppDirs.vala:

    // Return the directory in which Shotwell is installed, or null if uninstalled.
    public static File? get_install_dir() {
        return get_sys_install_dir(exec_dir);
    }

    public static File get_resources_dir() {
        File? install_dir = get_install_dir();
        
        return (install_dir != null) ? install_dir.get_child("share").get_child("shotwell")
            : get_exec_dir();
    }

get_resources_dir() will fallback to the local exec dir, as you said for devs with uninstalled builds.
Comment 15 Colin Guthrie 2013-05-09 17:07:19 CEST
OK, so it didn't actually work. I've now applied a more brutal patch that fixes it.

Will liaise with upstream to see why it didn't work.

In the short term we can push this version.
Colin Guthrie 2013-05-09 17:08:11 CEST

URL: (none) => http://redmine.yorba.org/issues/5181

Comment 16 man draker 2013-05-13 17:57:19 CEST
Shotwell 0.14.1-2 installed.
Shotwells starts with /bin in PATH.
Problem solved.

Status: NEW => RESOLVED
Resolution: (none) => FIXED


Note You need to log in before you can comment on or make changes to this bug.