Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
G
GLib
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 936
    • Issues 936
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Merge Requests 59
    • Merge Requests 59
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
  • Operations
    • Operations
    • Incidents
    • Environments
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Analytics
    • Analytics
    • CI / CD
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • GNOME
  • GLib
  • Issues
  • #1876

Closed (moved)
Open
Opened Aug 21, 2019 by Michael Catanzaro@mcatanzaroDeveloper

g_app_info_launch_uris() may return FALSE without setting error

I have an Epiphany crash report (when running under snap):

(gdb) bt full
#0  0x00007f20a95fd8da in open_in_default_handler (uri=0x5596afcbbd90 "file:///home/jena/Sta%C5%BEen%C3%A9/Capture_d_%C3%A9cran_vid%C3%A9o_de_14-05-2019_17_26_27.webm", 
    mime_type=0x7f20a961dbde "inode/directory", timestamp=11116828, screen=0x0, tag=EPHY_FILE_HELPERS_I_UNDERSTAND_I_MUST_NOT_USE_THIS_FUNCTION_UNDER_FLATPAK)
    at ../lib/ephy-file-helpers.c:689
        context = 0x5596afd60b10
        appinfo = 0x0
        error = 0x0
        uris = {data = 0x5596afcbbd90, next = 0x0, prev = 0x0}
        __func__ = "open_in_default_handler"
#1  0x00007f20a95fd9db in ephy_file_browse_to (file=0x5596b1a5d600, user_time=11116828, tag=EPHY_FILE_HELPERS_I_UNDERSTAND_I_MUST_NOT_USE_THIS_FUNCTION_UNDER_FLATPAK)
    at ../lib/ephy-file-helpers.c:724
        uri = 0x5596afcbbd90 "file:///home/jena/Sta%C5%BEen%C3%A9/Capture_d_%C3%A9cran_vid%C3%A9o_de_14-05-2019_17_26_27.webm"

Problem is g_app_info_launch_uris() has returned FALSE, so Epiphany dereferences error->message to print an error message, but error is NULL. I don't think Epiphany should add a NULL check, because this function is documented to always set error when it fails, in accordance with usual GLib convention: "On error, error will be set accordingly." Returns: "TRUE on successful launch, FALSE otherwise." I assume non-successful launch is an error, as would a reasonable developer.

I see g_desktop_app_info_launch_uris() calls g_desktop_app_info_launch_uris_internal(), which can only fail if it calls g_desktop_app_info_launch_uris_with_spawn(). That can only fail in expand_application_parameters() or g_spawn_async_with_fds() (or another case where the error is always set). g_spawn_async_with_fds() is explicitly documented to return "TRUE on success, FALSE if an error was set". expand_application_parameters() has two error paths: one where it always sets error itself, and one in g_shell_parse_argv(), which again is documented to return "TRUE on success, FALSE if error set". I haven't tracked this further, but I guess the bug lies in one or the other.

Assignee
Assign to
None
Milestone
None
Assign milestone
Time tracking
None
Due date
None
Reference: GNOME/glib#1876