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 — Incorrect returns caused by improper address filter in socket.getfqdn · Issue #100374 · python/cpython

Incorrect returns caused by improper address filter in socket.getfqdn #100374

New issue
Copy link
New issue
Copy link
Closed
Closed
Incorrect returns caused by improper address filter in socket.getfqdn#100374
Copy link
Labels
type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

Description

@YuriNek0
YuriNek0
opened on Dec 20, 2022
Issue body actions

Bug report

When getfqdn called with name "::", instead of returning gethostname(), it will call gethostbyaddr("::").
This will raise an exception "socket.herror: [Errno 1] Unknown host", which will cause a 30 seconds(timeout) delay and return incorrect result. (Tested only on macOS Ventura 13.0.0.1, Python 3.10.6)
The solution is to add a filter to the first if statement, in line 792 socket.py, which will be included in my further pull-request.

import socket
socket.getfqdn("::") # This will block 30 seconds and returns "::" instead of hostname

Your environment

  • CPython versions tested on: Python 3.10.6 (main, Aug 11 2022, 13:36:31) [Clang 13.1.6 (clang-1316.0.21.2.5)] on Darwin
  • Operating system and architecture: macOS Ventura 13.0.0.1, arm64

Linked PRs

  • gh-100374: Fixed a bug in socket.getfqdn() #100375
  • [3.11] gh-100374: Fixed a bug in socket.getfqdn() (gh-100375) #100401
  • [3.10] gh-100374: Fixed a bug in socket.getfqdn() (gh-100375) #100402

Activity

  1. YuriNek0
    added
    type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
    on Dec 20, 2022
  2. YuriNek0
    added a commit that references this issue on Dec 21, 2022

    Added test case for pythonGH-100374.

    2034fab
  3. corona10
    added a commit that references this issue on Dec 21, 2022

    gh-100374: Fixed a bug in socket.getfqdn() (gh-100375)

    12be23c
  4. miss-islington
    added 4 commits that reference this issue on Dec 21, 2022

    pythongh-100374: Fixed a bug in socket.getfqdn() (pythongh-100375)

    3a9d856

    pythongh-100374: Fixed a bug in socket.getfqdn() (pythongh-100375)

    69f01f3

    gh-100374: Fixed a bug in socket.getfqdn() (gh-100375)

    b2076b0

    gh-100374: Fixed a bug in socket.getfqdn() (gh-100375)

    7f24056
  5. corona10
    closed this as completedon Dec 21, 2022
  6. iritkatriel
    added a commit that references this issue on Dec 28, 2022

    Merged main into regmachine branch (#50)

    fdc73cb
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

    type-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 01402503 — 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.