[Portland-bugs] [Bug 32973] New: xdg-open fails to handle file names beginning with - (missing -- option) [PATCH]

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Mon Jan 10 08:50:38 PST 2011


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

           Summary: xdg-open fails to handle file names beginning with -
                    (missing -- option) [PATCH]
           Product: Portland
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: medium
         Component: xdg-utils
        AssignedTo: portland-bugs at lists.freedesktop.org
        ReportedBy: ruediger at c-plusplus.de


Created an attachment (id=41851)
 View: https://bugs.freedesktop.org/attachment.cgi?id=41851
 Review: https://bugs.freedesktop.org/review?bug=32973&attachment=41851

Patch

$ cat > -test.txt
test
^D
$ xdg-open -test.txt
xdg-open: unexpected option '-test.txt'
Try 'xdg-open --help' for more information.
$ xdg-open -- -test.txt
xdg-open: unexpected option '--'
Try 'xdg-open --help' for more information.

Most applications offer the -- flag to deactivate the handling of options and
allow the application to handle file names beginning with -. I wrote a patch
that adds support for -- to xdg-open. I added a test case and it worked for me
with kde-open (should also work with exo-open and gnome. Haven't tried the
generic/lxde stuff).

The patch does not support file names "--help" and so on because the code that
handles those options is auto generated and not aware of --. I wasn't sure how
to fix that and it's probably a very uncommon use case.

-- 
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.


More information about the Portland-bugs mailing list