Skip to content

Bug: Some tests fail if inetutils-inetd isn't installed on Ubuntu #1654

@Vessel9817

Description

@Vessel9817

Describe the bug

Some tests fail if inetutils-inetd isn't installed on Ubuntu

When building Python 3.13.7 from source, two socket tests fail if inetutils-inetd isn't installed.

Steps to Reproduce

The following Dockerfile gives a reproducible demonstration, making sure this works in Ubuntu 22.04 and Fedora 24:

ARG UBUNTU=ubuntu:24.04@sha256:d0afa9fbcf16134b776fbba4a04c31d476eece2d080c66c887fdd2608e4219a9
ARG FEDORA=fedora:42@sha256:6af051ad0a294182c3a957961df6203d91f643880aa41c2ffe3d1302e7505890

# Downloads and unzips Python
FROM ${UBUNTU} AS download_python

WORKDIR /usr/local/bin/
# https://devguide.python.org/versions/#full-chart
ARG PYTHON_VERSION=3.13.7
ARG PYTHON_HASH=sha256:6c9d80839cfa20024f34d9a6dd31ae2a9cd97ff5e980e969209746037a5153b2
ADD --checksum=${PYTHON_HASH} \
    "https://www.python.org/ftp/python/${PYTHON_VERSION}/Python-${PYTHON_VERSION}.tgz" \
    "./python.tgz"
RUN \
    tar -xzf './python.tgz' \
    && rm './python.tgz' \
    && mv "./Python-${PYTHON_VERSION}" "./python3"

# Runs Python in Ubuntu
FROM ${UBUNTU} AS python_ubuntu

RUN \
    # deb-src is necessary for apt-get build-dep
    sed -i 's/^# deb-src /deb-src /' /etc/apt/sources.list \
    && apt-get update -qq \
    # Shutting up interactive dependency installations
    && DEBIAN_FRONTEND=noninteractive apt-get install -yqq \
        tzdata \
    && apt-get build-dep -qq --no-install-recommends \
        python3 \
    && apt-get install -yqq --no-install-recommends \
        build-essential \
        gcc \
        gdb \
        # Required for Python tests:
        # test.test_asyncio.test_base_events test_socket
        inetutils-inetd \
        lcov \
        libbz2-dev \
        libffi-dev \
        libgdbm-compat-dev \
        libgdbm-dev \
        liblzma-dev \
        libncurses5-dev \
        libreadline6-dev \
        libsqlite3-dev \
        libssl-dev \
        libzstd-dev \
        lzma \
        lzma-dev \
        make \
        pkg-config \
        tk-dev \
        uuid-dev \
        zlib1g-dev \
    && apt-get clean -qq

# Installing Python
WORKDIR /usr/local/bin/python3/
COPY --from=download_python [ "/usr/local/bin/python3/", "./" ]
RUN \
    './configure' \
    && make \
    && make test \
    && make install

ENTRYPOINT [ "/usr/local/bin/python3/python" ]

# Runs Python in Fedora
FROM ${FEDORA} AS python_fedora

# Doesn't exist: deplzma
RUN \
    dnf install -yq \
        bzip2-devel \
        # Required for dnf build
        dnf-plugins-core \
        expat \
        expat-devel \
        gcc \
        gcc-c++ \
        gdb \
        gdbm-libs \
        git \
        glibc-devel \
        libffi-devel \
        libstdc++-devel \
        libuuid-devel \
        libzstd-devel \
        mpdecimal \
        openssl-devel \
        perf \
        pkg-config \
        python3-pip \
        readline-devel \
        sqlite \
        sqlite-devel \
        sqlite-libs \
        xz-devel \
        zlib-devel \
    && dnf builddep -yq \
        python3 \
    && dnf clean all

# Installing Python
WORKDIR /usr/local/bin/python3/
COPY --from=download_python [ "/usr/local/bin/python3/", "./" ]
RUN \
    './configure' \
    && make \
    && make test \
    && make install

ENTRYPOINT [ "/usr/local/bin/python3/python" ]

To run it, in your project directory, run:

docker build -t python_ubuntu --target=python_ubuntu . && docker run --rm -it python_ubuntu:latest 

or

docker build -t python_fedora --target=python_fedora . && docker run --rm -it python_fedora:latest 

to use Ubuntu or Fedora, respectively. This change only applies to the Ubuntu image, so running Fedora is not necessary to verify it, but rather it's here for completeness. Together, these sanity-check apt-get and dnf.

Actual behavior

  • Fedora runs Python 3.13.7.
  • If inetutils-inetd \ is commented out, the following tests fail the Python build in Ubuntu, aborting the overall image build: test.test_asyncio.test_base_events test_socket. Python 3 on Linux implicitly depends on one of the following services to be installed: daytime, qotd or domain. For reference, the CPython 3.13.7 source code.

Expected behavior

  • Fedora runs Python 3.13.7.
  • If inetutils-inetd \ is not commented out, all three services are installed, and Ubuntu runs Python 3.13.7.

Screenshots

No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions