Package: apt Version: 0.7.20.2+lenny1 Followup-For: Bug #475770 I see this also, here is the backtrace:
#0 0xb798a791 in fwrite () from /lib/i686/cmov/libc.so.6 #1 0xb7f86f91 in pkgDPkgPM::OpenLog () from /usr/lib/libapt-pkg-libc6.7-6.so.4.6 #2 0xb7f89db4 in pkgDPkgPM::Go () from /usr/lib/libapt-pkg-libc6.7-6.so.4.6 #3 0xb7f3c308 in pkgPackageManager::DoInstallPostFork () from /usr/lib/libapt-pkg-libc6.7-6.so.4.6 #4 0xb7f3c36d in pkgPackageManager::DoInstall () from /usr/lib/libapt-pkg-libc6.7-6.so.4.6 #5 0x08186369 in download_install_manager::execute_install_run (this=0xbfbd4fd0, res=pkgAcquire::Continue, progre...@0xbfbd4d78) at download_install_manager.cc:149 #6 0x08186652 in download_install_manager::finish (this=0xbfbd4fd0, res=pkgAcquire::Continue, progre...@0xbfbd4d78) at download_install_manager.cc:190 #7 0x0814bdee in cmdline_do_download (m=0xbfbd4fd0, verbose=0) at cmdline_util.cc:404 #8 0x081478f4 in cmdline_upgrade (argc=1, argv=0xbfbd5428, status_fname=0x0, simulate=false, no_new_installs=<value optimized out>, assume_yes=<value optimized out>, download_only=<value optimized out>, showvers=<value optimized out>, showdeps=<value optimized out>, showsize=<value optimized out>, showwhy=<value optimized out>, user_ta...@0xbfbd5238, visual_preview=false, always_prompt=<value optimized out>, arch_only=<value optimized out>, queue_only=false, verbose=0) at cmdline_upgrade.cc:171 #9 0x0805fa15 in main (argc=1, argv=0xbfbd5424) at main.cc:661 I get this running aptitude safe-upgrade as normal user. I think probably most of the "segfaults as normal user" problems are caused by this lack of return value checking in libapt. In my case, there are weird permissions on apt stuff so that it gets the lock file but can't open the log. The return value of fopen is not checked in OpenLog, and the return value of OpenLog is not checked either. I have a tentative, untested patch. -- Package-specific info: -- apt-config dump -- APT ""; APT::Architecture "i386"; APT::Build-Essential ""; APT::Build-Essential:: "build-essential"; APT::Install-Recommends "1"; APT::Install-Suggests "0"; APT::Acquire ""; APT::Acquire::Translation "environment"; APT::NeverAutoRemove ""; APT::NeverAutoRemove:: "^linux-image.*"; APT::NeverAutoRemove:: "^linux-restricted-modules.*"; Dir "/"; Dir::State "var/lib/apt/"; Dir::State::lists "lists/"; Dir::State::cdroms "cdroms.list"; Dir::State::userstatus "status.user"; Dir::State::status "/var/lib/dpkg/status"; Dir::Cache "var/cache/apt/"; Dir::Cache::archives "archives/"; Dir::Cache::srcpkgcache "srcpkgcache.bin"; Dir::Cache::pkgcache "pkgcache.bin"; Dir::Etc "etc/apt/"; Dir::Etc::sourcelist "sources.list"; Dir::Etc::sourceparts "sources.list.d"; Dir::Etc::vendorlist "vendors.list"; Dir::Etc::vendorparts "vendors.list.d"; Dir::Etc::main "apt.conf"; Dir::Etc::parts "apt.conf.d"; Dir::Etc::preferences "preferences"; Dir::Bin ""; Dir::Bin::methods "/usr/lib/apt/methods"; Dir::Bin::dpkg "/usr/bin/dpkg"; Dir::Log "var/log/apt"; Dir::Log::Terminal "term.log"; DPkg ""; DPkg::Pre-Install-Pkgs ""; DPkg::Pre-Install-Pkgs:: "/usr/sbin/dpkg-preconfigure --apt || true"; -- (no /etc/apt/preferences present) -- -- /etc/apt/sources.list -- deb http://ftp2.de.debian.org/debian/ lenny main non-free contrib deb http://security.debian.org lenny/updates main contrib non-free deb-src http://ftp2.de.debian.org/debian/ lenny main non-free contrib #deb http://ftp2.de.debian.org/debian/ unstable main non-free contrib #deb http://packages.dotdeb.org ./ -- System Information: Debian Release: 5.0.3 APT prefers stable APT policy: (500, 'stable') Architecture: i386 (i686) Kernel: Linux 2.6.26-1-686 (SMP w/1 CPU core) Locale: LANG=en_GB, LC_CTYPE=en_GB (charmap=ISO-8859-1) Shell: /bin/sh linked to /bin/bash Versions of packages apt depends on: ii debian-archive-keyring 2009.01.31 GnuPG archive keys of the Debian a ii libc6 2.7-18 GNU C Library: Shared libraries ii libgcc1 1:4.3.2-1.1 GCC support library ii libstdc++6 4.3.2-1.1 The GNU Standard C++ Library v3 apt recommends no packages. Versions of packages apt suggests: pn apt-doc <none> (no description available) ii aptitude 0.4.11.11-1~lenny1 terminal-based package manager ii bzip2 1.0.5-1 high-quality block-sorting file co ii dpkg-dev 1.14.25 Debian package development tools ii lzma 4.43-14 Compression method of 7z format in pn python-apt <none> (no description available) -- no debconf information
--- dpkgpm.cc 2009-02-07 16:09:35.000000000 +0100 +++ dpkgpm.cc.new 2009-11-24 09:23:59.000000000 +0100 @@ -524,6 +524,8 @@ if (!logfile_name.empty()) { term_out = fopen(logfile_name.c_str(),"a"); + if (!term_out) + return _error->Error(_("Cannot open log file '%s'"), logfile_name.c_str()); chmod(logfile_name.c_str(), 0600); // output current time char outstr[200]; @@ -654,7 +656,8 @@ stdin_is_dev_null = false; // create log - OpenLog(); + if (OpenLog() == false) + return false; // this loop is runs once per operation for (vector<Item>::iterator I = List.begin(); I != List.end();)