Bug 6153 (int-146889)

Summary: apt-get segfaults when system has ran out of ptys
Product: [Maemo Official Applications] Settings and Maintenance Reporter: Lucas Maneos <maemo>
Component: Application managerAssignee: unassigned <nobody>
Status: VERIFIED FIXED QA Contact: application-manager-bugs
Severity: normal    
Priority: Low CC: andre_klapper, msanchez
Version: 5.0/(2.2009.51-1)Keywords: crash, upstream
Target Milestone: 5.0/(3.2010.02-8)   
Hardware: N900   
OS: Maemo   
URL: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=561109

Description Lucas Maneos (reporter) 2009-11-13 13:28:36 UTC
SOFTWARE VERSION:
1.2009.42-11

STEPS TO REPRODUCE THE PROBLEM:
1. Exhaust system ptys (currently 4, so not hard) by opening enough osso-xterms
(or ssh, screen etc sessions).
2. Try to install some package with apt-get.

EXPECTED OUTCOME:
Successful installation, or failing that an error message and graceful exit.

ACTUAL OUTCOME:
Nokia-N900-42-11:~# apt-get install ltrace
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following NEW packages will be installed:
  ltrace
0 upgraded, 1 newly installed, 0 to remove and 2 not upgraded.
Need to get 80.2kB of archives.
After this operation, 221kB of additional disk space will be used.
WARNING: The following packages cannot be authenticated!
  ltrace
Install these packages without verification [y/N]? y
Get:1 http://repository.maemo.org fremantle/tools/free ltrace
0.5+svn20070904-0.1maemo1 [80.2kB]
Fetched 80.2kB in 2s (36.0kB/s)
Can not write log, openpty() failed (/dev/pts not mounted?)
Segmentation fault

REPRODUCIBILITY:
Always.

EXTRA SOFTWARE INSTALLED:

OTHER COMMENTS:
Hope this is the right component for apt :-)

Fixing bug 5824 will make this less likely to occur, but regardless of that
apt-get shouldn't crash.

Leaving severity at normal as it doesn't seem to cause any bad side effects.
Comment 1 Mario Sanchez Prada 2009-12-14 18:08:02 UTC
Fixed in master branch, it was just a matter of a missing NULL check:

commit 305f55f38cbfc3fb897b381f5cfbebbcf5e79ac3

    Don't segfault when installing if running out of pty's

    * apt-pkg/deb/dpkgpm.cc (pkgDPkgPM::Go): NULL check term_out


Also, reported as a bug to upstream APT in debian, attaching the same patch
Comment 2 Mario Sanchez Prada 2009-12-14 18:23:31 UTC
(In reply to comment #1)
> [...]
> Also, reported as a bug to upstream APT in debian, attaching the same patch

Here's the one: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=561109
Comment 3 Andre Klapper maemo.org 2010-01-15 13:07:11 UTC
This has been fixed in package
apt 0.7.20.2maemo13.1+0m5
which is part of the internal build version
2010.02-7
(Note: 2010 is the year, and the number after is the week.)

A future public update released with the year/week later than this internal
build version will include the fix. (This is not always already the next public
update.)
Please verify that this new version fixes the bug by marking this bug report as
VERIFIED after the public update has been released and if you have some time.


To answer popular followup questions:
 * Nokia does not announce release dates of public updates in advance.
 * There is currently no access to these internal, non-public build versions.
   A Brainstorm proposal to change this exists at
http://maemo.org/community/brainstorm/view/undelayed_bugfix_releases_for_nokia_open_source_packages-002/
Comment 4 Andre Klapper maemo.org 2010-02-09 18:06:21 UTC
(Corection: Fix already included in 3.2010.02-1)
Comment 5 Andre Klapper maemo.org 2010-02-16 14:06:19 UTC
The problem reported here should be fixed in the update released today for
public: The Maemo5 update version 3.2010.02-8 (also called "PR1.1.1"
sometimes).
Please leave a comment if the problem is not fixed for you in this update
version.
Comment 6 Lucas Maneos (reporter) 2010-02-16 14:43:12 UTC
Verifying, it proceeds to install without crashing now. Example:

# apt-get install xrestop
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following NEW packages will be installed:
  xrestop
0 upgraded, 1 newly installed, 0 to remove and 1 not upgraded.
Need to get 11.3kB of archives.
After this operation, 94.2kB of additional disk space will be used.
WARNING: The following packages cannot be authenticated!
  xrestop
Install these packages without verification [y/N]? y
Get:1 http://repository.maemo.org fremantle/tools/free xrestop 0.4-3maemo1
[11.3kB]
Fetched 11.3kB in 0s (51.1kB/s)
Can not write log, openpty() failed (/dev/pts not mounted?)
Selecting previously deselected package xrestop.
(Reading database ... 32553 files and directories currently installed.)
Unpacking xrestop (from .../xrestop_0.4-3maemo1_armel.deb) ...
Can not write log, openpty() failed (/dev/pts not mounted?)
Setting up xrestop (0.4-3maemo1) ...