apport-cli apport-collect crash AttributeError: 'bytes' object has no attribute 'fileno'

Bug #1991200 reported by Daniel Tang
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Apport
Fix Released
High
Unassigned
apport (Ubuntu)
Fix Released
High
Unassigned

Bug Description

apport-collect crashed.

# lsb_release -rd
Description: Ubuntu Kinetic Kudu (development branch)
Release: 22.10

# apt-cache policy apport
apport:
  Installed: 2.23.0-0ubuntu2
  Candidate: 2.23.0-0ubuntu2
  Version table:
 *** 2.23.0-0ubuntu2 500
        500 https://gpl.savoirfairelinux.net/pub/mirrors/ubuntu kinetic/main amd64 Packages
        500 https://gpl.savoirfairelinux.net/pub/mirrors/ubuntu kinetic/main i386 Packages
        100 /var/lib/dpkg/status

# Instructions

1. Run apport-collect NUMBER as root
2. Get to the point it asks before sending
3. Choose to view the report
4. Watch the crash

# Expected behavior

Apport-collect should stay alive and not crash with a stacktrace.

# Actual behavior

# apport-collect 1991199
Please open this authorization page:
 (REDACTED)
in your browser. Use your browser to authorize
this program to access Launchpad on your behalf.
Press Enter after authorizing in your browser.

Package openssh not installed and no hook available, ignoring

*** Collecting problem information

The collected information can be sent to the developers to improve the
application. This might take a few minutes.
....
*** It seems you have modified the contents of "/etc/systemd/logind.conf". Would you like to add the contents of it to your bug report?

What would you like to do? Your options are:
  Y: Yes
  N: No
  C: Cancel
Please choose (Y/N/C): n

*** It seems you have modified the contents of "/etc/systemd/sleep.conf". Would you like to add the contents of it to your bug report?

What would you like to do? Your options are:
  Y: Yes
  N: No
  C: Cancel
Please choose (Y/N/C): n
.......

*** Send problem report to the developers?

After the problem report has been sent, please fill out the form in the
automatically opened web browser.

What would you like to do? Your options are:
  S: Send report (597.4 KB)
  V: View report
  K: Keep report file for sending later or copying to somewhere else
  I: Cancel and ignore future crashes of this program version
  C: Cancel
Please choose (S/V/K/I/C): v
Traceback (most recent call last):
  File "/usr/bin/apport-cli", line 442, in <module>
    if not app.run_argv():
  File "/usr/lib/python3/dist-packages/apport/ui.py", line 858, in run_argv
    return self.run_update_report()
  File "/usr/lib/python3/dist-packages/apport/ui.py", line 758, in run_update_report
    response = self.ui_present_report_details(allowed_to_report)
  File "/usr/bin/apport-cli", line 258, in ui_present_report_details
    self.ui_update_view()
  File "/usr/bin/apport-cli", line 187, in ui_update_view
    subprocess.run(
  File "/usr/lib/python3.10/subprocess.py", line 501, in run
    with Popen(*popenargs, **kwargs) as process:
  File "/usr/lib/python3.10/subprocess.py", line 835, in __init__
    errread, errwrite) = self._get_handles(stdin, stdout, stderr)
  File "/usr/lib/python3.10/subprocess.py", line 1606, in _get_handles
    p2cread = stdin.fileno()
AttributeError: 'bytes' object has no attribute 'fileno'
---
ProblemType: Bug
ApportLog: ERROR: apport (pid 42855) Thu Sep 29 00:30:05 2022: executable was modified after program start, ignoring
ApportVersion: 2.23.0-0ubuntu2
Architecture: amd64
CasperMD5CheckResult: unknown
CrashReports: 640:0:148:22558:2022-09-29 02:33:04.712637295 -0400:2022-09-29 02:33:04.708637298 -0400:/var/crash/_usr_bin_apport-cli.0.crash
DistroRelease: Ubuntu 22.10
Package: apport 2.23.0-0ubuntu2
PackageArchitecture: all
Tags: kinetic third-party-packages
Uname: Linux 6.0.0-060000rc7-generic x86_64
UpgradeStatus: Upgraded to kinetic on 2022-09-29 (0 days ago)
UserGroups: N/A
_MarkForUpload: True

