Subversion Repositories libtar

Compare Revisions

Ignore whitespace Rev 2 → Rev 3

/trunk/debian/control
0,0 → 1,24
Source: libtar
Section: libs
Priority: optional
Maintainer: Magnus Holmgren <holmgren@debian.org>
Build-Depends: debhelper (>= 7), dh-autoreconf, autoconf, libtool
Standards-Version: 3.9.1
Homepage: http://www.feep.net/libtar/
 
Package: libtar-dev
Architecture: any
Section: libdevel
Depends: libtar (= ${binary:Version}), ${misc:Depends}
Description: C library for manipulating tar archives
Contains static library, headers, example code and development manpages
for libtar
 
Package: libtar
Architecture: any
Section: libs
Depends: ${shlibs:Depends}, ${misc:Depends}
Description: C library for manipulating tar archives
libtar allows programs to create, extract and test tar archives.
It supports both the strict POSIX tar format and many of the commonly-used
GNU extensions.
/trunk/debian/source/format
0,0 → 1,0
3.0 (quilt)
/trunk/debian/libtar.install
0,0 → 1,0
usr/lib/lib*.so.*
/trunk/debian/compat
0,0 → 1,0
7
/trunk/debian/libtar-dev.manpages
0,0 → 1,11
debian/tmp/usr/share/man/man3/libtar_hash_new.3
debian/tmp/usr/share/man/man3/libtar_list_new.3
debian/tmp/usr/share/man/man3/tar_append_file.3
debian/tmp/usr/share/man/man3/tar_block_read.3
debian/tmp/usr/share/man/man3/tar_extract_all.3
debian/tmp/usr/share/man/man3/tar_extract_file.3
debian/tmp/usr/share/man/man3/tar_open.3
debian/tmp/usr/share/man/man3/th_get_pathname.3
debian/tmp/usr/share/man/man3/th_print_long_ls.3
debian/tmp/usr/share/man/man3/th_read.3
debian/tmp/usr/share/man/man3/th_set_from_stat.3
/trunk/debian/libtar-dev.examples
0,0 → 1,2
libtar/libtar.c
libtar/Makefile
/trunk/debian/watch
0,0 → 1,3
version=3
 
ftp://ftp.feep.net/pub/software/libtar/libtar-(.*).tar.gz
/trunk/debian/changelog
0,0 → 1,113
libtar (1.2.11-7) unstable; urgency=low
 
