Cherrypick from master 2004-04-24 22:15:22 UTC Jakub Bogusz <qboosh@pld-linux.org> '- type fixes, incl. SEGV on 64-bit archs':
poldek-cap_match_req-fix.patch -> 1.1
poldek-etc_dir.patch -> 1.2
poldek-retr_term.patch -> 1.1
poldek-types.patch -> 1.1
Cherrypick from master 2004-12-01 16:49:21 UTC Paweł Sikora <pluto@pld-linux.org> '- temp. workaround for new rpm's api (thx. to Miś).':
poldek-capreq.patch -> 1.1
--- /dev/null
+Index: pkg.c
+===================================================================
+RCS file: /cvsroot/installer/poldek/pkg.c,v
+retrieving revision 1.51.4.2
+diff -u -r1.51.4.2 pkg.c
+--- pkg.c 30 Dec 2003 18:19:52 -0000 1.51.4.2
++++ pkg.c 19 Feb 2004 00:18:18 -0000
+@@ -717,6 +717,9 @@
+ if ((strcmp(capreq_name(cap), capreq_name(req))) != 0)
+ return 0;
+
++ if (!capreq_versioned(req))
++ return 1;
++
+ if (capreq_has_epoch(cap)) {
+ if (!capreq_has_epoch(req) && poldek_conf_promote_epoch) {
+ if (verbose > 1)
--- /dev/null
+--- installer/poldek/capreq.c 2004/01/10 12:45:34 1.25.4.1
++++ installer/poldek/capreq.c 2004/12/01 16:24:52 1.25.4.2
+@@ -639,24 +639,22 @@
+ if (flag & RPMSENSE_EQUAL)
+ cr->cr_relflags |= REL_EQ;
+
+-
++ if (crtype == CRTYPE_REQ) {
+ #ifndef HAVE_RPM_EXTDEPS
+- if (flag & RPMSENSE_PREREQ) {
+- n_assert(crtype == CRTYPE_REQ);
+- cr->cr_flags |= CAPREQ_PREREQ | CAPREQ_PREREQ_UN;
+- }
++ if (flag & RPMSENSE_PREREQ) {
++ n_assert(crtype == CRTYPE_REQ);
++ cr->cr_flags |= CAPREQ_PREREQ | CAPREQ_PREREQ_UN;
++ }
+ #else
+- if (isLegacyPreReq(flag)) { /* prepared by rpm < 4.0.2 */
+- n_assert(crtype == CRTYPE_REQ);
+- cr->cr_flags |= CAPREQ_PREREQ | CAPREQ_PREREQ_UN;
++ if (isLegacyPreReq(flag)) { /* prepared by rpm < 4.0.2 */
++ cr->cr_flags |= CAPREQ_PREREQ | CAPREQ_PREREQ_UN;
+
+- } else if (isInstallPreReq(flag)) {
+- n_assert(crtype == CRTYPE_REQ);
+- cr->cr_flags |= CAPREQ_PREREQ;
++ } else if (isInstallPreReq(flag)) {
++ cr->cr_flags |= CAPREQ_PREREQ;
+
+- } else if (isErasePreReq(flag)) {
+- n_assert(crtype == CRTYPE_REQ);
+- cr->cr_flags |= CAPREQ_PREREQ_UN;
++ } else if (isErasePreReq(flag)) {
++ cr->cr_flags |= CAPREQ_PREREQ_UN;
++ }
+ }
+ #endif /* HAVE_RPM_EXTDEPS */
+ }
--- /dev/null
+diff -Nru poldek-0.18.1/conf.c poldek-0.18.1.new/conf.c
+--- poldek-0.18.1/conf.c Fri Oct 18 16:19:42 2002
++++ poldek-0.18.1.new/conf.c Mon Mar 10 07:39:16 2003
+@@ -374,14 +374,23 @@
+ tn_hash *ldconf_deafult(void)
+ {
+ char *homedir;
++ char *etc_dir;
+ char *etcpath = "/etc/poldek.conf";
+
+- if ((homedir = getenv("HOME")) != NULL) {
++ if ((etc_dir = getenv("HOME_ETC")) != NULL) {
++ char path[PATH_MAX];
++
++ snprintf(path, sizeof(path), "%s/.poldekrc", etc_dir);
++ if (access(path, R_OK) == 0)
++ return ldconf(path);
++ } else {
++ if ((homedir = getenv("HOME")) != NULL) {
+ char path[PATH_MAX];
+
+ snprintf(path, sizeof(path), "%s/.poldekrc", homedir);
+ if (access(path, R_OK) == 0)
+ return ldconf(path);
++ }
+ }
+
+ if (access(etcpath, R_OK) == 0)
+diff -Nru poldek-0.18.1/pkgscore.c poldek-0.18.1.new/pkgscore.c
+--- poldek-0.18.1/pkgscore.c Fri Nov 22 17:08:53 2002
++++ poldek-0.18.1.new/pkgscore.c Mon Mar 10 07:44:02 2003
+@@ -40,26 +40,46 @@
+
+ if (fpath == NULL) {
+ char *homedir;
++ char *etc_dir;
+
+- if ((homedir = getenv("HOME")) == NULL)
++ if ((etc_dir = getenv("HOME_ETC")) != NULL) {
++ switch (type) {
++ case PKG_HELD:
++ snprintf(path, sizeof(path), "%s/.poldek-hold", etc_dir);
++ if (access(path, R_OK) != 0) /* backward compat */
++ snprintf(path, sizeof(path), "%s/.poldek_hold", etc_dir);
++
++ break;
++
++ case PKG_IGNORED:
++ snprintf(path, sizeof(path), "%s/.poldek-ignore", etc_dir);
++ break;
++
++ default:
++ n_assert(0);
++ break;
++ }
++ } else {
++ if ((homedir = getenv("HOME")) == NULL)
+ return NULL;
+
+- switch (type) {
+- case PKG_HELD:
+- snprintf(path, sizeof(path), "%s/.poldek-hold", homedir);
+- if (access(path, R_OK) != 0) /* backward compat */
++ switch (type) {
++ case PKG_HELD:
++ snprintf(path, sizeof(path), "%s/.poldek-hold", homedir);
++ if (access(path, R_OK) != 0) /* backward compat */
+ snprintf(path, sizeof(path), "%s/.poldek_hold", homedir);
+-
+- break;
++
++ break;
++
++ case PKG_IGNORED:
++ snprintf(path, sizeof(path), "%s/.poldek-ignore", homedir);
++ break;
+
+- case PKG_IGNORED:
+- snprintf(path, sizeof(path), "%s/.poldek-ignore", homedir);
+- break;
+-
+- default:
+- n_assert(0);
+- break;
+- }
++ default:
++ n_assert(0);
++ break;
++ }
++ }
+
+ if (access(path, R_OK) != 0)
+ return patterns;
+diff -Nru poldek-0.18.1/shell/shell.c poldek-0.18.1.new/shell/shell.c
+--- poldek-0.18.1/shell/shell.c Tue Oct 29 16:55:58 2002
++++ poldek-0.18.1.new/shell/shell.c Mon Mar 10 07:50:21 2003
+@@ -1226,7 +1226,7 @@
+
+ int shell_main(struct pkgset *ps, struct inst_s *inst, int skip_installed)
+ {
+- char *line, *s, *home;
++ char *line, *s, *home, *etc_dir;
+
+
+ if (!isatty(fileno(stdout))) {
+@@ -1240,12 +1240,19 @@
+ initialize_readline();
+ histfile = NULL;
+
+- if ((home = getenv("HOME"))) {
++ if ((etc_dir = getenv("HOME_ETC"))) {
++ int len = strlen(etc_dir) + strlen("/.poldek_history") + 2;
++ histfile = alloca(len);
++ snprintf(histfile, len, "%s/.poldek_history", etc_dir);
++ read_history(histfile);
++ } else {
++ if ((home = getenv("HOME"))) {
+ int len = strlen(home) + strlen("/.poldek_history") + 2;
+ histfile = alloca(len);
+ snprintf(histfile, len, "%s/.poldek_history", home);
+ read_history(histfile);
+- }
++ }
++ }
+
+ sigint_init();
+ sigint_reached_cb = sigint_reached_fn;
--- /dev/null
+diff -urN poldek-0.18.1.orig/vfile/Makefile.am poldek-0.18.1/vfile/Makefile.am
+--- poldek-0.18.1.orig/vfile/Makefile.am Thu Oct 24 18:23:12 2002
++++ poldek-0.18.1/vfile/Makefile.am Fri May 2 10:55:06 2003
+@@ -21,10 +21,10 @@
+ vlibs = vftp/libvftp.a vhttp/libvhttp.a
+
+ noinst_PROGRAMS = sample ttest
+-sample_SOURCES = sample.c
++sample_SOURCES = sample.c ../poldek_term.c ../log.c
+ sample_LDADD = libvfile.a $(vlibs) @TRURL_LDFLAG@ $(LDADD_) $(top_srcdir)/sigint/libsigint.a
+
+-ttest_SOURCES = ttest.c
++ttest_SOURCES = ttest.c ../poldek_term.c ../log.c
+ ttest_LDADD = libvfile.a $(vlibs) @TRURL_LDFLAG@ $(LDADD_) $(top_srcdir)/sigint/libsigint.a
+ EXTRA_DIST = $(VFCURL_SRCS) \
+ testcookie.c test_progress.c
+diff -urN poldek-0.18.1.orig/vfile/vfile.c poldek-0.18.1/vfile/vfile.c
+--- poldek-0.18.1.orig/vfile/vfile.c Tue Oct 29 17:55:56 2002
++++ poldek-0.18.1/vfile/vfile.c Fri May 2 10:59:25 2003
+@@ -42,6 +42,7 @@
+ #include <trurl/nmalloc.h>
+
+ #include "i18n.h"
++#include "../poldek_term.h"
+
+ #define VFILE_INTERNAL
+ #include "vfile.h"
+@@ -224,6 +225,10 @@
+ return mod;
+ }
+
++const char *PR_URL(const char *url) {
++ return vf_url_slim_s(url, term_get_width()-strlen(_("Retrieving %s...\n"))-4);
++}
++
+ int vfile_fetcha(const char *destdir, tn_array *urls, int urltype)
+ {
+ const struct vf_module *mod = NULL;
+diff -urN poldek-0.18.1.orig/vfile/vfile.h poldek-0.18.1/vfile/vfile.h
+--- poldek-0.18.1.orig/vfile/vfile.h Thu Nov 7 17:43:29 2002
++++ poldek-0.18.1/vfile/vfile.h Fri May 2 10:20:18 2003
+@@ -189,7 +189,7 @@
+
+ /* short alias for */
+ #define CL_URL(url) vf_url_hidepasswd_s(url)
+-#define PR_URL(url) vf_url_slim_s(url, 60)
++//#define PR_URL(url) vf_url_slim_s(url, 60)
+
+
+
--- /dev/null
+--- poldek-cvs20040323/pkgdir_digest.c.orig 2002-05-15 17:53:22.000000000 +0200
++++ poldek-cvs20040323/pkgdir_digest.c 2004-04-24 23:39:17.927522138 +0200
+@@ -197,7 +197,8 @@
+ static
+ int hdr_digest(FILE *stream, unsigned char *md, int *md_size, EVP_MD_CTX *_ctx)
+ {
+- int line_size = 0, nread, len, endvhdr_found = 0;
++ size_t line_size = 0;
++ int nread, len, endvhdr_found = 0;
+ unsigned char buf[256];
+ char *linebuf = NULL;
+ EVP_MD_CTX ctx;
+--- poldek-cvs20040323/trurlib/n_array_dump_stats.c.orig 2000-10-29 22:12:21.000000000 +0100
++++ poldek-cvs20040323/trurlib/n_array_dump_stats.c 2004-04-24 23:45:50.159356575 +0200
+@@ -5,6 +5,6 @@
+ void n_array_dump_stats(const tn_array *arr, const char *name)
+ {
+
+- printf("\nArray \"%s\" [memsize, items, start_index] = %d, %d, %d\n",
++ printf("\nArray \"%s\" [memsize, items, start_index] = %zd, %zd, %zd\n",
+ name ? name : "", arr->allocated, arr->items, arr->start_index);
+ }
+--- poldek-cvs20040323/trurlib/n_hash_stats.c.orig 2000-10-29 22:12:21.000000000 +0100
++++ poldek-cvs20040323/trurlib/n_hash_stats.c 2004-04-24 23:47:50.222234706 +0200
+@@ -31,7 +31,7 @@
+ maxdeep = deep;
+ }
+
+- printf("%p %d items, %d emptys, %d collisions, maxdeep %d\n", ht,
++ printf("%p %zd items, %d emptys, %d collisions, maxdeep %d\n", ht,
+ ht->items, nempts, ncolls, maxdeep);
+ return n;
+ }
+--- poldek-cvs20040323/trurlib/nstr_tokl.c.orig 2003-04-30 17:53:02.000000000 +0200
++++ poldek-cvs20040323/trurlib/nstr_tokl.c 2004-04-24 23:48:43.078415374 +0200
+@@ -24,6 +24,7 @@
+ */
+ #include <ctype.h>
+ #include <stdlib.h>
++#include <stdio.h>
+ #include <string.h>
+
+ #include "nmalloc.h"
+--- poldek-cvs20040323/vfile/vhttp/test_vhttp.c.orig 2002-04-08 19:21:37.000000000 +0200
++++ poldek-cvs20040323/vfile/vhttp/test_vhttp.c 2004-04-24 23:52:37.708518571 +0200
+@@ -1,4 +1,5 @@
+ #include <stdio.h>
++#include <stdlib.h>
+ #include "vhttp.h"
+ #include "http.h"
+
+--- poldek-cvs20040323/pkgdir.c.orig 2004-03-11 00:27:42.000000000 +0100
++++ poldek-cvs20040323/pkgdir.c 2004-04-24 23:57:45.955765417 +0200
+@@ -509,7 +509,8 @@
+ char *dn, *bn;
+ struct vfile *vf;
+ char *linebuf = NULL;
+- int line_size = 0, nread, nerr = 0, rc;
++ size_t line_size = 0;
++ int nread, nerr = 0, rc;
+ const char *errmsg_broken_difftoc = _("%s: broken patch list");
+ char current_mdd[PDIGEST_SIZE + 1];
+ struct pdigest pdg_current;
+@@ -719,7 +720,8 @@
+ struct pkgdir *pkgdir = NULL;
+ struct vfile *vf;
+ char *linebuf;
+- int line_size, nline;
++ size_t line_size;
++ int nline;
+ int nerr = 0, nread;
+ struct pkgroup_idx *pkgroups = NULL;
+ time_t ts = 0, ts_orig = 0;
+@@ -990,7 +992,7 @@
+ struct pkgtags_s pkgt;
+ off_t offs;
+ char *linebuf;
+- int line_size;
++ size_t line_size;
+ int nerr = 0, nread, i;
+ struct vfile *vf;
+ int flag_skip_bastards = 0, flag_fullflist = 0;
+--- poldek-cvs20040323/rpm_signature.c.orig 2003-07-16 12:49:28.000000000 +0200
++++ poldek-cvs20040323/rpm_signature.c 2004-04-25 00:04:20.178184651 +0200
+@@ -52,7 +52,15 @@
+ #include "capreq.h"
+ #include "rpmdb_it.h"
+
+-
++#ifdef HAVE_RPM_4_2
++/* from internal lib/signature.h, no public prototype (at least in 4.3 snaps) */
++typedef enum sigType_e {
++ RPMSIGTYPE_HEADERSIG= 5 /*!< Header style signature */
++} sigType;
++rpmRC rpmReadSignature(FD_t fd, Header *sighp, sigType sig_type, const char ** msg);
++/* lib/rpmlead.h */
++rpmRC readLead(FD_t fd, /*@out@*/ struct rpmlead *lead);
++#endif
+
+ static int rpm_read_signature(FD_t fd, Header *sighp, int sig_type)
+ {