Revision history for this message
Daniel Tang (daniel-z-tg) wrote :

# apport-collect 1991200

*** Collecting problem information

The collected information can be sent to the developers to improve the
application. This might take a few minutes.
...................

*** Send problem report to the developers?

After the problem report has been sent, please fill out the form in the
automatically opened web browser.

What would you like to do? Your options are:
  S: Send report (5.8 KB)
  V: View report
  K: Keep report file for sending later or copying to somewhere else
  I: Cancel and ignore future crashes of this program version
  C: Cancel
Please choose (S/V/K/I/C): v
Traceback (most recent call last):
  File "/usr/bin/apport-cli", line 442, in <module>
    if not app.run_argv():
  File "/usr/lib/python3/dist-packages/apport/ui.py", line 858, in run_argv
    return self.run_update_report()
  File "/usr/lib/python3/dist-packages/apport/ui.py", line 758, in run_update_report
    response = self.ui_present_report_details(allowed_to_report)
  File "/usr/bin/apport-cli", line 258, in ui_present_report_details
    self.ui_update_view()
  File "/usr/bin/apport-cli", line 187, in ui_update_view
    subprocess.run(
  File "/usr/lib/python3.10/subprocess.py", line 501, in run
    with Popen(*popenargs, **kwargs) as process:
  File "/usr/lib/python3.10/subprocess.py", line 835, in __init__
    errread, errwrite) = self._get_handles(stdin, stdout, stderr)
  File "/usr/lib/python3.10/subprocess.py", line 1606, in _get_handles
    p2cread = stdin.fileno()
AttributeError: 'bytes' object has no attribute 'fileno'

Guess I'll have to temporarily try setting this bug to private.

information type: Public → Private
tags: added: apport-collected kinetic third-party-packages
description: updated
Revision history for this message
Daniel Tang (daniel-z-tg) wrote : Dependencies.txt

apport information

Revision history for this message
Daniel Tang (daniel-z-tg) wrote : ProcCpuinfoMinimal.txt

apport information

Revision history for this message
Daniel Tang (daniel-z-tg) wrote : ProcEnviron.txt

apport information

information type: Private → Public
Revision history for this message
Benjamin Drung (bdrung) wrote :

Thanks for reporting this bug. The subprocess.run in ui_update_view (in apport-cli) needs to use "input" as parameter instead of "stdin". We need test coverage for this.

Changed in apport (Ubuntu):
importance: Undecided → High
status: New → Triaged
tags: added: foundations-todo
Revision history for this message
Benjamin Drung (bdrung) wrote :

Sadly apport-cli itself has zero test coverage.

Changed in apport:
status: New → Triaged
importance: Undecided → High
milestone: none → 2.24.0
Revision history for this message
Benjamin Drung (bdrung) wrote :
Benjamin Drung (bdrung)
Changed in apport:
status: Triaged → Fix Committed
Benjamin Drung (bdrung)
Changed in apport:
status: Fix Committed → Fix Released
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package apport - 2.23.1-0ubuntu1

---------------
apport (2.23.1-0ubuntu1) kinetic; urgency=medium

  * New upstream bug-fix release.
    - Disable debuginfod when collecting a report (LP: #1989803)
    - apport-cli: Fix AttributeError: 'bytes' object has no attribute 'fileno'
      (LP: #1991200)
    - apport-bug: Add `/snap/bin` to `PATH` for Firefox snap on Lubuntu
      (LP: #1973470)
  * Drop cherry-picked upstream patches
  * tests: Fix path for installed apport-cli

 -- Benjamin Drung <email address hidden> Wed, 05 Oct 2022 16:25:48 +0200

Changed in apport (Ubuntu):
status: Triaged → Fix Released
Benjamin Drung (bdrung)
tags: removed: foundations-todo
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.