* New maintainer (Closes: #526618).
* Change source format to 3.0 (quilt), clean up Debian diff and split
into several patches:
* libtool.patch: Using libtool to build dynamic library;
* autoreconf.patch: Changes needed to call autoreconf (bug 511741);
* memleak.patch: Fix memory leaks;
* bad_ptrtoint.patch: Document stupidity of tartype_t in libtar.c
(bug 309945).
* Increase Debhelper compat level to 7.
* Use dh_autoreconf to avoid having to keep track of files to clean.
* memleak2.patch (new): Applied instead of memleak.patch. Fix memory
leak by making th_get_pathname() return a pointer to a static buffer
instead of a pointer to a copy of a local buffer (LP: #41804).
* Add homepage field and watch file (in case there is ever a new
upstream release).
* Upgrade to Standards-Version 3.9.1.
 
-- Magnus Holmgren <holmgren@debian.org> Sat, 26 Mar 2011 23:10:25 +0100
 
libtar (1.2.11-6) unstable; urgency=low
 
* Fix autotools usage (Closes: #511741)
 
-- Julien Danjou <acid@debian.org> Sat, 02 May 2009 11:33:06 +0200
 
libtar (1.2.11-5) unstable; urgency=low
 
* New maintainer (Closes: #465889)
* Add missing binary-indep target in debian/rules (Closes: #395714)
* Use ${binary:Version} instead of Source-Version
* Bump standard version
* Switch to debhelper 5
 
-- Julien Danjou <acid@debian.org> Wed, 02 Apr 2008 07:06:55 +0200
 
libtar (1.2.11-4) unstable; urgency=low
 
* Always include the newest libtool.m4. (Closes: #313612)
 
-- James Morrison <phython@debian.org> Sun, 28 Aug 2005 09:41:47 -0700
 
libtar (1.2.11-3) unstable; urgency=low
 
* Document stupidity of tartype_t in libtar.c. (Closes: #309945)
 
-- James Morrison <phython@debian.org> Sat, 11 Jun 2005 18:23:15 -0400
 
libtar (1.2.11-2) unstable; urgency=low
 
* Move libtar-dev to libdevel. (Closes: #188207)
* Fix potential memory leak.
 
-- James Morrison <phython@debian.org> Sun, 25 Jul 2004 12:59:08 -0700
 
libtar (1.2.11-1) unstable; urgency=low
 
* New Upstream release.
 
-- James Morrison <phython@debian.org> Sat, 5 Apr 2003 14:03:19 -0500
 
libtar (1.2.10-1) unstable; urgency=low
 
* New Upstream release.
(Closes: #166602) New upstream uses autoconf 2.5x
* Remove dependency on automake. Hopefully upstream will except this
use of libtool.
* Remove all -static and -shared targets from debian/rules.
* Use dh_install instead of dh_movefiles.
* -
 
-- James Morrison <phython@debian.org> Sat, 5 Apr 2003 14:03:16 -0500
 
libtar (1.2.5-4) unstable; urgency=low
 
* New maintainer. (Closes: #154597)
* WSG_ENCAP is now defined. (Closes: #147764)
* libtar-dev depends on libc-dev instead of libc6-dev.
 
-- James Morrison <phython@debian.org> Wed, 14 Aug 2002 23:44:16 -0400
 
libtar (1.2.5-3) unstable; urgency=low
 
* Modify build commands to acomadate change in autoconf (Closes #147764)
 
-- Glenn McGrath <bug1@debian.org> Thu, 23 May 2002 01:06:16 +1000
 
libtar (1.2.5-2) unstable; urgency=low
 
* Fix build problem (Closes #135360)
 
-- Glenn McGrath <bug1@debian.org> Sun, 24 Feb 2002 06:29:31 +1100
 
libtar (1.2.5-1) unstable; urgency=low
 
* New upstream version
* Change section of libtar-dev to devel and libtar to libs
 
-- Glenn McGrath <bug1@debian.org> Fri, 22 Feb 2002 04:23:15 +1100
 
libtar (1.2.4-2) unstable; urgency=low
 
* Change section from devel to libs
 
-- Glenn McGrath <bug1@debian.org> Sat, 2 Feb 2002 12:12:32 +1100
 
libtar (1.2.4-1) unstable; urgency=low
 
* Initial Release. (closes #128042)
 
-- Glenn McGrath <bug1@debian.org> Sat, 5 Jan 2002 13:24:37 +1100
 
/trunk/debian/patches/libtool.patch
0,0 → 1,205
Author: Glenn McGrath <bug1@optushome.com.au>
Description: Use libtool to build dynamic library
 
--- a/configure.ac
+++ b/configure.ac
@@ -1,6 +1,6 @@
dnl ### Normal initialization. ######################################
AC_INIT([libtar], [1.2.11])
-AC_PREREQ([2.57])
+AC_PREREQ([2.61])
AC_CONFIG_AUX_DIR([autoconf])
AC_CONFIG_HEADERS([config.h])
AC_COPYRIGHT([[
@@ -26,15 +26,15 @@ AC_SUBST([MKDIR])
dnl ### Check for compiler et al. ###################################
+AC_USE_SYSTEM_EXTENSIONS
AC_PROG_CC
-AC_PROG_RANLIB
+AC_PROG_LIBTOOL
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET
dnl ### Compiler characteristics. ##################################
-AC_AIX
AC_C_CONST
--- a/lib/Makefile.in
+++ b/lib/Makefile.in
@@ -3,6 +3,7 @@
### Path settings
srcdir = @srcdir@
top_srcdir = @top_srcdir@
+top_builddir = @top_builddir@
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
@@ -23,6 +24,7 @@ MKDIR = @MKDIR@
### Compiler and link options
CC = @CC@
+LIBTOOL = @LIBTOOL@
CPPFLAGS = -I. \
-I.. \
-I${srcdir} \
@@ -32,7 +34,7 @@ CPPFLAGS = -I. \
CFLAGS = @CFLAGS@
LDFLAGS = @LDFLAGS@
LIBS = @LIBS@
-LIBOBJS = @LIBOBJS@
+LTLIBOBJS = @LTLIBOBJS@
RANLIB = @RANLIB@
@SET_MAKE@
VPATH = @srcdir@:@top_srcdir@/compat:../listhash
@@ -40,24 +42,26 @@ VPATH = @srcdir@:@top_srcdir@/compat:..
### Makefile rules - no user-servicable parts below
-LIBTAR_OBJS = append.o \
- block.o \
- decode.o \
- encode.o \
- extract.o \
- handle.o \
- libtar_hash.o \
- libtar_list.o \
- output.o \
- util.o \
- wrapper.o
+LIBTAR_OBJS = append.lo \
+ block.lo \
+ decode.lo \
+ encode.lo \
+ extract.lo \
+ handle.lo \
+ libtar_hash.lo \
+ libtar_list.lo \
+ output.lo \
+ util.lo \
+ wrapper.lo
LIBTAR_HDRS = ../config.h \
${top_srcdir}/compat/compat.h \
${srcdir}/libtar.h \
${srcdir}/internal.h \
../listhash/libtar_listhash.h
-LIBTAR_LIBS = ./libtar.a
-ALL = libtar.a
+LIBTAR_LIBS = ./libtar.la
+ALL = libtar.la
+LDFLAGS = @LDFLAGS@
+CFLAGS = @CFLAGS@
DISTCLEANFILES = ../listhash/libtar_listhash.h \
../listhash/libtar_list.c \
@@ -68,24 +72,31 @@ all: ${ALL}
.PHONY: clean distclean install
-libtar.a: ${LIBTAR_OBJS} ${LIBOBJS}
- ${AR} rc libtar.a ${LIBTAR_OBJS} ${LIBOBJS}
- ${RANLIB} libtar.a
+libtar.la: ${LIBTAR_OBJS} ${LTLIBOBJS}
+ $(LIBTOOL) --mode=link $(CC) $(CFLAGS) $(LDFLAGS) -o libtar.la $(LIBTAR_OBJS) $(LTLIBOBJS) -rpath $(libdir)
+# ${AR} rc libtar.a ${LIBTAR_OBJS} ${LIBOBJS}
+# ${RANLIB} libtar.a
${LIBTAR_OBJS}: ${LIBTAR_HDRS}
-.c.o:
- ${CC} ${CFLAGS} ${CPPFLAGS} -c -o $@ $<
+%.lo: $(srcdir)/%.c
+ $(LIBTOOL) --mode=compile ${CC} ${CFLAGS} ${CPPFLAGS} -c -o $@ $<
+
+%.lo: listhash/%.c
+ $(LIBTOOL) --mode=compile ${CC} ${CFLAGS} ${CPPFLAGS} -c -o $@ $<
+
+%.lo: compat/%.c
+ $(LIBTOOL) --mode=compile ${CC} ${CFLAGS} ${CPPFLAGS} -c -o $@ $<
clean:
- rm -f *~ *.o ${ALL} core
+ rm -rf *~ *.o $(LIBTAR_OBJS) ${ALL} core .libs $(LTLIBOBJS)
distclean: clean
rm -f Makefile ${DISTCLEANFILES}
install: ${ALL}
${MKDIR} ${DESTDIR}${libdir}
- ${INSTALL_DATA} libtar.a ${DESTDIR}${libdir}
+ $(LIBTOOL) --mode=install ${INSTALL_DATA} libtar.la ${DESTDIR}${libdir}
${MKDIR} ${DESTDIR}${includedir}
${INSTALL_DATA} ${srcdir}/libtar.h ${DESTDIR}${includedir}
${INSTALL_DATA} ../listhash/libtar_listhash.h ${DESTDIR}${includedir}
--- a/libtar/Makefile.in
+++ b/libtar/Makefile.in
@@ -3,6 +3,7 @@
### Path settings
srcdir = @srcdir@
top_srcdir = @top_srcdir@
+top_builddir = @top_builddir@
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
@@ -23,6 +24,7 @@ MKDIR = @MKDIR@
### Compiler and link options
CC = @CC@
+LIBTOOL = @LIBTOOL@
CPPFLAGS = -I.. \
-I../lib \
-I../listhash \
@@ -31,7 +33,7 @@ CPPFLAGS = -I.. \
@CPPFLAGS@
CFLAGS = @CFLAGS@
LDFLAGS = @LDFLAGS@
-LIBS = @LIBS@
+LIBS = @LIBS@ -ltar
LIBOBJS = @LIBOBJS@
RANLIB = @RANLIB@
@SET_MAKE@
@@ -40,12 +42,12 @@ VPATH = @srcdir@
### Makefile rules - no user-servicable parts below
-LIBTAR_OBJS = libtar.o
+LIBTAR_OBJS = libtar.lo
LIBTAR_HDRS = ../config.h \
${top_srcdir}/compat/compat.h \
${top_srcdir}/lib/libtar.h \
../listhash/libtar_listhash.h
-LIBTAR_LIBS = ../lib/libtar.a
+LIBTAR_LIBS = $(top_builddir)/lib
ALL = libtar
@@ -54,20 +56,20 @@ all: ${ALL}
.PHONY: clean distclean install
libtar: ${LIBTAR_OBJS} ${LIBTAR_LIBS} ${LIBTAR_HDRS}
- ${CC} ${CFLAGS} ${LDFLAGS} -o libtar libtar.o ${LIBTAR_LIBS} ${LIBS}
+ $(LIBTOOL) --mode=link ${CC} ${CFLAGS} ${LDFLAGS} -o libtar $(LIBTAR_OBJS) -L${LIBTAR_LIBS} ${LIBS}
${LIBTAR_OBJS}: ${LIBTAR_HDRS}
-.c.o:
- ${CC} ${CFLAGS} ${CPPFLAGS} -c -o $@ $<
+%.lo: %.c
+ $(LIBTOOL) --mode=compile ${CC} ${CFLAGS} ${CPPFLAGS} -c -o $@ $<
clean:
- rm -f *~ *.o ${ALL} core
+ rm -rf *~ *.o ${ALL} $(LIBTAR_OBJS) core .libs
distclean: clean
rm -f Makefile
install: ${ALL}
${MKDIR} ${DESTDIR}${bindir}
- ${INSTALL_PROGRAM} libtar ${DESTDIR}${bindir}
+ $(LIBTOOL) --mode=install ${INSTALL_PROGRAM} libtar ${DESTDIR}${bindir}
/trunk/debian/patches/autoreconf.patch
0,0 → 1,46
Author: Julien Danjou <acid@debian.org>
Author: James Westby <james.westby@canonical.com>
Description: Changes to upstream source needed to call autoreconf
Bug-Debian: http://bugs.debian.org/511741
 
--- a/configure.ac
+++ b/configure.ac
@@ -3,6 +3,7 @@ AC_INIT([libtar], [1.2.11])
AC_PREREQ([2.61])
AC_CONFIG_AUX_DIR([autoconf])
AC_CONFIG_HEADERS([config.h])
+AC_CONFIG_MACRO_DIR([m4])
AC_COPYRIGHT([[
Copyright (c) 1998-2003 University of Illinois Board of Trustees
Copyright (c) 1998-2003 Mark D. Roth
@@ -93,9 +94,9 @@ COMPAT_FUNC_MAKEDEV
COMPAT_FUNC_SNPRINTF
COMPAT_FUNC_STRDUP
AC_FUNC_STRFTIME
-COMPAT_FUNC_STRLCPY
COMPAT_FUNC_STRMODE
-COMPAT_FUNC_STRSEP
+dnl COMPAT_FUNC_STRLCPY converted by compat/modules.ac
+dnl COMPAT_FUNC_STRSEP
dnl ### Check for libraries. #######################################
--- /dev/null
+++ b/aclocal.m4
@@ -0,0 +1,8 @@
+m4_include([autoconf/ac_path_generic.m4])
+m4_include([autoconf/encap.m4])
+m4_include([autoconf/aclocal.m4])
+m4_include([/usr/share/aclocal/ltoptions.m4])
+m4_include([/usr/share/aclocal/lt~obsolete.m4])
+m4_include([/usr/share/aclocal/libtool.m4])
+m4_include([/usr/share/aclocal/ltversion.m4])
+m4_include([/usr/share/aclocal/ltsugar.m4])
--- a/autoconf/aclocal.m4
+++ b/autoconf/aclocal.m4
@@ -1,5 +1,3 @@
-m4_include([encap.m4])
-m4_include([ac_path_generic.m4])
# PSG_LIB_READLINE
/trunk/debian/patches/bad_ptrtoint.patch
0,0 → 1,25
Author: James Morrison <phython@debian.org>
Description: Document stupidity of tartype_t in libtar.c.
Bug-Debian: http://bugs.debian.org/309945
 
--- a/libtar/libtar.c
+++ b/libtar/libtar.c
@@ -19,6 +19,7 @@
#include <sys/param.h>
#ifdef STDC_HEADERS
+# include <stdlib.h>
# include <string.h>
#endif
@@ -91,6 +92,10 @@ gzopen_frontend(char *pathname, int ofla
return -1;
}
+ /* This is a bad thing to do on big-endian lp64 systems, where the
+ size and placement of integers is different than pointers.
+ However, to fix the problem 4 wrapper functions would be needed and
+ an extra bit of data associating GZF with the wrapper functions. */
return (int)gzf;
}
/trunk/debian/patches/memleak.patch
0,0 → 1,496
Description: Fix memory leaks related to th_get_pathname()
Author: James Morrison <phython@debian.org>
Author: Martin Gadbois <martin.gadbois@colubris.com>
Author: Magnus Holmgren <holmgren@debian.org>
Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/libtar/+bug/41804
 
--- a/lib/wrapper.c
+++ b/lib/wrapper.c
@@ -18,6 +18,7 @@
#include <errno.h>
#ifdef STDC_HEADERS
+# include <stdlib.h>
# include <string.h>
#endif
@@ -35,7 +36,10 @@ tar_extract_glob(TAR *t, char *globname,
if (fnmatch(globname, filename, FNM_PATHNAME | FNM_PERIOD))
{
if (TH_ISREG(t) && tar_skip_regfile(t))
+ {
+ free(filename);
return -1;
+ }
continue;
}
if (t->options & TAR_VERBOSE)
@@ -45,7 +49,11 @@ tar_extract_glob(TAR *t, char *globname,
else
strlcpy(buf, filename, sizeof(buf));
if (tar_extract_file(t, filename) != 0)
+ {
+ free(filename);
return -1;
+ }
+ free(filename);
}
return (i == 1 ? 0 : -1);
@@ -76,12 +84,17 @@ tar_extract_all(TAR *t, char *prefix)
snprintf(buf, sizeof(buf), "%s/%s", prefix, filename);
else
strlcpy(buf, filename, sizeof(buf));
+ free(filename);
#ifdef DEBUG
printf(" tar_extract_all(): calling tar_extract_file(t, "
"\"%s\")\n", buf);
#endif
if (tar_extract_file(t, buf) != 0)
+ {
+ free(filename);
return -1;
+ }
+ free(filename);
}
return (i == 1 ? 0 : -1);
--- a/lib/extract.c
+++ b/lib/extract.c
@@ -21,6 +21,7 @@
#ifdef STDC_HEADERS
# include <stdlib.h>
+# include <string.h>
#endif
#ifdef HAVE_UNISTD_H
@@ -43,9 +44,10 @@ tar_set_file_perms(TAR *t, char *realnam
uid_t uid;
gid_t gid;
struct utimbuf ut;
- char *filename;
+ char *filename,*pathname;
- filename = (realname ? realname : th_get_pathname(t));
+ pathname = th_get_pathname(t);
+ filename = (realname ? realname : pathname);
mode = th_get_mode(t);
uid = th_get_uid(t);
gid = th_get_gid(t);
@@ -68,6 +70,7 @@ tar_set_file_perms(TAR *t, char *realnam
filename, uid, gid, strerror(errno));
# endif
#endif /* HAVE_LCHOWN */
+ free(pathname);
return -1;
}
@@ -77,6 +80,7 @@ tar_set_file_perms(TAR *t, char *realnam
#ifdef DEBUG
perror("utime()");
#endif
+ free(pathname);
return -1;
}
@@ -86,9 +90,10 @@ tar_set_file_perms(TAR *t, char *realnam
#ifdef DEBUG
perror("chmod()");
#endif
+ free(pathname);
return -1;
}
-
+ free(pathname);
return 0;
}
@@ -99,6 +104,7 @@ tar_extract_file(TAR *t, char *realname)
{
int i;
linkname_t *lnp;
+ char *pathname;
if (t->options & TAR_NOOVERWRITE)
{
@@ -140,12 +146,14 @@ tar_extract_file(TAR *t, char *realname)
lnp = (linkname_t *)calloc(1, sizeof(linkname_t));
if (lnp == NULL)
return -1;
- strlcpy(lnp->ln_save, th_get_pathname(t), sizeof(lnp->ln_save));
+ pathname = th_get_pathname(t);
+ strlcpy(lnp->ln_save, pathname, sizeof(lnp->ln_save));
strlcpy(lnp->ln_real, realname, sizeof(lnp->ln_real));
#ifdef DEBUG
printf("tar_extract_file(): calling libtar_hash_add(): key=\"%s\", "
- "value=\"%s\"\n", th_get_pathname(t), realname);
+ "value=\"%s\"\n", pathname, realname);
#endif
+ free(pathname);
if (libtar_hash_add(t->h, lnp) != 0)
return -1;
@@ -164,7 +172,7 @@ tar_extract_regfile(TAR *t, char *realna
int fdout;
int i, k;
char buf[T_BLOCKSIZE];
- char *filename;
+ char *filename,*pathname;
#ifdef DEBUG
printf("==> tar_extract_regfile(t=0x%lx, realname=\"%s\")\n", t,
@@ -176,15 +184,18 @@ tar_extract_regfile(TAR *t, char *realna
errno = EINVAL;
return -1;
}
-
- filename = (realname ? realname : th_get_pathname(t));
+ pathname = th_get_pathname(t);
+ filename = (realname ? realname : pathname);
mode = th_get_mode(t);
size = th_get_size(t);
uid = th_get_uid(t);
gid = th_get_gid(t);
if (mkdirhier(dirname(filename)) == -1)
+ {
+ free(pathname);
return -1;
+ }
#ifdef DEBUG
printf(" ==> extracting: %s (mode %04o, uid %d, gid %d, %d bytes)\n",
@@ -200,6 +211,7 @@ tar_extract_regfile(TAR *t, char *realna
#ifdef DEBUG
perror("open()");
#endif
+ free(pathname);
return -1;
}
@@ -231,23 +243,30 @@ tar_extract_regfile(TAR *t, char *realna
{
if (k != -1)
errno = EINVAL;
+ free(pathname);
return -1;
}
/* write block to output file */
if (write(fdout, buf,
((i > T_BLOCKSIZE) ? T_BLOCKSIZE : i)) == -1)
+ {
+ free(pathname);
return -1;
+ }
}
/* close output file */
if (close(fdout) == -1)
+ {
+ free(pathname);
return -1;
+ }
#ifdef DEBUG
printf("### done extracting %s\n", filename);
#endif
-
+ free(pathname);
return 0;
}
@@ -286,7 +305,7 @@ tar_skip_regfile(TAR *t)
int
tar_extract_hardlink(TAR * t, char *realname)
{
- char *filename;
+ char *filename,*pathname;
char *linktgt = NULL;
linkname_t *lnp;
libtar_hashptr_t hp;
@@ -296,10 +315,14 @@ tar_extract_hardlink(TAR * t, char *real
errno = EINVAL;
return -1;
}
-
- filename = (realname ? realname : th_get_pathname(t));
+
+ pathname = th_get_pathname(t);
+ filename = (realname ? realname : pathname);
if (mkdirhier(dirname(filename)) == -1)
+ {
+ free(pathname);
return -1;
+ }
libtar_hashptr_reset(&hp);
if (libtar_hash_getkey(t->h, &hp, th_get_linkname(t),
(libtar_matchfunc_t)libtar_str_match) != 0)
@@ -318,9 +341,10 @@ tar_extract_hardlink(TAR * t, char *real
#ifdef DEBUG
perror("link()");
#endif
+ free(pathname);
return -1;
}
-
+ free(pathname);
return 0;
}
@@ -329,7 +353,7 @@ tar_extract_hardlink(TAR * t, char *real
int
tar_extract_symlink(TAR *t, char *realname)
{
- char *filename;
+ char *filename,*pathname;
if (!TH_ISSYM(t))
{
@@ -337,12 +361,19 @@ tar_extract_symlink(TAR *t, char *realna
return -1;
}
- filename = (realname ? realname : th_get_pathname(t));
+ pathname = th_get_pathname(t);
+ filename = (realname ? realname : pathname);
if (mkdirhier(dirname(filename)) == -1)
+ {
+ free(pathname);
return -1;
+ }
if (unlink(filename) == -1 && errno != ENOENT)
+ {
+ free(pathname);
return -1;
+ }
#ifdef DEBUG
printf(" ==> extracting: %s (symlink to %s)\n",
@@ -353,9 +384,10 @@ tar_extract_symlink(TAR *t, char *realna
#ifdef DEBUG
perror("symlink()");
#endif
+ free(pathname);
return -1;
}
-
+ free(pathname);
return 0;
}
@@ -366,7 +398,7 @@ tar_extract_chardev(TAR *t, char *realna
{
mode_t mode;
unsigned long devmaj, devmin;
- char *filename;
+ char *filename,*pathname;
if (!TH_ISCHR(t))
{
@@ -374,13 +406,17 @@ tar_extract_chardev(TAR *t, char *realna
return -1;
}
- filename = (realname ? realname : th_get_pathname(t));
+ pathname = th_get_pathname(t);
+ filename = (realname ? realname : pathname);
mode = th_get_mode(t);
devmaj = th_get_devmajor(t);
devmin = th_get_devminor(t);
if (mkdirhier(dirname(filename)) == -1)
+ {
+ free(pathname);
return -1;
+ }
#ifdef DEBUG
printf(" ==> extracting: %s (character device %ld,%ld)\n",
@@ -392,9 +428,10 @@ tar_extract_chardev(TAR *t, char *realna
#ifdef DEBUG
perror("mknod()");
#endif
+ free(pathname);
return -1;
}
-
+ free(pathname);
return 0;
}
@@ -405,7 +442,7 @@ tar_extract_blockdev(TAR *t, char *realn
{
mode_t mode;
unsigned long devmaj, devmin;
- char *filename;
+ char *filename,*pathname;
if (!TH_ISBLK(t))
{
@@ -413,13 +450,17 @@ tar_extract_blockdev(TAR *t, char *realn
return -1;
}
- filename = (realname ? realname : th_get_pathname(t));
+ pathname = th_get_pathname(t);
+ filename = (realname ? realname : pathname);
mode = th_get_mode(t);
devmaj = th_get_devmajor(t);
devmin = th_get_devminor(t);
if (mkdirhier(dirname(filename)) == -1)
+ {
+ free(pathname);
return -1;
+ }
#ifdef DEBUG
printf(" ==> extracting: %s (block device %ld,%ld)\n",
@@ -431,9 +472,10 @@ tar_extract_blockdev(TAR *t, char *realn
#ifdef DEBUG
perror("mknod()");
#endif
+ free(pathname);
return -1;
}
-
+ free(pathname);
return 0;
}
@@ -443,7 +485,7 @@ int
tar_extract_dir(TAR *t, char *realname)
{
mode_t mode;
- char *filename;
+ char *filename,*pathname;
if (!TH_ISDIR(t))
{
@@ -451,11 +493,15 @@ tar_extract_dir(TAR *t, char *realname)
return -1;
}
- filename = (realname ? realname : th_get_pathname(t));
+ pathname = th_get_pathname(t);
+ filename = (realname ? realname : pathname);
mode = th_get_mode(t);
if (mkdirhier(dirname(filename)) == -1)
+ {
+ free(pathname);
return -1;
+ }
#ifdef DEBUG
printf(" ==> extracting: %s (mode %04o, directory)\n", filename,
@@ -470,6 +516,7 @@ tar_extract_dir(TAR *t, char *realname)
#ifdef DEBUG
perror("chmod()");
#endif
+ free(pathname);
return -1;
}
else
@@ -477,6 +524,7 @@ tar_extract_dir(TAR *t, char *realname)
#ifdef DEBUG
puts(" *** using existing directory");
#endif
+ free(pathname);
return 1;
}
}
@@ -485,10 +533,11 @@ tar_extract_dir(TAR *t, char *realname)
#ifdef DEBUG
perror("mkdir()");
#endif
+ free(pathname);
return -1;
}
}
-
+ free(pathname);
return 0;
}
@@ -498,7 +547,7 @@ int
tar_extract_fifo(TAR *t, char *realname)
{
mode_t mode;
- char *filename;
+ char *filename,*pathname;
if (!TH_ISFIFO(t))
{
@@ -506,11 +555,15 @@ tar_extract_fifo(TAR *t, char *realname)
return -1;
}
- filename = (realname ? realname : th_get_pathname(t));
+ pathname = th_get_pathname(t);
+ filename = (realname ? realname : pathname);
mode = th_get_mode(t);
if (mkdirhier(dirname(filename)) == -1)
+ {
+ free(pathname);
return -1;
+ }
#ifdef DEBUG
printf(" ==> extracting: %s (fifo)\n", filename);
@@ -520,9 +573,11 @@ tar_extract_fifo(TAR *t, char *realname)
#ifdef DEBUG
perror("mkfifo()");
#endif
+ free(pathname);
return -1;
}
+ free(pathname);
return 0;
}
--- a/lib/output.c
+++ b/lib/output.c
@@ -20,6 +20,7 @@
#include <sys/param.h>
#ifdef STDC_HEADERS
+# include <stdlib.h>
# include <string.h>
#endif
@@ -71,6 +72,7 @@ th_print_long_ls(TAR *t)
char groupname[_POSIX_LOGIN_NAME_MAX];
time_t mtime;
struct tm *mtm;
+ char *pathname;
#ifdef HAVE_STRFTIME
char timebuf[18];
@@ -114,7 +116,9 @@ th_print_long_ls(TAR *t)
mtm->tm_mday, mtm->tm_hour, mtm->tm_min, mtm->tm_year + 1900);
#endif
- printf(" %s", th_get_pathname(t));
+ pathname = th_get_pathname(t);
+ printf(" %s", pathname);
+ free(pathname);
if (TH_ISSYM(t) || TH_ISLNK(t))
{
--- a/lib/decode.c
+++ b/lib/decode.c
@@ -29,7 +29,7 @@ th_get_pathname(TAR *t)
char filename[MAXPATHLEN];
if (t->th_buf.gnu_longname)
- return t->th_buf.gnu_longname;
+ return strdup(t->th_buf.gnu_longname);
if (t->th_buf.prefix[0] != '\0')
{
/trunk/debian/patches/series
0,0 → 1,5
libtool.patch
autoreconf.patch
memleak2.patch
#memleak.patch
bad_ptrtoint.patch
/trunk/debian/patches/memleak2.patch
0,0 → 1,31
Description: Fix memory leak in th_get_pathname
by making the buffer, where prefix and filename are concatenated, static
and returning that instead of a pointer to a copy of a local buffer.
Author: Per Lidén <per@fukt.bth.se>
Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/libtar/+bug/41804
 
--- a/lib/decode.c
+++ b/lib/decode.c
@@ -26,7 +26,7 @@
char *
th_get_pathname(TAR *t)
{
- char filename[MAXPATHLEN];
+ static char filename[MAXPATHLEN];
if (t->th_buf.gnu_longname)
return t->th_buf.gnu_longname;
@@ -35,11 +35,11 @@ th_get_pathname(TAR *t)
{
snprintf(filename, sizeof(filename), "%.155s/%.100s",
t->th_buf.prefix, t->th_buf.name);
- return strdup(filename);
+ return filename;
}
snprintf(filename, sizeof(filename), "%.100s", t->th_buf.name);
- return strdup(filename);
+ return filename;
}
/trunk/debian/copyright
0,0 → 1,44
This package was debianized by Glenn McGrath <bug1@debian.org> on
Sat, 5 Jan 2002 13:24:37 +1100.
 
It was downloaded from http://www-dev.cites.uiuc.edu/libtar/
 
Upstream Author: Mark D. Roth <roth@uiuc.edu>
 
Copyright:
Copyright (c) 1998-2002 University of Illinois Board of Trustees
Copyright (c) 1998-2002 Mark D. Roth
All rights reserved.
 
Developed by: Campus Information Technologies and Educational Services,
University of Illinois at Urbana-Champaign
 
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
``Software''), to deal with the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
 
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimers.
 
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimers in the
documentation and/or other materials provided with the distribution.
 
* Neither the names of Campus Information Technologies and Educational
Services, University of Illinois at Urbana-Champaign, nor the names
of its contributors may be used to endorse or promote products derived
from this Software without specific prior written permission.
 
THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR
ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
OR THE USE OR OTHER DEALINGS WITH THE SOFTWARE.
 
 
/trunk/debian/docs
0,0 → 1,3
README
TODO
ChangeLog-1.0.x
/trunk/debian/rules
0,0 → 1,59
#!/usr/bin/make -f
 
export LIBTOOLIZE = libtoolize --install
 
configure: configure-stamp
configure-stamp:
dh_testdir
[ -f debian/autoreconf.before ] || dh_autoreconf
./configure \
--prefix=/usr \
--mandir=\$${prefix}/share/man
touch configure-stamp
 
build: build-stamp
build-stamp: configure-stamp
dh_testdir
$(MAKE)
touch build-stamp
 
clean:
dh_testdir
dh_testroot
# Stale build files
[ ! -f Makefile ] || $(MAKE) distclean
-rm -f build-stamp configure-stamp
dh_autoreconf_clean
dh_clean libtool configure
 
install: build-stamp
dh_testdir
dh_testroot
dh_prep
 
$(MAKE) install DESTDIR=$(CURDIR)/debian/tmp
 
binary-indep: build install
 
binary-arch: install
dh_testdir
dh_testroot
dh_install --sourcedir=debian/tmp
 
dh_installdocs
dh_installexamples
dh_installman
dh_installchangelogs ChangeLog
dh_link
dh_strip
dh_compress
dh_fixperms
dh_makeshlibs
dh_installdeb
dh_shlibdeps
dh_gencontrol
dh_md5sums
dh_builddeb
 
binary: binary-indep binary-arch
.PHONY: build clean binary-indep binary-arch binary install configure
Property changes:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: debian/libtar-dev.install
===================================================================
--- debian/libtar-dev.install (nonexistent)
+++ debian/libtar-dev.install (revision 3)
@@ -0,0 +1,4 @@
+usr/include/libtar.h
+usr/include/libtar_listhash.h
+usr/lib/lib*.a
+usr/lib/lib*so
Index: debian
===================================================================
--- debian (nonexistent)
+++ debian (revision 3)
/debian
Property changes:
Added: mergeWithUpstream
## -0,0 +1 ##
+1
\ No newline at end of property