[Portland-bugs] [Bug 89902] xdg-open does not exit if it does not recognize the mimetype

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Fri Apr 10 17:49:15 PDT 2015


https://bugs.freedesktop.org/show_bug.cgi?id=89902

Danny Arnold <despair.blue at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEEDINFO                    |REOPENED

--- Comment #11 from Danny Arnold <despair.blue at gmail.com> ---
Ok the problem is that xdg-mime and mimeopen think that the anchor is part of
the file name, thus they fail to return a mime type for it, so xdg-open goes
through the list of known browsers and falls through to lynx. Which it then
runs with eval.

1. I don't think lynx should be part of that list unless it's started with a
new terminal emulator, otherwise it just opens and blocks xdg-open.
2. The list should be more exhaustive, if it'd contain chromium or
google-chrome-stable it would work even on archlinux.
3. It might be better to use hash and exec instead of eval when going through
the browser, like this:
```
for browser in $BROWSER; do
        if [ x"$browser" != x"" ]; then
            browser_with_arg=`printf "$browser" "$1" 2>/dev/null`
            if [ $? -ne 0 ]; then
                browser_with_arg=$browser;
            fi

            hash $browser 2>/dev/null
            if [ $? -ne 1 ]; then
                if [ x"$browser_with_arg" = x"$browser" ]; then
                    exec $browser "$1" #$xdg_redirect_output;
                else exec $browser_with_arg #$xdg_redirect_output;
                fi
            fi
        fi
    done
```
That way lynx could stay in the list and would work.

So, should I write a patch adding more known browsers, removing lynx, changing
the for loop or do you see another solution?

regards

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/portland-bugs/attachments/20150411/8ad1b7d0/attachment.html>


More information about the Portland-bugs mailing list