[Portland-bugs] [Bug 109437] New: xdg-open open_generic_xdg_x_scheme_handler has unquoted `[ -n $scheme ]` test

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Tue Jan 22 11:44:39 UTC 2019


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

            Bug ID: 109437
           Summary: xdg-open open_generic_xdg_x_scheme_handler has
                    unquoted `[ -n $scheme ]` test
           Product: Portland
           Version: 1.1.0
          Hardware: Other
                OS: All
            Status: NEW
          Severity: normal
          Priority: medium
         Component: xdg-utils
          Assignee: portland-bugs at lists.freedesktop.org
          Reporter: oldmanuk at gmail.com

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

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


More information about the Portland-bugs mailing list