Skip to content
GitLab
Projects Groups Topics Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Register
  • Sign in
  • G GLib
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
  • Issues 853
    • Issues 853
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 42
    • Merge requests 42
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Releases
  • Packages and registries
    • Packages and registries
    • Container Registry
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • GNOMEGNOME
  • GLib
  • Merge requests
  • !2968

tests: Fix minor race in desktop-app-info terminals test

  • Review changes

  • Download
  • Patches
  • Plain diff
Merged Philip Withnall requested to merge pwithnall/glib:fix-desktop-app-info into main Oct 17, 2022
  • Overview 1
  • Commits 1
  • Pipelines 1
  • Changes 1

The implementation of g_desktop_app_info_launch_uris() will spawn the exec file once for each URI unless the desktop file has a placeholder in its Exec line which supports multiple URIs at once.

The fake terminal doesn’t have such a placeholder, so the fake terminal script is spawned twice in quick succession, once for each URI. Since it was making two separate printf calls (one to print the output to the pipe, and one to terminate it with a newline), it’s possible that two invocations of the script could interleave their printf calls, resulting in pipe input along the lines of URI1 URI2 newline newline rather than URI1 newline URI2 newline.

This would cause the test to fail.

Fix that by making the script atomic by moving the newline into the first printf call.

See: https://gitlab.gnome.org/GNOME/glib/-/jobs/2339109:

\# Fake 'nxterm' terminal created as: /tmp/bin-path-R6GWT1/nxterm
\# 'nxterm' called with arguments: '-e true nxterm-argument /tmp/bin-path-R6GWT1-e true nxterm-argument /tmp/test_desktop-app-info_CO92T1/desktop-app-info/launch-uris-with-terminal/nxterm/.dirs/data'
Bail out! GLib-GIO:ERROR:../gio/tests/desktop-app-info.c:1294:test_launch_uris_with_terminal: assertion failed (g_strv_length (output_args) == 4): (7 == 4)

Signed-off-by: Philip Withnall pwithnall@endlessos.org

Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: fix-desktop-app-info