0.5.15cnc6-alt14

- apt-shell: #5401 fixed (rider@)
- apt-pipe: race during shutting down fixed
This commit is contained in:
Sergey Bolshakov 2005-06-27 18:44:05 +00:00 committed by Dmitry V. Levin
parent a8de0fe5ed
commit 62c21c20e1
3 changed files with 49 additions and 25 deletions

View File

@ -1,7 +1,6 @@
diff -uNr apt-0.5.15cnc6-orig/cmdline/apt-pipe.c apt-0.5.15cnc6/cmdline/apt-pipe.c
--- apt-0.5.15cnc6-orig/cmdline/apt-pipe.c 1970-01-01 03:00:00 +0300
+++ apt-0.5.15cnc6/cmdline/apt-pipe.c 2005-05-31 12:59:58 +0400
@@ -0,0 +1,377 @@
--- apt-0.5.15cnc6/cmdline/apt-pipe.c..pipe 2005-06-27 22:09:57 +0400
+++ apt-0.5.15cnc6/cmdline/apt-pipe.c 2005-06-27 22:29:45 +0400
@@ -0,0 +1,387 @@
+/* ----------------------------------------------------------------------------
+ $Id: apt-pipe.c,v 1.3 2005/03/20 20:56:03 me Exp $
+ */
@ -76,7 +75,7 @@ diff -uNr apt-0.5.15cnc6-orig/cmdline/apt-pipe.c apt-0.5.15cnc6/cmdline/apt-pipe
+ if (bind(servsock, (struct sockaddr *)&sockaddr, sizeof(sockaddr)) < 0)
+ return -1;
+
+ return ((listen(servsock, 2)) < 0 ? -1 : servsock);
+ return ((listen(servsock, 1)) < 0 ? -1 : servsock);
+}
+
+static ssize_t recv_query(int sock, void *buf, size_t bufsize, int *fd)
@ -147,18 +146,22 @@ diff -uNr apt-0.5.15cnc6-orig/cmdline/apt-pipe.c apt-0.5.15cnc6/cmdline/apt-pipe
+ close(fd);
+
+ i = (i < 0);
+ ac = (ac > 0);
+
+ write(sock, &i, sizeof(int));
+ /* send last reply later */
+ if (!ac)
+ write(sock, &i, sizeof(int));
+
+ return(ac > 0);
+ return(ac);
+}
+
+static void mainloop(int servsock) {
+static int mainloop(int servsock) {
+ int cl;
+ int done = 0;
+ char buf[65536];
+
+ while(!signalled && !done) {
+ int cl, fd = -1;
+ int fd = -1;
+ size_t received;
+
+ /* TODO check for pending errors on socket */
@ -170,8 +173,12 @@ diff -uNr apt-0.5.15cnc6-orig/cmdline/apt-pipe.c apt-0.5.15cnc6/cmdline/apt-pipe
+ set_sighandler(SA_RESTART);
+ if ((received = recv_query(cl, buf, sizeof(buf), &fd)) > 0 && fd != -1)
+ done = send_reply(cl, buf, received, fd);
+ close(cl);
+ if (!done)
+ close(cl);
+ }
+
+ close(servsock);
+ return(cl);
+}
+
+static int daemonize()
@ -243,11 +250,13 @@ diff -uNr apt-0.5.15cnc6-orig/cmdline/apt-pipe.c apt-0.5.15cnc6/cmdline/apt-pipe
+ close(fds[1]);
+
+ /* enter main loop */
+ mainloop(fd);
+ fd = mainloop(fd);
+
+ /* cleanup */
+ aptpipe_fini();
+ unlink(APT_PIPE_PATH);
+ if (fd)
+ write(fd, &i, sizeof(int));
+ exit(EXIT_SUCCESS);
+}
+
@ -379,9 +388,8 @@ diff -uNr apt-0.5.15cnc6-orig/cmdline/apt-pipe.c apt-0.5.15cnc6/cmdline/apt-pipe
+
+ return i;
+}
diff -uNr apt-0.5.15cnc6-orig/cmdline/apt-shell.cc apt-0.5.15cnc6/cmdline/apt-shell.cc
--- apt-0.5.15cnc6-orig/cmdline/apt-shell.cc 2005-05-31 12:56:51 +0400
+++ apt-0.5.15cnc6/cmdline/apt-shell.cc 2005-05-31 13:00:50 +0400
--- apt-0.5.15cnc6/cmdline/apt-shell.cc..pipe 2005-06-27 22:09:57 +0400
+++ apt-0.5.15cnc6/cmdline/apt-shell.cc 2005-06-27 22:09:57 +0400
@@ -1,4 +1,4 @@
-// -*- mode: cpp; mode: fold -*-
+// -*- mode: c++; mode: folding -*-
@ -399,7 +407,7 @@ diff -uNr apt-0.5.15cnc6-orig/cmdline/apt-shell.cc apt-0.5.15cnc6/cmdline/apt-sh
#include <fnmatch.h>
/*}}}*/
@@ -3721,9 +3723,7 @@
@@ -3724,9 +3726,7 @@
return true;
return _error->Error(_("No packages found"));
}
@ -410,7 +418,7 @@ diff -uNr apt-0.5.15cnc6-orig/cmdline/apt-shell.cc apt-0.5.15cnc6/cmdline/apt-sh
// ShowHelp - Show a help screen /*{{{*/
// ---------------------------------------------------------------------
@@ -4100,6 +4100,7 @@
@@ -4105,6 +4105,7 @@
}
/*}}}*/
@ -418,7 +426,7 @@ diff -uNr apt-0.5.15cnc6-orig/cmdline/apt-shell.cc apt-0.5.15cnc6/cmdline/apt-sh
// ReadLine* - readline library stuff /*{{{*/
// ---------------------------------------------------------------------
/* */
@@ -4267,6 +4268,7 @@
@@ -4272,6 +4273,7 @@
write_history(History.c_str());
}
/*}}}*/
@ -426,7 +434,7 @@ diff -uNr apt-0.5.15cnc6-orig/cmdline/apt-shell.cc apt-0.5.15cnc6/cmdline/apt-sh
CommandLine::Args *CommandArgs(const char *Name)
{
@@ -4387,6 +4389,138 @@
@@ -4392,6 +4394,138 @@
}
}
/*}}}*/
@ -565,16 +573,15 @@ diff -uNr apt-0.5.15cnc6-orig/cmdline/apt-shell.cc apt-0.5.15cnc6/cmdline/apt-sh
int main(int argc,const char *argv[])
{
CommandLine::Dispatch Cmds[] = {{"update",&DoUpdate},
@@ -4605,5 +4739,5 @@
@@ -4610,5 +4744,5 @@
return 0;
}
-
+#endif
// vim:sts=3:sw=3
diff -uNr apt-0.5.15cnc6-orig/cmdline/Makefile.am apt-0.5.15cnc6/cmdline/Makefile.am
--- apt-0.5.15cnc6-orig/cmdline/Makefile.am 2005-05-31 12:56:51 +0400
+++ apt-0.5.15cnc6/cmdline/Makefile.am 2005-05-31 12:59:58 +0400
--- apt-0.5.15cnc6/cmdline/Makefile.am..pipe 2005-06-27 22:09:57 +0400
+++ apt-0.5.15cnc6/cmdline/Makefile.am 2005-06-27 22:09:57 +0400
@@ -4,7 +4,7 @@
bin_PROGRAMS = apt-get apt-cache apt-cdrom apt-config

View File

@ -0,0 +1,11 @@
diff -urN apt-0.5.15cnc6.orig/apt-pkg/contrib/cmndline.cc apt-0.5.15cnc6/apt-pkg/contrib/cmndline.cc
--- apt-0.5.15cnc6.orig/apt-pkg/contrib/cmndline.cc 2003-03-06 22:39:48 +0300
+++ apt-0.5.15cnc6/apt-pkg/contrib/cmndline.cc 2005-06-22 18:25:34 +0400
@@ -333,6 +333,7 @@
bool CommandLine::DispatchArg(Dispatch *Map,bool NoMatch)
{
int I;
+ if (FileSize() == 0) return false;
for (I = 0; Map[I].Match != 0; I++)
{
if (strcmp(FileList[0],Map[I].Match) == 0)

View File

@ -1,8 +1,8 @@
# $Id: apt,v 1.16 2005/06/16 11:19:22 me Exp $
# $Id: apt,v 1.21 2005/06/27 18:38:02 me Exp $
Name: apt
Version: 0.5.15cnc6
Release: alt13
Release: alt14
Summary: Debian's Advanced Packaging Tool with RPM support
Summary(ru_RU.KOI8-R): Debian APT - õÓÏ×ÅÒÛÅÎÓÔ×Ï×ÁÎÎÏÅ ÓÒÅÄÓÔ×Ï ÕÐÒÁ×ÌÅÎÉÑ ÐÁËÅÔÁÍÉ Ó ÐÏÄÄÅÒÖËÏÊ RPM
@ -48,7 +48,8 @@ Patch34: apt-0.5.15cnc6-alt-umount.patch
Patch35: apt-0.5.15cnc6-alt-apt-get-TryToInstall.patch
Patch36: apt-0.5.15cnc6-alt-lsgroup.patch
Patch37: apt-0.5.15cnc6-alt-apt-shell-dl.patch
Patch38: apt-0.5.15cnc6-alt-apt-pipe.patch
Patch38: apt-0.5.15cnc6-alt-dash-cmd.patch
Patch39: apt-0.5.15cnc6-alt-apt-pipe.patch
# Normally not applied, but useful.
Patch101: apt-0.5.4cnc9-alt-getsrc-debug.patch
@ -239,6 +240,7 @@ This package contains method 'rsync' for APT.
%patch36 -p1
%patch37 -p1
%patch38 -p1
%patch39 -p1
find -type f -name \*.orig -delete -print
@ -354,6 +356,10 @@ fi
# Probably %%doc with README.rsync?
%changelog
* Mon Jun 27 2005 Sergey Bolshakov <sbolshakov@altlinux.ru> 0.5.15cnc6-alt14
- apt-shell: #5401 fixed (rider@)
- apt-pipe: race during shutting down fixed
* Thu Jun 16 2005 Sergey Bolshakov <sbolshakov@altlinux.ru> 0.5.15cnc6-alt13
- apt-shell: possible fix of #4707 (rider@)