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

Bug#44706: apt: Dpkg-Prexec broken

Package: apt
Version: 0.3.12
Severity: normal

root@gumdrop:/home/joey>apt-get install acct
Reading Package Lists... Done
Building Dependency Tree... Done
The following NEW packages will be installed:
0 packages upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
1 packages not fully installed or removed.
Need to get 0B/89.2kB of archives. After unpacking 197kB will be used.
/bin/sh: /bin/sh: cannot execute binary file
E: Write error - write (32 Broken pipe)
root@gumdrop:/home/joey>cat /etc/apt/apt.conf
// Pre-configure all packages before they are installed.
DPkg::Pre-Install-Pkgs {"/tmp/foo";};
joey@gumdrop:~>cat /tmp/foo
while (<>) {
	print STDERR "got: $_\n";
Strace shows /bin/sh trying to open an ELF executable. Here's a patch, you
aren't supposed to call execv with a dupliacted first argument, like you do
with some exec's.

--- dpkgpm.cc~	Fri Sep  3 09:03:48 1999
+++ dpkgpm.cc	Thu Sep  9 12:37:00 1999
@@ -178,10 +178,9 @@
 	 const char *Args[5];
 	 Args[0] = "/bin/sh";
-	 Args[1] = "/bin/sh";
-	 Args[2] = "-c";
-	 Args[3] = Opts->Value.c_str();
-	 Args[4] = 0;
+	 Args[1] = "-c";
+	 Args[2] = Opts->Value.c_str();
+	 Args[3] = 0;
 	 execv(Args[0],(char **)Args);

The next problem is that your the for loop in the same function as the above
code doesn't increment, so it loops endlessly, feeding the same package name
in over and over. Line 199 of dpkgmm.cc needs to be:

      for (vector<Item>::iterator I = List.begin(); I != List.end(); I++)

Looks like the new feature works ok with these two patches.

-- System Information
Debian Release: potato
Kernel Version: Linux gumdrop 2.2.10 #1 SMP Thu Jun 24 12:25:56 PDT 1999 i686 unknown

Versions of the packages apt depends on:
ii  libc6           2.1.2-1        GNU C Library: Shared libraries and timezone
ii  libstdc++2.10   2.95.1-2       The GNU stdc++ library

Reply to: