Skip to content

platform.system() returns incorrect value in Vista #45006

Closed

Description

@bleppard
mannequin
BPO 1726668
Nosy @malemburg, @loewis
Files
  • Platform-VistaFix2.patch: Fix for uname() and win32_ver()
  • 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 = 'https://github.com/malemburg'
    closed_at = <Date 2007-06-12.09:27:17.000>
    created_at = <Date 2007-05-28.01:23:43.000>
    labels = []
    title = 'platform.system() returns incorrect value in Vista'
    updated_at = <Date 2007-06-12.09:27:17.000>
    user = 'https://bugs.python.org/bleppard'

    bugs.python.org fields:

    activity = <Date 2007-06-12.09:27:17.000>
    actor = 'lemburg'
    assignee = 'lemburg'
    closed = True
    closed_date = None
    closer = None
    components = ['None']
    creation = <Date 2007-05-28.01:23:43.000>
    creator = 'bleppard'
    dependencies = []
    files = ['8010']
    hgrepos = []
    issue_num = 1726668
    keywords = ['patch']
    message_count = 5.0
    messages = ['52681', '52682', '52683', '52684', '52685']
    nosy_count = 3.0
    nosy_names = ['lemburg', 'loewis', 'bleppard']
    pr_nums = []
    priority = 'normal'
    resolution = None
    stage = None
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue1726668'
    versions = []

    Activity

    1. bleppard commented on May 28, 2007

      bleppardmannequin
      MannequinAuthor

      On Microsoft Vista platform.system() returns 'Microsoft' and platform.release() returns 'Windows'

      Under Microsoft Windows XP SP2 platform.system() returns 'Windows' and platform.release() returns 'XP'.

      This is problem was caused by a change in the output of the "ver" command. In Windows XP SP2 "ver" outputted 'Microsoft Windows XP [Version 5.1.2600]' In Microsoft Vista "ver" outputted 'Microsoft Windows [Version 6.0.6000]'. The lack of the 3rd word before version causes _syscmd_ver(...) in platform.py to return 'Microsoft' for system instead of 'Microsoft Windows'. This causes uname() to return the incorrect values. Both system() and release() call uname().

      This problem occurs in the trunk.

      I have attached a patch against the trunk svn that fixes the symptom of the problem in uname()

    2. loewis commented on May 29, 2007

      loewismannequin
      Mannequin

      Reclassifying as a patch. Marc-Andre, can you take a look? If not, please unassign.

    3. malemburg commented on May 29, 2007

      @malemburg
      Member

      I don't have Vista handy to check the patch.

      Ideally, win32_ver() should be patched to return proper values for Vista directly from the registry. Would be great if you could provide a patch for this as well.

      However, in some cases _syscmd_ver() will still be used, so the patch is fine. Please add a comment explaining the problem and also add a check to set release to 'Vista' in case the version starts with '6.0'.

      Thanks.

    4. bleppard commented on May 30, 2007

      bleppardmannequin
      MannequinAuthor

      I updated the patch to included comments, and set the release to 'Vista' when the version starts with '6.0'. Unfortunately both Windows Server 2008 and Windows Vista both are version 6.0.

      I updated win32_ver() to report the correct values for Vista and Windows Server 2008. It reports release of '2008Server' for Windows 2008 server, and release of 'post2008Server' for version 6.1 or greater. I have not tested it under Windows Server 2008.
      File Added: Platform-VistaFix2.patch

    5. malemburg commented on Jun 12, 2007

      @malemburg
      Member

      Thank you.

      Committed revision 55927.

    6. transferred this issue fromon Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions