Skip to content

webbrowser.py triggers unwanted XQuartz startup #87277

Closed

Description

@hans-meine
mannequin
BPO 43111
Nosy @terryjreedy, @ronaldoussoren, @ned-deily
PRs
  • gh-87277: Don't look for X11 browsers on macOS (webbrowser) #24480
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = None
    created_at = <Date 2021-02-03.09:21:34.337>
    labels = ['OS-mac', '3.8', '3.9', '3.10', 'performance', 'library']
    title = 'webbrowser.py triggers unwanted XQuartz startup'
    updated_at = <Date 2021-02-08.09:04:26.632>
    user = 'https://bugs.python.org/hans-meine'

    bugs.python.org fields:

    activity = <Date 2021-02-08.09:04:26.632>
    actor = 'terry.reedy'
    assignee = 'none'
    closed = False
    closed_date = None
    closer = None
    components = ['Library (Lib)', 'macOS']
    creation = <Date 2021-02-03.09:21:34.337>
    creator = 'hans-meine'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 43111
    keywords = ['patch']
    message_count = 6.0
    messages = ['386182', '386553', '386555', '386557', '386623', '386625']
    nosy_count = 4.0
    nosy_names = ['terry.reedy', 'ronaldoussoren', 'ned.deily', 'hans-meine']
    pr_nums = ['24480']
    priority = 'normal'
    resolution = None
    stage = 'patch review'
    status = 'open'
    superseder = None
    type = 'resource usage'
    url = 'https://bugs.python.org/issue43111'
    versions = ['Python 3.8', 'Python 3.9', 'Python 3.10']

    Activity

    1. hans-meine commented on Feb 3, 2021

      hans-meinemannequin
      MannequinAuthor

      For a long time, I wondered why opening Jupyter notebooks through nbopen always led to XQuartz starting. Now, I found the reason: nbopen uses webbrowser.py to open a web page, and webbrowser.py sees the DISPLAY variable being set and calls xdg-settings (which I installed via the xdg-utils port / MacPorts).

      Apparently, in order to be able to fire up XQuartz on demand and to allow people starting X11 applications, DISPLAY is set to a string like /private/tmp/com.apple.launchd.<somecode>/org.xquartz:0.

      I am using Safari and find this starting of XQuartz undesirable (causes a delay, uses system resources, leads to a new running program in the Dock / task switcher). On the other hand I can totally understand that the code makes sense.

      As a workaround, I can unset DISPLAY, or uninstall xdg-utils (although it is useful, and may be a dependency of other ports), but I thought I should also bring it up here for discussion.

    2. added
      stdlibStandard Library Python modules in the Lib/ directory
      performancePerformance or resource usage
      on Feb 3, 2021
    3. terryjreedy commented on Feb 6, 2021

      @terryjreedy
      Member

      3.7 is a few years old and only gets security fixes. Can you either test on current releases or whether code is still same?

    4. ronaldoussoren commented on Feb 6, 2021

      @ronaldoussoren
      Contributor

      The same code is present in trunk.

      I'm in favour of disabling usage of X11 browsers of macOS, that's almost certainly not what users want.

      I no longer have XQuartz installed on my machine, but when I did I only used it for running X11 GUIs on remote Linux systems.

      What I'm not entirely sure about: is this something we should back port or just apply to the trunk (3.10)? This is a behaviour change and as such I'd be inclined to only apply to trunk.

    5. hans-meine commented on Feb 6, 2021

      hans-meinemannequin
      MannequinAuthor

      I was trying to be very honest, because I am still running 3.7 for production. However, I have carefully checked and the webbrowser.py has only seen (clearly) unrelated changes.

    6. ronaldoussoren commented on Feb 8, 2021

      @ronaldoussoren
      Contributor

      I've created a PR for this.

      Open question: Is this a bug fix (with back ports to 3.9 and 3.8) or a feature (no back ports)?

    7. terryjreedy commented on Feb 8, 2021

      @terryjreedy
      Member

      webbrowser is 'generous' at to what browsers it will open, some of which are not what hardly anyone would want. So I would call this an 'enhancement' (really 'disenchantment', like all removals;-) unless there were a technical reason other than those given for the exclusion.

    8. transferred this issue fromon Apr 10, 2022
    9. added
      3.11only security fixes
      3.12only security fixes
      and removed on Sep 9, 2022
    10. iritkatriel commented on Sep 9, 2022

      @iritkatriel
      Member

      I've updated the version labels. The code change has not been applied to main yet (but I don't know whether it is still needed).

    11. ronaldoussoren commented on Dec 20, 2023

      @ronaldoussoren
      Contributor

      I'm reviving the PR and will treat this as a new feature, that is I won't perform a back port of the PR. Primary reason for that is that using XQuartz in first place is a niche use case.

    12. added a commit that references this issue on Dec 21, 2023
    13. ronaldoussoren commented on Dec 21, 2023

      @ronaldoussoren
      Contributor

      I've merged a fix for this in the main branch.

      I'm not backporting this because X11 usage on macOS should be extremely niche these days, but am willing to reconsider.

    14. added a commit that references this issue on Dec 26, 2023
    15. added a commit that references this issue on Jan 22, 2024
    16. added a commit that references this issue on Feb 11, 2024
    17. added a commit that references this issue on Sep 2, 2024
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    No one assigned

      Labels

      3.10 (EOL)end of life3.11only security fixes3.12only security fixesOS-macperformancePerformance or resource usagestdlibStandard Library Python modules in the Lib/ directory

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions