GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fcntl_ioctl still not 100% sane with unsigned longs · Issue #60328 · python/cpython

fcntl_ioctl still not 100% sane with unsigned longs #60328

New issue
Copy link
New issue
Copy link
Closed as duplicate
Closed as duplicate
fcntl_ioctl still not 100% sane with unsigned longs#60328
Copy link
Labels
extension-modulesC modules in the Modules dirC modules in the Modules dirtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

Description

ngie-eign
mannequin
opened on Oct 4, 2012
Issue body actions
BPO 16124
Nosy @loewis, @gpshead, @tpn, @ngie-eign, @asvetlov, @serhiy-storchaka
Files
  • python-issue16124.patch
  • python-issue16124.patch
  • python-issue16124.patch
  • 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 2012-10-04.03:46:54.896>
    labels = ['extension-modules', 'type-bug']
    title = 'fcntl_ioctl still not 100% sane with unsigned longs'
    updated_at = <Date 2015-02-15.10:00:39.805>
    user = 'https://github.com/ngie-eign'

    bugs.python.org fields:

    activity = <Date 2015-02-15.10:00:39.805>
    actor = 'ngie'
    assignee = 'none'
    closed = False
    closed_date = None
    closer = None
    components = ['Extension Modules']
    creation = <Date 2012-10-04.03:46:54.896>
    creator = 'ngie'
    dependencies = []
    files = ['27952', '27954', '27955']
    hgrepos = []
    issue_num = 16124
    keywords = ['patch']
    message_count = 11.0
    messages = ['171918', '172112', '175348', '175354', '175355', '175356', '175357', '175358', '236030', '236031', '236032']
    nosy_count = 6.0
    nosy_names = ['loewis', 'gregory.p.smith', 'trent', 'ngie', 'asvetlov', 'serhiy.storchaka']
    pr_nums = []
    priority = 'normal'
    resolution = None
    stage = 'test needed'
    status = 'open'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue16124'
    versions = ['Python 2.7', 'Python 3.4', 'Python 3.5']

    Activity

    1. ngie-eign commented on Oct 4, 2012

      @ngie-eign
      ngie-eignmannequin
      on Oct 4, 2012
      MannequinAuthor
      More actions

      As discussed in ID bpo-1471, the type for request is not 100% correct on some platforms (FreeBSD, NetBSD, and OpenBSD, for instance) and the custom platform that I'm using unfortunately uses non-32-bit int ioctls. An autoconf test needs to be added for these platforms and the request parameter needs to be handled properly (I'll take charge of doing that).

    2. ngie-eign
      added
      extension-modulesC modules in the Modules dirC modules in the Modules dir
      type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
      on Oct 4, 2012
    3. asvetlov commented on Oct 5, 2012

      @asvetlov
      asvetlov
      on Oct 5, 2012
      Contributor
      More actions

      Is it affected for 3.3 and 3.4 also?

    4. ngie-eign commented on Nov 11, 2012

      @ngie-eign
      ngie-eignmannequin
      on Nov 11, 2012
      MannequinAuthor
      More actions

      Yes. Submitting a patch to fix this based on hg master shortly..

    5. ngie-eign commented on Nov 11, 2012

      @ngie-eign
      ngie-eignmannequin
      on Nov 11, 2012
      MannequinAuthor
      More actions
      $ uname -a
      FreeBSD bayonetta.local 9.1-PRERELEASE FreeBSD 9.1-PRERELEASE #0 r240836M: Sat Sep 22 12:30:11 PDT 2012     [email protected]:/usr/obj/store/freebsd/stable/9/sys/BAYONETTA  amd64
      $ ./configure --prefix=/scratch/python-bin/3k/
      ...
      $ make all; make install
      ...
      $ /scratch/python-bin/3k/bin/python3 Lib/test/test_ioctl.py
      test_ioctl (__main__.IoctlTests) ... ok
      test_ioctl_mutate (__main__.IoctlTests) ... ok
      test_ioctl_mutate_1024 (__main__.IoctlTests) ... ok
      test_ioctl_mutate_2048 (__main__.IoctlTests) ... ok
      test_ioctl_signed_unsigned_code_param (__main__.IoctlTests) ... ok

      Ran 5 tests in 0.003s

      OK

    6. ngie-eign commented on Nov 11, 2012

      @ngie-eign
      ngie-eignmannequin
      on Nov 11, 2012
      MannequinAuthor
      More actions

      Sorry; previous patch is not applicable to this issue. This one is.

    7. ngie-eign commented on Nov 11, 2012

      @ngie-eign
      ngie-eignmannequin
      on Nov 11, 2012
      MannequinAuthor
      More actions

      And I missed the int -> unsigned int part. Resubmitting one last time for tonight..

    8. ngie-eign commented on Nov 11, 2012

      @ngie-eign
      ngie-eignmannequin
      on Nov 11, 2012
      MannequinAuthor
      More actions

      Grr... Let's try again.

    9. ngie-eign commented on Nov 11, 2012

      @ngie-eign
      ngie-eignmannequin
      on Nov 11, 2012
      MannequinAuthor
      More actions

      ... g'night.

    10. serhiy-storchaka commented on Feb 15, 2015

      @serhiy-storchaka
      serhiy-storchaka
      on Feb 15, 2015
      Member
      More actions

      This looks as a duplicate of bpo-521723 and bpo-1471. Do you have tests that demonstrate a failure with using ioctl on OpenBSD? May be there are problems on 64-bit big-endian platforms (or even on 64-bit little-endian if additional parameters are passed to ioctl).

    11. ngie-eign commented on Feb 15, 2015

      @ngie-eign
      ngie-eignmannequin
      on Feb 15, 2015
      MannequinAuthor
      More actions

      Yes, it's a duplicate. That being said, documentation alone it should be unsigned long for Darwin (OS/X), FreeBSD, OpenBSD. Looking at the definition for ioctl(2), the below example would cause a failure.

      I need to hunt around for a practical example as I don't have one offhand (it's something that was found a long time ago in a couple of python 2.6 at my current employer because they have ioctl's that go beyond the 32-bit boundary IIRC...)

      fuji:~ ngie$ clang -Wall -c test_ioctl.c
      fuji:~ ngie$ clang -DBROKEN -Wall -c test_ioctl.c
      test_ioctl.c:9:9: warning: incompatible pointer types initializing 'ioctl_t'
            (aka 'int (*)(int, int, ...)') with an expression of type 'int (int,
            unsigned long, ...)' [-Wincompatible-pointer-types]
      ioctl_t _ioctl = ioctl;
              ^        ~~~~~
      1 warning generated.
      fuji:~ ngie$ cat test_ioctl.c 
      #include <sys/ioctl.h>
      
      #ifdef BROKEN
      typedef int (*ioctl_t)(int, int, ...);
      #else
      typedef int (*ioctl_t)(int, unsigned long, ...);
      #endif

      ioctl_t _ioctl = ioctl;
      fuji:~ ngie$ uname -a
      Darwin fuji.local 13.4.0 Darwin Kernel Version 13.4.0: Wed Dec 17 19:05:52 PST 2014; root:xnu-2422.115.10~1/RELEASE_X86_64 x86_64

    12. ngie-eign commented on Feb 15, 2015

      @ngie-eign
      ngie-eignmannequin
      on Feb 15, 2015
      MannequinAuthor
      More actions

      Another note: mixed endianness might have been a factor as previous versions of the product that were shipped used bi-arch x86 (32-bit userland on 64-bit kernel.

    13. ezio-melotti
      transferred this issue fromon Apr 10, 2022
    14. serhiy-storchaka commented on Apr 21, 2025

      @serhiy-storchaka
      serhiy-storchaka
      on Apr 21, 2025
      Member
      More actions

      This was fixed in #69214. The documentation will be updated in #132742.

    15. serhiy-storchaka
      closed this as completedon Apr 21, 2025
    16. serhiy-storchaka
      closed this as duplicateon Apr 21, 2025
    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

      extension-modulesC modules in the Modules dirC modules in the Modules dirtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions

        You are visitor 01402520 — GeezerVison does not store the pages you look up.
        Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.