소스 검색

lib/mlib.c: fix error reporting for reading data in do_fd_copy
optlib/Makefile.am: remove (can't believe this still existed!)
utils/Makefile.in: link md5sum with our own libintl if needed
archtable, scripts/dpkg-architecture.pl: add freebsd-i386
acconfig.h, configure.in, doc/Makefile.in: make building documentation and start-stop-daemon optional
main/help.c: only check for start-stop-daemon in checkpatch() if we build it

Wichert Akkerman 26 년 전
부모
커밋
14224556ba
14개의 변경된 파일104개의 추가작업 그리고 56개의 파일을 삭제
  1. 15 0
      ChangeLog
  2. 2 0
      acconfig.h
  3. 1 0
      archtable
  4. 24 0
      configure.in
  5. 6 0
      doc/Makefile.in
  6. 3 7
      dpkg-deb/build.c
  7. 1 1
      dpkg-deb/info.c
  8. 1 1
      include/dpkg.h.in
  9. 30 22
      lib/mlib.c
  10. 1 1
      lib/showcright.c
  11. 5 2
      main/help.c
  12. 0 19
      optlib/Makefile.am
  13. 2 1
      scripts/dpkg-architecture.pl
  14. 13 2
      utils/Makefile.in

+ 15 - 0
ChangeLog

@@ -1,6 +1,21 @@
 Thu Nov 23 17:52:44 CET 2000 Wichert Akkerman <wakkerma@debian.org>
 
   * lib/fields.c, lib/dump.c: fix two memory leaks
+  * More Adam Heath patches:
+    + lib/mlib.c, include/dpkg.h.in: add new option for do_fd_copy to
+      specify buffersize
+    + dpkg-deb/build.c, lib/info.c, lib/showcright.c: update for new
+      do_fd_copy
+    + dpkg-deb/extract.c: use do_fd_copy to read data instead of reading
+      per character.
+  * lib/mlib.c: fix error reporting for reading data in do_fd_copy
+  * optlib/Makefile.am: remove (can't believe this still existed!)
+  * utils/Makefile.in: link md5sum with our own libintl if needed
+  * archtable, scripts/dpkg-architecture.pl: add freebsd-i386
+  * acconfig.h, configure.in, doc/Makefile.in: make building documentation
+    and start-stop-daemon optional
+  * main/help.c: only check for start-stop-daemon in checkpatch() if we
+    build it
 
 Thu Nov 23 15:48:53 CET 2000 Wichert Akkerman <wakkerma@debian.org>
 

+ 2 - 0
acconfig.h

@@ -72,3 +72,5 @@
 /* Define the ptrdiff_t type if your system doesn't have it */
 #undef ptrdiff_t
 
+/* Define if start-stop-daemon is compiled */
+#undef USE_START_STOP_DAEMON

+ 1 - 0
archtable

@@ -38,3 +38,4 @@ shel-linux-gnu		sh		sh
 hppa-linux-gnu		hppa		hppa
 hppa1.1-linux-gnu	hppa		hppa
 hppa2.0-linux-gnu	hppa		hppa
+i386-freebsd		freebsd-i386	freebsd-i386

+ 24 - 0
configure.in

@@ -16,6 +16,30 @@ AC_ARG_WITH(dselect,
  esac])
 AC_SUBST(DSELECTDIR)
 
+USE_START_STOP_DAEMON="true"
+AC_ARG_WITH(start-stop-daemon,
+[  --with-start-stop-daemon
+                          start and stop system daemons],
+[case "$withval" in
+  "false" | "no" )
+    USE_START_STOP_DAEMON=""
+    ;;
+ esac])
+AC_SUBST(USE_START_STOP_DAEMON)
+if test "$USE_START_STOP_DAEMON" != ""; then
+    AC_DEFINE(USE_START_STOP_DAEMON)
+fi
+
+USE_SGML_DOC="true"
+AC_ARG_WITH(sgml-doc,
+[  --with-sgml-doc         SGML documentation converted to HTML],
+[case "$withval" in
+  "false" | "no" )
+    USE_SGML_DOC=""
+    ;;
+ esac])
+AC_SUBST(USE_SGML_DOC)
+
 admindir="$libdir/db"
 AC_ARG_WITH(admindir,
 [  --with-admindir=DIR     store dpkg database in DIR [LIBDIR/db]],

+ 6 - 0
doc/Makefile.in

@@ -8,7 +8,11 @@ include ../Makefile.conf
 
 MAN5PAGES	= deb-control.5 deb-old.5 deb.5
 
+ifeq (@USE_SGML_DOC@, true)
 all: internals.html/index.html all-recursive
+else
+all: all-recursive
+endif
 
 clean: clean-recursive
 	$(RM) $(srcdir)/manuals-version
@@ -33,11 +37,13 @@ install-doc: install-doc-recursive
 		if test -f $$i ; then d= ; else d="$(srcdir)/" ; fi ; \
 		$(INSTALL_DATA) $$d$$i $(DESTDIR)$(man5dir) ; \
 	done
+ifeq (@USE_SGML_DOC@, true)
 	$(mkinstalldirs) $(DESTDIR)$(docdir)/internals/
 	set -e ; for i in internals.html/* ; do \
 		bn=`basename $$i` ; \
 		$(INSTALL_DATA) $$i $(DESTDIR)$(docdir)/internals/$$bn ; \
 	done
+endif
 	$(INSTALL_DATA) $(srcdir)/ChangeLog $(DESTDIR)$(docdir)/ChangeLog.manuals
 	set -e ; for i in ChangeLog THANKS TODO ; do \
 		$(INSTALL_DATA) $(top_srcdir)/$$i $(DESTDIR)$(docdir) ; \

+ 3 - 7
dpkg-deb/build.c

@@ -364,7 +364,7 @@ void do_build(const char *const *argv) {
   }                
                 
   if (lseek(gzfd,0,SEEK_SET)) ohshite(_("failed to rewind tmpfile (control)"));
-  do_fd_copy(gzfd, fileno(ar), _("control"));
+  do_fd_copy(gzfd, fileno(ar), -1, _("control"));
 
   /* Control is done, now we need to archive the data. Start by creating
    * a new temporary file. Immediately unlink the temporary file so others
@@ -422,7 +422,7 @@ void do_build(const char *const *argv) {
     combuf = strdup("-9c");
     if(compression != NULL) {
       if(*compression == '0') {
-	do_fd_copy(0, 1, _("no compression copy loop"));
+	do_fd_copy(0, 1, -1, _("no compression copy loop"));
 	exit(0);
       }
       combuf[1] = *compression;
@@ -456,11 +456,7 @@ void do_build(const char *const *argv) {
       werr(debar);
 
     if (lseek(gzfd,0,SEEK_SET)) ohshite(_("failed to rewind tmpfile (data)"));
-    if (!(c3= m_fork())) {
-      m_dup2(gzfd,0); m_dup2(fileno(ar),1);
-      execlp(CAT,"cat",(char*)0); ohshite(_("failed to exec cat (data)"));
-    }
-    waitsubproc(c3,"cat (data)",0);
+    do_fd_copy(gzfd, fileno(ar), -1, _("cat (data)"));
 
     if (datastab.st_size & 1)
       if (putc('\n',ar) == EOF)

+ 1 - 1
dpkg-deb/info.c

@@ -90,7 +90,7 @@ static void info_spew(const char *debar, const char *directory,
   while ((component= *argv++) != 0) {
     co= fopen(component,"r");
     if (co) {
-      do_fd_copy(fileno(co), 1, _("info_spew"));
+      do_fd_copy(fileno(co), 1, -1, _("info_spew"));
     } else if (errno == ENOENT) {
       if (fprintf(stderr, _("dpkg-deb: `%.255s' contains no control component `%.255s'\n"),
                   debar, component) == EOF) werr("stderr");

+ 1 - 1
include/dpkg.h.in

@@ -199,7 +199,7 @@ void m_pipe(int fds[2]);
 void checksubprocerr(int status, const char *description, int sigpipeok);
 void waitsubproc(pid_t pid, const char *description, int sigpipeok);
 
-int do_fd_copy(int fd1, int fd2, char *desc);
+int do_fd_copy(int fd1, int fd2, int limit, char *desc);
 
 extern volatile int onerr_abort;
 

+ 30 - 22
lib/mlib.c

@@ -123,9 +123,9 @@ void waitsubproc(pid_t pid, const char *description, int sigpipeok) {
   checksubprocerr(status,description,sigpipeok);
 }
 
-int do_fd_copy(int fd1, int fd2, char *desc) {
+int do_fd_copy(int fd1, int fd2, int limit, char *desc) {
     char *buf, *sbuf;
-    int count;
+    int count, bufsize = 32768;
     char *er_msg_1 = _("failed to allocate buffer for copy (%s)");
     char *er_msg_2 = _("failed in copy on write (%s)");
     char *er_msg_3 = _("failed in copy on read (%s)");
@@ -137,32 +137,40 @@ int do_fd_copy(int fd1, int fd2, char *desc) {
     snprintf(sbuf, count, er_msg_1, desc);
     sbuf[count-1] = 0;
 
-    buf = malloc(32768);
+    if((limit != -1) && (limit < bufsize))
+	bufsize = limit;
+    buf = malloc(bufsize);
     if(buf == NULL)
 	ohshite(sbuf);
     free(sbuf);
 
-    count = strlen(er_msg_2) + strlen(desc) + 1;
-    sbuf = malloc(count);
-    if(sbuf == NULL)
-	ohshite(_("failed to allocate buffer for snprintf 2"));
-    snprintf(sbuf, count, er_msg_2, desc);
-    sbuf[count-1] = 0;
-
-    while((count = read(fd1, buf, 32768)) > 0)
-	if(write(fd2, buf, count) < count)
-		ohshite(sbuf);
-
+    while((count = read(fd1, buf, bufsize)) > 0) {
+	if(write(fd2, buf, count) < count) {
+	  count = strlen(er_msg_2) + strlen(desc) + 1;
+	  sbuf = malloc(count);
+	  if(sbuf == NULL)
+	    ohshite(_("failed in copy on write"));
+	  snprintf(sbuf, count, er_msg_2, desc);
+	  sbuf[count-1] = 0;
+	  ohshite(sbuf);
+	}
+	if(limit != -1) {
+	    limit -= count;
+	    if(limit < bufsize)
+		bufsize = limit;
+	}
+    }
     free(sbuf);
-    count = strlen(er_msg_3) + strlen(desc) + 1;
-    sbuf = malloc(count);
-    if(sbuf == NULL)
-	ohshite(_("failed to allocate buffer for snprintf 2"));
-    snprintf(sbuf, count, er_msg_3, desc);
-    sbuf[count-1] = 0;
+    if (count<0) {
+      count = strlen(er_msg_3) + strlen(desc) + 1;
+      sbuf = malloc(count);
+      if(sbuf == NULL)
+	ohshite(_("failed in copy on read"));
+      snprintf(sbuf, count, er_msg_3, desc);
+      sbuf[count-1] = 0;
+      ohsite(sbuf);
+    }
 
-    if(count < 0)
-	ohshite(_("failed in copy on read (control)"));
     free(sbuf);
     free(buf);
 }

+ 1 - 1
lib/showcright.c

@@ -29,6 +29,6 @@ void showcopyright(const struct cmdinfo *c, const char *v) {
   int fd;
   fd= open(COPYINGFILE,O_RDONLY);
   if (fd < 0) ohshite(_("cannot open GPL file "));
-  do_fd_copy(fd, 1, "showcopyright");
+  do_fd_copy(fd, 1, -1, "showcopyright");
   exit(0);
 }

+ 5 - 2
main/help.c

@@ -69,8 +69,11 @@ struct filenamenode *namenodetouse(struct filenamenode *namenode, struct pkginfo
 
 void checkpath(void) {
 /* Verify that some programs can be found in the PATH. */
-  static const char *const checklist[]= {
-    "ldconfig", "start-stop-daemon", "install-info", "update-rc.d", 0
+  static const char *const checklist[]= { "ldconfig", 
+#ifdef USE_START_STOP_DAEMON
+    "start-stop-daemon",
+#endif    
+    "install-info", "update-rc.d", 0
   };
 
   struct stat stab;

+ 0 - 19
optlib/Makefile.am

@@ -1,19 +0,0 @@
-## Process this file with automake to produce Makefile.in
-noinst_LIBRARIES = liboptlib.a
-
-EXTRA_DIST = getdate.c
-
-INCLUDES = -I.. -I$(srcdir) 
-
-liboptlib_a_SOURCES = getopt.c getopt1.c long-options.c closeout.c
-
-#liboptlib_a_LIBADD = @LIBOBJS@ @ALLOCA@
-liboptlib_a_DEPENDENCIES = $(liboptlib_a_LIBADD)
-
-noinst_HEADERS = getopt.h long-options.h closeout.h error.h
-
-BUILT_SOURCES = 
-
-# Remove these files here... they are created locally
-DISTCLEANFILES = $(BUILT_SOURCES) .deps/* *~
-

+ 2 - 1
scripts/dpkg-architecture.pl

@@ -59,7 +59,8 @@ require 'controllib.pl';
 	    'sh',        'sh-linux',
 	    'shed',      'shed-linux',
 	    'hppa',      'hppa-linux',
-	    'hurd-i386', 'i386-gnu');
+	    'hurd-i386', 'i386-gnu',
+	    'freebsd-i386', 'i386-freebsd');
 
 sub usageversion {
     print STDERR

+ 13 - 2
utils/Makefile.in

@@ -15,11 +15,17 @@ MD5_SOURCES		= md5sum.c md5.c
 MD5_OBJECTS		= $(patsubst %.c, %.o, $(MD5_SOURCES))
 MD5_MANPAGES		= md5sum.1
 
-GENFILES		= $(SSD_OBJECTS) start-stop-daemon \
-			  $(MD5_OBJECTS) md5sum
+GENFILES		= $(MD5_OBJECTS) md5sum
+ifeq (@USE_START_STOP_DAEMON@, true)
+GENFILES		+= $(SSD_OBJECTS) start-stop-daemon
+endif
 
 .PHONY: all
+ifeq (@USE_START_STOP_DAEMON@, true)
 all:: start-stop-daemon md5sum
+else
+all:: md5sum
+endif
 
 .PHONY: install
 install:: all
@@ -37,15 +43,19 @@ install:: install-program install-doc
 
 .PHONY: install-program
 install-program:
+ifeq (@USE_START_STOP_DAEMON@, true)
 	$(mkinstalldirs) $(DESTDIR)/$(sbindir)
 	$(INSTALL) start-stop-daemon $(DESTDIR)/$(sbindir)
+endif
 	$(mkinstalldirs) $(DESTDIR)/$(bindir)
 	$(INSTALL) md5sum $(DESTDIR)/$(bindir)
 
 .PHONY: install-doc
 install-doc:
+ifeq (@USE_START_STOP_DAEMON@, true)
 	$(mkinstalldirs) $(DESTDIR)/$(man8dir)
 	$(INSTALL_DATA) $(srcdir)/$(SSD_MANPAGES) $(DESTDIR)/$(man8dir)
+endif
 	$(mkinstalldirs) $(DESTDIR)/$(man1dir)
 	$(INSTALL_DATA) $(srcdir)/$(MD5_MANPAGES) $(DESTDIR)/$(man1dir)
 
@@ -53,4 +63,5 @@ start-stop-daemon: $(SSD_OBJECTS) ../optlib/libopt.a
 	$(CC) $(LDFLAGS) -o $@ $^ $(SSD_LIBS)
 
 md5sum: $(MD5_OBJECTS) ../optlib/libopt.a
+	$(CC) $(LDFLAGS) -o $@ $^ $(NLS_LIBS)