Bug 2293896

Summary: dumb-init fails to build with pytest 8: AssertionError: b'\x1b]0;<mock-chroot>\x07\x1b[?2004hbash-5.2$ echo "flags are: [[$-]]"
Product: [Fedora] Fedora Reporter: Tomáš Hrnčiar <thrnciar>
Component: dumb-initAssignee: Artur Frenszek-Iwicki <fedora>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: fedora, mhroncok, thrnciar
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2024-07-30 11:49:29 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 2256331    

Description Tomáš Hrnčiar 2024-06-24 07:32:43 UTC
dumb-init fails to build with pytest 8.


=================================== FAILURES ===================================
______________ test_child_gets_controlling_tty_if_we_had_one[1-0] ______________

    @pytest.mark.usefixtures('both_debug_modes')
    @pytest.mark.usefixtures('both_setsid_modes')
    def test_child_gets_controlling_tty_if_we_had_one():
        """If dumb-init has a controlling TTY, it should give it to the child.
    
        To test this, we make a new TTY then exec "dumb-init bash" and ensure that
        the shell has working job control.
        """
        pid, sfd = pty.fork()
        if pid == 0:
            os.execvp('dumb-init', ('dumb-init', 'bash', '-m'))
        else:
            ttyflags(sfd)
    
            # We might get lots of extra output from the shell, so print something
            # we can match on easily.
            assert os.write(sfd, b'echo "flags are: [[$-]]"\n') == 25
            assert os.write(sfd, b'exit 0\n') == 7
            output = readall(sfd)
            assert os.waitpid(pid, 0) == (pid, 0), output
    
            m = re.search(b'flags are: \\[\\[([a-zA-Z]+)\\]\\]\n', output)
>           assert m, output
E           AssertionError: b'\x1b]0;<mock-chroot>\x07\x1b[?2004hbash-5.2$ echo "flags are: [[$-]]"
E             \x1b[?2004l\rflags are: [[himBHs]]\r
E             \x1b]0;<mock-chroot>\x07\x1b[?2004hbash-5.2$ exit 0\r
E             \x1b[?2004l\rexit\r
E             '
E           assert None

tests/tty_test.py:81: AssertionError
=============================== warnings summary ===============================
../../../../../usr/lib/python3.13/site-packages/_pytest/config/__init__.py:1448
  /usr/lib/python3.13/site-packages/_pytest/config/__init__.py:1448: PytestConfigWarning: Unknown config option: timeout
  
    self._warn_or_fail_if_strict(f"Unknown config option: {key}\n")

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
=========================== short test summary info ============================
FAILED tests/tty_test.py::test_child_gets_controlling_tty_if_we_had_one[1-0] - AssertionError: b'\x1b]0;<mock-chroot>\x07\x1b[?2004hbash-5.2$ echo "flags are: [[$-]]"
  \x1b[?2004l\rflags are: [[himBHs]]\r
  \x1b]0;<mock-chroot>\x07\x1b[?2004hbash-5.2$ exit 0\r
  \x1b[?2004l\rexit\r
  '
assert None
=================== 1 failed, 181 passed, 1 warning in 8.65s ===================

https://docs.pytest.org/en/stable/changelog.html

For the build logs, see:
https://copr-be.cloud.fedoraproject.org/results/thrnciar/pytest-8.2.2/fedora-rawhide-x86_64/07642561-dumb-init/

For all our attempts to build dumb-init with pytest 8, see:
https://copr.fedorainfracloud.org/coprs/thrnciar/pytest-8.2.2/package/dumb-init/

Let us know here if you have any questions.

Pytest 8 is planned to be included in Fedora 41. And this bugzilla is a
heads up before we merge new pytest into rawhide. For more info see a Fedora Change
proposal https://fedoraproject.org/wiki/Changes/Pytest_8

We'd appreciate help from the people who know this package best,
but if you don't want to work on this now, let us know so we can try to work around it on our side.

Comment 1 Tomáš Hrnčiar 2024-07-30 11:49:29 UTC
I've got a successful build with pytest 8.3.1 - https://copr.fedorainfracloud.org/coprs/thrnciar/pytest-8.3.1/build/7769186/