Bug 109437 - xdg-open open_generic_xdg_x_scheme_handler has unquoted `[ -n $scheme ]` test
Summary: xdg-open open_generic_xdg_x_scheme_handler has unquoted `[ -n $scheme ]` test
Status: RESOLVED MOVED
Alias: None
Product: Portland
Classification: Unclassified
Component: xdg-utils (show other bugs)
Version: 1.1.0
Hardware: Other All
: medium normal
Assignee: Portland Bugs
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-01-22 11:44 UTC by Dominic Evans
Modified: 2019-02-16 13:40 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments

Description Dominic Evans 2019-01-22 11:44:39 UTC
xgd-open v1.1.3

A -n test doesn't work with unquoted arguments. The `$scheme` must be double-quoted:

open_generic_xdg_x_scheme_handler()
{
    scheme="`echo $1 | sed -n 's/\(^[[:alnum:]+\.-]*\):.*$/\1/p'`"
    if [ -n $scheme ]; then
        filetype="x-scheme-handler/$scheme"
        open_generic_xdg_mime "$1" "$filetype"
    fi
}

I'd suggest `if [ -n "${scheme:-}" ]; then`


Ref: https://github.com/koalaman/shellcheck/wiki/SC2070
Comment 1 GitLab Migration User 2019-02-16 13:40:57 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/xdg/xdg-utils/issues/142.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.