[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#561109: apt-get segfaults when system has ran out of ptys



Package: apt
Version: 0.7.25

As reported in Maemo's bugzilla bug #6153 [1]:


 STEPS TO REPRODUCE THE PROBLEM:
 1. Exhaust system ptys (currently 4 in Maemo Fremantle, 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


Providing a patch against revision 1900 in the bzr repository that would
fix this bug (just adds a missing NULL check).

Hope it helps

Mario

[1] https://bugs.maemo.org/show_bug.cgi?id=6153
=== modified file 'apt-pkg/deb/dpkgpm.cc'
--- apt-pkg/deb/dpkgpm.cc	2009-12-10 15:06:40 +0000
+++ apt-pkg/deb/dpkgpm.cc	2009-12-14 15:32:45 +0000
@@ -879,7 +879,8 @@
 	    const char *s = _("Can not write log, openpty() "
 	                      "failed (/dev/pts not mounted?)\n");
 	    fprintf(stderr, "%s",s);
-	    fprintf(term_out, "%s",s);
+            if(term_out)
+              fprintf(term_out, "%s",s);
 	    master = slave = -1;
 	 }  else {
 	    struct termios rtt;


Reply to: