Package: pax Version: 1:1.5-15 Severity: wishlist Tags: patch As I'm sure you are aware, the pax in Debian is somewhat out-of-date. I looked at OpenBSD's pax and determined what needed to be fixed in order to get it to compile.
Attached are some patches that work against (tonight's) CVS HEAD. I don't know how well they'll work with other Debian-specific patches, such as the bzip2 patch, but you can try. You will also need to get strlcpy.c from OpenBSD's libc and add it to the makefile. List of changes: * setgroupent/setpassent are the same as setgrent/setpwent, except that they can leave the file descriptors open. * some constants I pulled from the OpenBSD header files and stuck in the appropriate files. Most are pretty obvious. * I chose to disable using vis (and #defined VIS_CSTYLE to 0 as a dummy), but you could pull the vis.h and vis.c from the k*bsd-gnu projects[0]. * I renamed getline to bsd_getline to avoid conflicts with an incompatible glibc function. * I used LLONG_MAX instead of QUAD_MAX. * I initialized listf immediately in main, since stderr is not a constant on glibc (and therefore not a valid initializer), but it is on OpenBSD. You don't need to pull strlcpy.c (and vis.{c,h}) if you can convince the k*bsd-gnu people to build a deb of their libbsd. HTH. [0] http://svn.debian.org/wsvn/glibc-bsd/trunk/libbsd/src/vis.c?op=file&rev=0&sc=0 -- System Information: Debian Release: lenny/sid APT prefers unstable APT policy: (500, 'unstable'), (1, 'experimental') Architecture: amd64 (x86_64) Kernel: Linux 2.6.22-1-amd64 (SMP w/2 CPU cores) Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8) (ignored: LC_ALL set to en_US.UTF-8) Shell: /bin/sh linked to /bin/bash Versions of packages pax depends on: ii libc6 2.6-3 GNU C Library: Shared libraries pax recommends no packages. -- no debconf information -- brian m. carlson / brian with sandals: Houston, Texas, US +1 713 440 7475 | http://crustytoothpaste.ath.cx/~bmc | My opinion only OpenPGP: RSA v4 4096b 88AC E9B2 9196 305B A994 7552 F1BA 225C 0223 B187
--- cache.c.orig 2007-07-24 02:36:27.000000000 +0000 +++ cache.c 2007-07-24 02:37:43.000000000 +0000 @@ -200,7 +200,7 @@ * No entry for this uid, we will add it */ if (!pwopn) { - setpassent(1); + setpwent(); ++pwopn; } if (ptr == NULL) @@ -266,7 +266,7 @@ * No entry for this gid, we will add it */ if (!gropn) { - setgroupent(1); + setgrent(); ++gropn; } if (ptr == NULL) @@ -333,7 +333,7 @@ } if (!pwopn) { - setpassent(1); + setpwent(); ++pwopn; } @@ -396,7 +396,7 @@ } if (!gropn) { - setgroupent(1); + setgrent(); ++gropn; } if (ptr == NULL) --- gen_subs.c.orig 2007-07-24 01:55:24.000000000 +0000 +++ gen_subs.c 2007-07-24 02:12:46.000000000 +0000 @@ -47,12 +47,11 @@ #include <sys/stat.h> #include <sys/param.h> #include <stdio.h> -#include <tzfile.h> +#include <time.h> #include <utmp.h> #include <unistd.h> #include <stdlib.h> #include <string.h> -#include <vis.h> #include "pax.h" #include "extern.h" @@ -65,6 +64,9 @@ */ #define MODELEN 20 #define DATELEN 64 +#define DAYSPERNYEAR 365 +#define SECSPERDAY 86400 +#define VIS_CSTYLE 0 #define SIXMONTHS ((DAYSPERNYEAR / 2) * SECSPERDAY) #define CURFRMT "%b %e %H:%M" #define OLDFRMT "%b %e %Y" @@ -205,7 +207,7 @@ /* * if printing to a tty, use vis(3) to print special characters. */ - if (isatty(fileno(fp))) { + if (0 && isatty(fileno(fp))) { for (cp = str; *cp; cp++) { (void)vis(visbuf, cp[0], VIS_CSTYLE, cp[1]); (void)fputs(visbuf, fp); --- options.c.orig 2007-07-24 02:12:57.000000000 +0000 +++ options.c 2007-07-24 02:17:50.000000000 +0000 @@ -72,7 +72,7 @@ static void printflg(unsigned int); static int c_frmt(const void *, const void *); static off_t str_offt(char *); -static char *getline(FILE *fp); +static char *bsd_getline(FILE *fp); static void pax_options(int, char **); static void pax_usage(void); static void tar_options(int, char **); @@ -869,7 +869,7 @@ paxwarn(1, "Unable to open file '%s' for read", file); tar_usage(); } - while ((str = getline(fp)) != NULL) { + while ((str = bsd_getline(fp)) != NULL) { if (pat_add(str, dir) < 0) tar_usage(); sawpat = 1; @@ -948,7 +948,7 @@ paxwarn(1, "Unable to open file '%s' for read", file); tar_usage(); } - while ((str = getline(fp)) != NULL) { + while ((str = bsd_getline(fp)) != NULL) { if (ftree_add(str, 0) < 0) tar_usage(); } @@ -1164,7 +1164,7 @@ paxwarn(1, "Unable to open file '%s' for read", optarg); cpio_usage(); } - while ((str = getline(fp)) != NULL) { + while ((str = bsd_getline(fp)) != NULL) { pat_add(str, NULL); } fclose(fp); @@ -1263,7 +1263,7 @@ * no read errors allowed on updates/append operation! */ maxflt = 0; - while ((str = getline(stdin)) != NULL) { + while ((str = bsd_getline(stdin)) != NULL) { ftree_add(str, 0); } if (getline_error) { @@ -1440,7 +1440,7 @@ if ((num == LONG_MAX) || (num <= 0) || (expr == val)) # else num = strtoq(val, &expr, 0); - if ((num == QUAD_MAX) || (num <= 0) || (expr == val)) + if ((num == LLONG_MAX) || (num <= 0) || (expr == val)) # endif return(0); @@ -1492,7 +1492,7 @@ } char * -getline(FILE *f) +bsd_getline(FILE *f) { char *name, *temp; size_t len; --- sel_subs.c.orig 2007-07-24 02:21:54.000000000 +0000 +++ sel_subs.c 2007-07-24 02:23:38.000000000 +0000 @@ -52,12 +52,14 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> -#include <tzfile.h> +#include <time.h> #include <unistd.h> #include "pax.h" #include "sel_subs.h" #include "extern.h" +#define TM_YEAR_BASE 1900 + static int str_sec(const char *, time_t *); static int usr_match(ARCHD *); static int grp_match(ARCHD *); --- pax.c.orig 2007-07-24 02:19:58.000000000 +0000 +++ pax.c 2007-07-24 02:21:31.000000000 +0000 @@ -105,7 +105,7 @@ char *ltmfrmt; /* -v locale time format (if any) */ char *argv0; /* root of argv[0] */ sigset_t s_mask; /* signal mask for cleanup critical sect */ -FILE *listf = stderr; /* file pointer to print file list to */ +FILE *listf; /* file pointer to print file list to */ char *tempfile; /* tempfile to use for mkstemp(3) */ char *tempbase; /* basename of tempfile to use for mkstemp(3) */ @@ -235,6 +235,12 @@ char *tmpdir; size_t tdlen; + /* + * On some systems, stderr is not a constant, so we initialize listf + * immediately to emulate the behavior. + */ + listf=stderr; + /* * Keep a reference to cwd, so we can always come back home. */
signature.asc
Description: Digital signature