Compare commits
22 Commits
release_1_
...
release_1_
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3352016cf0 | ||
|
|
6bc808b25f | ||
|
|
19f60610d1 | ||
|
|
2433f6813e | ||
|
|
76bbb5710f | ||
|
|
e8fbac5ec1 | ||
|
|
5842962ed6 | ||
|
|
368172bf25 | ||
|
|
0f9b299745 | ||
|
|
ab3b31cfef | ||
|
|
f152367c57 | ||
|
|
a34d0e906f | ||
|
|
dcedecad2b | ||
|
|
436741221c | ||
|
|
8ccde495f4 | ||
|
|
29a6b977e9 | ||
|
|
5129d9eb8c | ||
|
|
b5c890b887 | ||
|
|
2d57bb240d | ||
|
|
554e50b438 | ||
|
|
c6834baaf6 | ||
|
|
17600e0de8 |
37
ChangeLog
37
ChangeLog
@@ -1,5 +1,42 @@
|
||||
2004-12-22 Sergey Poznyakoff <gray@Mirddin.farlep.net>
|
||||
|
||||
* src/tar.c (main): Reverted recent changes (#ifdef).
|
||||
|
||||
2004-12-21 Sergey Poznyakoff <gray@Mirddin.farlep.net>
|
||||
|
||||
* configure.ac: Raise version number to 1.15.1
|
||||
Check for locale.h
|
||||
* NEWS: Entry for 1.15.1
|
||||
* src/buffer.c: Bugfix. Changes introduced 2004-11-26
|
||||
broke extraction from stdin.
|
||||
* src/list.c (from_header, tar_checksum): Changed declaration.
|
||||
All callers updated.
|
||||
* src/common.h: Likewise
|
||||
* src/tar.c (main): Protect invocation of setlocale by
|
||||
ifdef.
|
||||
|
||||
* tests/comprec.at: New test
|
||||
* tests/pipe.at: New test
|
||||
* tests/Makefile.am (comprec.at,pipe.at): New tests
|
||||
* tests/testsuite.at: Likewise
|
||||
* tests/gzip.at: Use AT_GZIP_PREREQ
|
||||
* tests/star/pax-big-10g.at: Likewise
|
||||
* tests/star/ustar-big-2g.at: Likewise
|
||||
* tests/star/ustar-big-8g.at: Likewise
|
||||
|
||||
* tests/extrac04.at: Discard stderr from sort, on some
|
||||
systems it spits out lots of irrelevant info.
|
||||
* tests/listed02.at: Likewise
|
||||
|
||||
* doc/index.html.in: Rewritten in xhtml to follow recent
|
||||
GNU site standards.
|
||||
* THANKS: Updated
|
||||
|
||||
2004-12-20 Sergey Poznyakoff <gray@Mirddin.farlep.net>
|
||||
|
||||
Released version 1.15. Sources up to this point are
|
||||
tagged release_1_15.
|
||||
|
||||
* configure.ac: Raised version number to 1.15
|
||||
* NEWS: Likewise
|
||||
* directory: Updated
|
||||
|
||||
6
NEWS
6
NEWS
@@ -4,6 +4,12 @@ Free Software Foundation, Inc.
|
||||
See the end for copying conditions.
|
||||
|
||||
Please send GNU tar bug reports to <bug-tar@gnu.org>
|
||||
|
||||
version 1.15.1 - Sergey Poznyakoff, 2004-12-21
|
||||
|
||||
This version fixes a bug introduced in 1.15 which caused
|
||||
tar to refuse to extract files from standard input.
|
||||
|
||||
|
||||
version 1.15 - Sergey Poznyakoff, 2004-12-20
|
||||
|
||||
|
||||
2
THANKS
2
THANKS
@@ -179,6 +179,7 @@ Greg Chung gchung@caip.rutgers.edu
|
||||
Greg Hudson ghudson@mit.edu
|
||||
Greg Maples greg@clari.net
|
||||
Greg McGary gkm@cstone.net
|
||||
Greg Schafer gschafer@zip.com.au
|
||||
G<EFBFBD>¶ran Uddeborg gvran@uddeborg.pp.se
|
||||
Hans Guerth 100664.3101@compuserve.com
|
||||
Harald K<>¶nig koenig@tat.physik.uni-tuebingen.de
|
||||
@@ -378,6 +379,7 @@ Pierce Cantrell cantrell@ee.tamu.edu
|
||||
R. Kent Dybvig dyb@cadence.bloomington.in.us
|
||||
R. Scott Butler butler@prism.es.dupont.com
|
||||
Rainer Orth ro@TechFak.Uni-Bielefeld.DE
|
||||
Ralf S. Engelschall rse@engelschall.com
|
||||
Ralf Suckow suckow@contrib.de
|
||||
Ralph Schleicher rs@purple.ul.bawue.de
|
||||
Randy Bias randyb@edge.edge.net
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
# 02111-1307, USA.
|
||||
|
||||
AC_INIT([GNU tar], [1.15], [bug-tar@gnu.org])
|
||||
AC_INIT([GNU tar], [1.15.1], [bug-tar@gnu.org])
|
||||
AC_CONFIG_SRCDIR([src/tar.c])
|
||||
AC_CONFIG_AUX_DIR([config])
|
||||
AC_CONFIG_HEADERS([config.h:config.hin])
|
||||
@@ -39,7 +39,7 @@ AC_CHECK_HEADERS(fcntl.h linux/fd.h memory.h net/errno.h \
|
||||
sys/param.h sys/device.h sys/gentape.h \
|
||||
sys/inet.h sys/io/trioctl.h \
|
||||
sys/mtio.h sys/time.h sys/tprintf.h sys/tape.h \
|
||||
unistd.h)
|
||||
unistd.h locale.h)
|
||||
|
||||
AC_CHECK_HEADERS([sys/buf.h], [], [],
|
||||
[#if HAVE_SYS_PARAM_H
|
||||
|
||||
@@ -1,79 +1,104 @@
|
||||
<!-- X-URL: %BASE_URL% -->
|
||||
<!-- Date: %DATE% -->
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>%PACKAGE_NAME% Reference Manual - Table of Contents - GNU Project - Free Software Foundation (FSF)</TITLE>
|
||||
<LINK REV="made" HREF="mailto:gray@gnu.org">
|
||||
<BASE HREF="%BASE_URL%">
|
||||
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=US-ASCII">
|
||||
<META NAME="keywords" CONTENT="tar rmt">
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#1F00FF" ALINK="#FF0000" VLINK="#9900DD">
|
||||
<H1>%PACKAGE_NAME% Reference Manual - Table of Contents</H1>
|
||||
<ADDRESS>Free Software Foundation</ADDRESS>
|
||||
<ADDRESS>last updated %UPDATED%</ADDRESS>
|
||||
<P>
|
||||
<A HREF="/graphics/gnu-head-sm.jpg"><IMG SRC="/graphics/gnu-head-sm.jpg"
|
||||
ALT=" [image of the Head of a GNU] "
|
||||
WIDTH="129" HEIGHT="122"> (jpeg 7k)</A>
|
||||
<A HREF="/graphics/gnu-head.jpg">(jpeg 21k)</A>
|
||||
<A HREF="/philosophy/gif.html">no gifs due to patent problems</A>
|
||||
<P>
|
||||
<P>
|
||||
<P><HR><P>
|
||||
<P>
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
|
||||
<head>
|
||||
<title>%PACKAGE_NAME% Reference Manual - Table of Contents - GNU Project - Free Software Foundation (FSF)</title>
|
||||
<link rev="made" href="mailto:gray@gnu.org" />
|
||||
<link rel="stylesheet" type="text/css" href="/gnu.css" />
|
||||
<link rel="stylesheet" type="text/css" href="/software/radius/style.css" />
|
||||
<link rel="icon" type="image/png" href="/graphics/gnu-head-icon.png" />
|
||||
</head>
|
||||
<body>
|
||||
<h1>%PACKAGE_NAME% Reference Manual - Table of Contents</h1>
|
||||
<address>Free Software Foundation</address>
|
||||
<address>last updated %UPDATED%</address>
|
||||
|
||||
<p>
|
||||
<a href="/graphics/agnuhead.html"><img src="/graphics/gnu-head-sm.jpg"
|
||||
alt=" [image of the Head of a GNU] "
|
||||
width="129" height="122" /></a>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
This manual is available in the following formats:
|
||||
<P>
|
||||
<UL>
|
||||
<LI>formatted in <A HREF="html_mono/%PACKAGE%.html">HTML
|
||||
(%HTML_SIZE%K characters)</A> entirely on one web page.</LI>
|
||||
<LI> formatted in <a href="html_chapter/%PACKAGE%_toc.html">HTML</a>
|
||||
with one web page per chapter.</LI>
|
||||
<LI> formatted in <a href="html_node/%PACKAGE%_toc.html">HTML</a>
|
||||
with one web page per node.</LI>
|
||||
<LI>formatted as an
|
||||
<A HREF="other/%PACKAGE%.info.tar.gz">Info document (%INFO_TAR_GZ_SIZE%K characters
|
||||
gzipped tar file)</A>.</LI>
|
||||
<LI>formatted as
|
||||
<A HREF="other/%PACKAGE%.text">ASCII text (%TEXT_SIZE%K characters)</A>.</LI>
|
||||
<LI>formatted as
|
||||
<A HREF="other/%PACKAGE%.dvi.gz">a TeX dvi file (%DVI_GZ_SIZE%K characters
|
||||
gzipped)</A>.</LI>
|
||||
<LI>formatted as
|
||||
<A href="other/%PACKAGE%.ps.gz">a PostScript file (%PS_GZ_SIZE%K characters
|
||||
gzipped)</A>.</LI>
|
||||
<LI>formatted as
|
||||
<A href="other/%PACKAGE%.pdf.gz">a PDF file (%PDF_GZ_SIZE%K characters
|
||||
gzipped)</A>.</LI>
|
||||
<LI>the original
|
||||
<A HREF="other/%PACKAGE%.texi.tar.gz">Texinfo source (%TEXI_TAR_GZ_SIZE%K characters
|
||||
gzipped tar file)</A></LI>
|
||||
</UL>
|
||||
<P>
|
||||
</p>
|
||||
|
||||
<HR>
|
||||
<ul class="doclist">
|
||||
<li>formatted in <a href="html_mono/%PACKAGE%.html">HTML
|
||||
(%HTML_SIZE%K characters)</a> entirely on one web page.</li>
|
||||
|
||||
<li>formatted in <a href="html_chapter/%PACKAGE%_toc.html">HTML</a>
|
||||
with one web page per chapter.</li>
|
||||
|
||||
<li>formatted in <a href="html_node/%PACKAGE%_toc.html">HTML</a>
|
||||
with one web page per node.</li>
|
||||
|
||||
<li>formatted as an
|
||||
<a href="other/%PACKAGE%.info.tar.gz">Info document (%INFO_TAR_GZ_SIZE%K characters
|
||||
gzipped tar file)</a>.</li>
|
||||
|
||||
<li>formatted as
|
||||
<a href="other/%PACKAGE%.text">ASCII text (%TEXT_SIZE%K characters)</a>.</li>
|
||||
|
||||
<li>formatted as
|
||||
<a href="other/%PACKAGE%.dvi.gz">a TeX dvi file (%DVI_GZ_SIZE%K characters
|
||||
gzipped)</a>.</li>
|
||||
|
||||
<li>formatted as
|
||||
<a href="other/%PACKAGE%.ps.gz">a PostScript file (%PS_GZ_SIZE%K characters
|
||||
gzipped)</a>.</li>
|
||||
|
||||
<li>formatted as
|
||||
<a href="other/%PACKAGE%.pdf.gz">a PDF file (%PDF_GZ_SIZE%K characters
|
||||
gzipped)</a>.</li>
|
||||
|
||||
<li>the original
|
||||
<a href="other/%PACKAGE%.texi.tar.gz">Texinfo source (%TEXI_TAR_GZ_SIZE%K characters
|
||||
gzipped tar file)</a></li>
|
||||
</ul>
|
||||
|
||||
<hr />
|
||||
|
||||
<p>
|
||||
<a href="http://validator.w3.org/check?uri=referer"><img
|
||||
src="http://www.w3.org/Icons/valid-xhtml10"
|
||||
alt="Valid XHTML 1.0!" height="31" width="88" /></a>
|
||||
</p>
|
||||
|
||||
<div class="copyright">
|
||||
<p>Return to <a href="/home.html">GNU's home page</a>.</p>
|
||||
|
||||
<p>Please send FSF & GNU inquiries & questions to
|
||||
<a href="mailto:gnu@gnu.org"><em>gnu@gnu.org</em></a>.
|
||||
There are also <a href="/home.html#ContactInfo">other ways to
|
||||
contact</a> the FSF.</p>
|
||||
|
||||
<p>Please send comments on these web pages to
|
||||
|
||||
<a href="mailto:webmasters@gnu.org"><em>webmasters@gnu.org</em></a>,
|
||||
|
||||
Return to <A HREF="/home.html">GNU's home page</A>.
|
||||
<P>
|
||||
Send FSF & GNU inquiries & questions to
|
||||
<A HREF="mailto:gnu@gnu.org"><EM>gnu@gnu.org</EM></A>.
|
||||
Other <A HREF="/home.html#ContactInfo">ways to contact</A> the FSF.
|
||||
<P>
|
||||
Comments on these web pages to
|
||||
<A HREF="mailto:webmasters@www.gnu.org"><EM>webmasters@www.gnu.org</EM></A>,
|
||||
send other questions to
|
||||
<A HREF="mailto:gnu@gnu.org"><EM>gnu@gnu.org</EM></A>.
|
||||
<P>
|
||||
Copyright (C) 1997, 1998 Free Software Foundation, Inc.,
|
||||
59 Temple Place - Suite 330, Boston, MA 02111, USA
|
||||
<P>
|
||||
Verbatim copying and distribution of this entire article is
|
||||
permitted in any medium, provided this notice is preserved.<HR>
|
||||
</BODY>
|
||||
</HTML>
|
||||
<!--
|
||||
Local Variables:
|
||||
mode: html
|
||||
end:
|
||||
-->
|
||||
<a href="mailto:gnu@gnu.org"><em>gnu@gnu.org</em></a>.</p>
|
||||
|
||||
<p>
|
||||
Copyright (C) 2001 Free Software Foundation, Inc.,
|
||||
59 Temple Place - Suite 330, Boston, MA 02111, USA</p>
|
||||
|
||||
<p>Verbatim copying and distribution of this entire article is
|
||||
permitted in any medium, provided this notice is preserved.</p>
|
||||
|
||||
<p>
|
||||
Updated:
|
||||
<!-- hhmts start -->
|
||||
$Date: 2004/12/21 16:21:53 $ $Author: gray $
|
||||
<!-- hhmts end -->
|
||||
</p>
|
||||
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
<!-- Local Variables: -->
|
||||
<!-- mode: html -->
|
||||
<!-- end: -->
|
||||
|
||||
94
src/buffer.c
94
src/buffer.c
@@ -177,32 +177,34 @@ static struct zip_magic magic[] = {
|
||||
#define compress_option(t) magic[t].option
|
||||
#define compress_program(t) magic[t].program
|
||||
|
||||
/* Check if the file FD is a compressed archive. FD is guaranteed to
|
||||
represent a local file */
|
||||
/* Check if the file ARCHIVE is a compressed archive. */
|
||||
enum compress_type
|
||||
check_compressed_archive (int fd)
|
||||
check_compressed_archive ()
|
||||
{
|
||||
struct zip_magic *p;
|
||||
size_t status;
|
||||
union block buf;
|
||||
|
||||
status = read (fd, &buf, sizeof buf);
|
||||
if (status != sizeof buf)
|
||||
{
|
||||
archive_read_error ();
|
||||
FATAL_ERROR ((0, 0, _("Quitting now.")));
|
||||
}
|
||||
bool sfr, srp;
|
||||
|
||||
lseek (fd, 0, SEEK_SET); /* This will fail if fd==0, but that does not
|
||||
matter, since we do not handle compressed
|
||||
stdin anyway */
|
||||
|
||||
if (tar_checksum (&buf) == HEADER_SUCCESS)
|
||||
/* Prepare global data needed for find_next_block: */
|
||||
record_end = record_start; /* set up for 1st record = # 0 */
|
||||
sfr = read_full_records;
|
||||
read_full_records = true; /* Suppress fatal error on reading a partial
|
||||
record */
|
||||
srp = reading_from_pipe;
|
||||
reading_from_pipe = true; /* Suppress warning message on reading a partial
|
||||
record */
|
||||
find_next_block ();
|
||||
|
||||
/* Restore global values */
|
||||
read_full_records = sfr;
|
||||
reading_from_pipe = srp;
|
||||
|
||||
if (tar_checksum (record_start, true) == HEADER_SUCCESS)
|
||||
/* Probably a valid header */
|
||||
return ct_none;
|
||||
|
||||
for (p = magic + 1; p < magic + NMAGIC; p++)
|
||||
if (memcmp (buf.buffer, p->magic, p->length) == 0)
|
||||
if (memcmp (record_start->buffer, p->magic, p->length) == 0)
|
||||
return p->type;
|
||||
|
||||
return ct_none;
|
||||
@@ -214,34 +216,33 @@ check_compressed_archive (int fd)
|
||||
int
|
||||
open_compressed_archive ()
|
||||
{
|
||||
enum compress_type type;
|
||||
int fd = rmtopen (archive_name_array[0], O_RDONLY | O_BINARY,
|
||||
MODE_RW, rsh_command_option);
|
||||
if (fd == -1 || _isrmt (fd))
|
||||
return fd;
|
||||
|
||||
type = check_compressed_archive (fd);
|
||||
|
||||
if (type == ct_none)
|
||||
archive = rmtopen (archive_name_array[0], O_RDONLY | O_BINARY,
|
||||
MODE_RW, rsh_command_option);
|
||||
if (archive == -1)
|
||||
return archive;
|
||||
|
||||
if (!multi_volume_option)
|
||||
{
|
||||
if (rmtlseek (fd, (off_t) 0, SEEK_CUR) != 0)
|
||||
{
|
||||
/* Archive may be not seekable. Reopen it. */
|
||||
rmtclose (fd);
|
||||
fd = rmtopen (archive_name_array[0], O_RDONLY | O_BINARY,
|
||||
MODE_RW, rsh_command_option);
|
||||
}
|
||||
return fd;
|
||||
enum compress_type type = check_compressed_archive ();
|
||||
|
||||
if (type == ct_none)
|
||||
return archive;
|
||||
|
||||
/* FD is not needed any more */
|
||||
rmtclose (archive);
|
||||
|
||||
hit_eof = false; /* It might have been set by find_next_block in
|
||||
check_compressed_archive */
|
||||
|
||||
/* Open compressed archive */
|
||||
use_compress_program_option = compress_program (type);
|
||||
child_pid = sys_child_open_for_uncompress ();
|
||||
read_full_records = reading_from_pipe = true;
|
||||
}
|
||||
|
||||
/* FD is not needed any more */
|
||||
rmtclose (fd);
|
||||
|
||||
/* Open compressed archive */
|
||||
use_compress_program_option = compress_program (type);
|
||||
child_pid = sys_child_open_for_uncompress ();
|
||||
read_full_records = reading_from_pipe = true;
|
||||
|
||||
|
||||
records_read = 0;
|
||||
record_end = record_start; /* set up for 1st record = # 0 */
|
||||
|
||||
return archive;
|
||||
}
|
||||
|
||||
@@ -408,6 +409,8 @@ open_archive (enum access_mode wanted_access)
|
||||
read_full_records = read_full_records_option;
|
||||
reading_from_pipe = false;
|
||||
|
||||
records_read = 0;
|
||||
|
||||
if (use_compress_program_option)
|
||||
{
|
||||
switch (wanted_access)
|
||||
@@ -415,6 +418,7 @@ open_archive (enum access_mode wanted_access)
|
||||
case ACCESS_READ:
|
||||
child_pid = sys_child_open_for_uncompress ();
|
||||
read_full_records = reading_from_pipe = true;
|
||||
record_end = record_start; /* set up for 1st record = # 0 */
|
||||
break;
|
||||
|
||||
case ACCESS_WRITE:
|
||||
@@ -509,9 +513,9 @@ open_archive (enum access_mode wanted_access)
|
||||
{
|
||||
case ACCESS_UPDATE:
|
||||
records_written = 0;
|
||||
case ACCESS_READ:
|
||||
records_read = 0;
|
||||
record_end = record_start; /* set up for 1st record = # 0 */
|
||||
|
||||
case ACCESS_READ:
|
||||
find_next_block (); /* read it in, check for EOF */
|
||||
|
||||
if (volume_label_option)
|
||||
|
||||
@@ -501,7 +501,7 @@ void print_for_mkdir (char *, int, mode_t);
|
||||
void print_header (struct tar_stat_info *, off_t);
|
||||
void read_and (void (*) (void));
|
||||
enum read_header read_header (bool);
|
||||
enum read_header tar_checksum (union block *header);
|
||||
enum read_header tar_checksum (union block *header, bool silent);
|
||||
void skip_file (off_t);
|
||||
void skip_member (void);
|
||||
|
||||
|
||||
71
src/list.c
71
src/list.c
@@ -37,7 +37,7 @@ size_t recent_long_name_blocks; /* number of blocks in recent_long_name */
|
||||
size_t recent_long_link_blocks; /* likewise, for long link */
|
||||
|
||||
static uintmax_t from_header (const char *, size_t, const char *,
|
||||
uintmax_t, uintmax_t);
|
||||
uintmax_t, uintmax_t, bool);
|
||||
|
||||
/* Base 64 digits; see Internet RFC 2045 Table 1. */
|
||||
static char const base_64_digits[64] =
|
||||
@@ -71,8 +71,8 @@ read_and (void (*do_something) (void))
|
||||
|
||||
base64_init ();
|
||||
name_gather ();
|
||||
open_archive (ACCESS_READ);
|
||||
|
||||
open_archive (ACCESS_READ);
|
||||
do
|
||||
{
|
||||
prev_status = status;
|
||||
@@ -277,7 +277,7 @@ list_archive (void)
|
||||
computes two checksums -- signed and unsigned. */
|
||||
|
||||
enum read_header
|
||||
tar_checksum (union block *header)
|
||||
tar_checksum (union block *header, bool silent)
|
||||
{
|
||||
size_t i;
|
||||
int unsigned_sum = 0; /* the POSIX one :-) */
|
||||
@@ -309,7 +309,7 @@ tar_checksum (union block *header)
|
||||
parsed_sum = from_header (header->header.chksum,
|
||||
sizeof header->header.chksum, 0,
|
||||
(uintmax_t) 0,
|
||||
(uintmax_t) TYPE_MAXIMUM (int));
|
||||
(uintmax_t) TYPE_MAXIMUM (int), silent);
|
||||
if (parsed_sum == (uintmax_t) -1)
|
||||
return HEADER_FAILURE;
|
||||
|
||||
@@ -357,7 +357,7 @@ read_header (bool raw_extended_headers)
|
||||
if (!header)
|
||||
return HEADER_END_OF_FILE;
|
||||
|
||||
if ((status = tar_checksum (header)) != HEADER_SUCCESS)
|
||||
if ((status = tar_checksum (header, false)) != HEADER_SUCCESS)
|
||||
return status;
|
||||
|
||||
/* Good block. Decode file size and return. */
|
||||
@@ -618,11 +618,12 @@ decode_header (union block *header, struct tar_stat_info *stat_info,
|
||||
/* Convert buffer at WHERE0 of size DIGS from external format to
|
||||
uintmax_t. The data is of type TYPE. The buffer must represent a
|
||||
value in the range -MINUS_MINVAL through MAXVAL. DIGS must be
|
||||
positive. Return -1 on error, diagnosing the error if TYPE is
|
||||
nonzero. */
|
||||
positive. SILENT=true inhibits printing diagnostic messages.
|
||||
Return -1 on error, diagnosing the error if TYPE is
|
||||
nonzero. */
|
||||
static uintmax_t
|
||||
from_header (char const *where0, size_t digs, char const *type,
|
||||
uintmax_t minus_minval, uintmax_t maxval)
|
||||
uintmax_t minus_minval, uintmax_t maxval, bool silent)
|
||||
{
|
||||
uintmax_t value;
|
||||
char const *where = where0;
|
||||
@@ -638,7 +639,7 @@ from_header (char const *where0, size_t digs, char const *type,
|
||||
{
|
||||
if (where == lim)
|
||||
{
|
||||
if (type)
|
||||
if (type && !silent)
|
||||
ERROR ((0, 0,
|
||||
_("Blanks in header where numeric %s value expected"),
|
||||
type));
|
||||
@@ -692,16 +693,17 @@ from_header (char const *where0, size_t digs, char const *type,
|
||||
|
||||
if (!overflow && value <= minus_minval)
|
||||
{
|
||||
WARN ((0, 0,
|
||||
_("Archive octal value %.*s is out of %s range; assuming two's complement"),
|
||||
(int) (where - where1), where1, type));
|
||||
if (!silent)
|
||||
WARN ((0, 0,
|
||||
_("Archive octal value %.*s is out of %s range; assuming two's complement"),
|
||||
(int) (where - where1), where1, type));
|
||||
negative = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (overflow)
|
||||
{
|
||||
if (type)
|
||||
if (type && !silent)
|
||||
ERROR ((0, 0,
|
||||
_("Archive octal value %.*s is out of %s range"),
|
||||
(int) (where - where1), where1, type));
|
||||
@@ -718,8 +720,9 @@ from_header (char const *where0, size_t digs, char const *type,
|
||||
if (! warned_once)
|
||||
{
|
||||
warned_once = 1;
|
||||
WARN ((0, 0,
|
||||
_("Archive contains obsolescent base-64 headers")));
|
||||
if (!silent)
|
||||
WARN ((0, 0,
|
||||
_("Archive contains obsolescent base-64 headers")));
|
||||
}
|
||||
negative = *where++ == '-';
|
||||
while (where != lim
|
||||
@@ -730,7 +733,7 @@ from_header (char const *where0, size_t digs, char const *type,
|
||||
char *string = alloca (digs + 1);
|
||||
memcpy (string, where0, digs);
|
||||
string[digs] = '\0';
|
||||
if (type)
|
||||
if (type && !silent)
|
||||
ERROR ((0, 0,
|
||||
_("Archive signed base-64 string %s is out of %s range"),
|
||||
quote (string), type));
|
||||
@@ -761,7 +764,7 @@ from_header (char const *where0, size_t digs, char const *type,
|
||||
break;
|
||||
if (((value << LG_256 >> LG_256) | topbits) != value)
|
||||
{
|
||||
if (type)
|
||||
if (type && !silent)
|
||||
ERROR ((0, 0,
|
||||
_("Archive base-256 value is out of %s range"),
|
||||
type));
|
||||
@@ -789,9 +792,10 @@ from_header (char const *where0, size_t digs, char const *type,
|
||||
while (where0 != lim && ! lim[-1])
|
||||
lim--;
|
||||
quotearg_buffer (buf, sizeof buf, where0, lim - where, o);
|
||||
ERROR ((0, 0,
|
||||
_("Archive contains %.*s where numeric %s value expected"),
|
||||
(int) sizeof buf, buf, type));
|
||||
if (!silent)
|
||||
ERROR ((0, 0,
|
||||
_("Archive contains %.*s where numeric %s value expected"),
|
||||
(int) sizeof buf, buf, type));
|
||||
}
|
||||
|
||||
return -1;
|
||||
@@ -800,7 +804,7 @@ from_header (char const *where0, size_t digs, char const *type,
|
||||
if (value <= (negative ? minus_minval : maxval))
|
||||
return negative ? -value : value;
|
||||
|
||||
if (type)
|
||||
if (type && !silent)
|
||||
{
|
||||
char minval_buf[UINTMAX_STRSIZE_BOUND + 1];
|
||||
char maxval_buf[UINTMAX_STRSIZE_BOUND];
|
||||
@@ -824,7 +828,8 @@ gid_from_header (const char *p, size_t s)
|
||||
{
|
||||
return from_header (p, s, "gid_t",
|
||||
- (uintmax_t) TYPE_MINIMUM (gid_t),
|
||||
(uintmax_t) TYPE_MAXIMUM (gid_t));
|
||||
(uintmax_t) TYPE_MAXIMUM (gid_t),
|
||||
false);
|
||||
}
|
||||
|
||||
major_t
|
||||
@@ -832,7 +837,7 @@ major_from_header (const char *p, size_t s)
|
||||
{
|
||||
return from_header (p, s, "major_t",
|
||||
- (uintmax_t) TYPE_MINIMUM (major_t),
|
||||
(uintmax_t) TYPE_MAXIMUM (major_t));
|
||||
(uintmax_t) TYPE_MAXIMUM (major_t), false);
|
||||
}
|
||||
|
||||
minor_t
|
||||
@@ -840,7 +845,7 @@ minor_from_header (const char *p, size_t s)
|
||||
{
|
||||
return from_header (p, s, "minor_t",
|
||||
- (uintmax_t) TYPE_MINIMUM (minor_t),
|
||||
(uintmax_t) TYPE_MAXIMUM (minor_t));
|
||||
(uintmax_t) TYPE_MAXIMUM (minor_t), false);
|
||||
}
|
||||
|
||||
mode_t
|
||||
@@ -849,7 +854,7 @@ mode_from_header (const char *p, size_t s)
|
||||
/* Do not complain about unrecognized mode bits. */
|
||||
unsigned u = from_header (p, s, "mode_t",
|
||||
- (uintmax_t) TYPE_MINIMUM (mode_t),
|
||||
TYPE_MAXIMUM (uintmax_t));
|
||||
TYPE_MAXIMUM (uintmax_t), false);
|
||||
return ((u & TSUID ? S_ISUID : 0)
|
||||
| (u & TSGID ? S_ISGID : 0)
|
||||
| (u & TSVTX ? S_ISVTX : 0)
|
||||
@@ -870,14 +875,14 @@ off_from_header (const char *p, size_t s)
|
||||
/* Negative offsets are not allowed in tar files, so invoke
|
||||
from_header with minimum value 0, not TYPE_MINIMUM (off_t). */
|
||||
return from_header (p, s, "off_t", (uintmax_t) 0,
|
||||
(uintmax_t) TYPE_MAXIMUM (off_t));
|
||||
(uintmax_t) TYPE_MAXIMUM (off_t), false);
|
||||
}
|
||||
|
||||
size_t
|
||||
size_from_header (const char *p, size_t s)
|
||||
{
|
||||
return from_header (p, s, "size_t", (uintmax_t) 0,
|
||||
(uintmax_t) TYPE_MAXIMUM (size_t));
|
||||
(uintmax_t) TYPE_MAXIMUM (size_t), false);
|
||||
}
|
||||
|
||||
time_t
|
||||
@@ -885,7 +890,7 @@ time_from_header (const char *p, size_t s)
|
||||
{
|
||||
return from_header (p, s, "time_t",
|
||||
- (uintmax_t) TYPE_MINIMUM (time_t),
|
||||
(uintmax_t) TYPE_MAXIMUM (time_t));
|
||||
(uintmax_t) TYPE_MAXIMUM (time_t), false);
|
||||
}
|
||||
|
||||
uid_t
|
||||
@@ -893,14 +898,14 @@ uid_from_header (const char *p, size_t s)
|
||||
{
|
||||
return from_header (p, s, "uid_t",
|
||||
- (uintmax_t) TYPE_MINIMUM (uid_t),
|
||||
(uintmax_t) TYPE_MAXIMUM (uid_t));
|
||||
(uintmax_t) TYPE_MAXIMUM (uid_t), false);
|
||||
}
|
||||
|
||||
uintmax_t
|
||||
uintmax_from_header (const char *p, size_t s)
|
||||
{
|
||||
return from_header (p, s, "uintmax_t", (uintmax_t) 0,
|
||||
TYPE_MAXIMUM (uintmax_t));
|
||||
TYPE_MAXIMUM (uintmax_t), false);
|
||||
}
|
||||
|
||||
|
||||
@@ -1095,7 +1100,8 @@ print_header (struct tar_stat_info *st, off_t block_ordinal)
|
||||
uintmax_t u = from_header (current_header->header.uid,
|
||||
sizeof current_header->header.uid, 0,
|
||||
(uintmax_t) 0,
|
||||
(uintmax_t) TYPE_MAXIMUM (uintmax_t));
|
||||
(uintmax_t) TYPE_MAXIMUM (uintmax_t),
|
||||
false);
|
||||
if (u != -1)
|
||||
user = STRINGIFY_BIGINT (u, uform);
|
||||
else
|
||||
@@ -1117,7 +1123,8 @@ print_header (struct tar_stat_info *st, off_t block_ordinal)
|
||||
uintmax_t g = from_header (current_header->header.gid,
|
||||
sizeof current_header->header.gid, 0,
|
||||
(uintmax_t) 0,
|
||||
(uintmax_t) TYPE_MAXIMUM (uintmax_t));
|
||||
(uintmax_t) TYPE_MAXIMUM (uintmax_t),
|
||||
false);
|
||||
if (g != -1)
|
||||
group = STRINGIFY_BIGINT (g, gform);
|
||||
else
|
||||
|
||||
@@ -1621,6 +1621,7 @@ main (int argc, char **argv)
|
||||
{
|
||||
set_start_time ();
|
||||
program_name = argv[0];
|
||||
|
||||
setlocale (LC_ALL, "");
|
||||
bindtextdomain (PACKAGE, LOCALEDIR);
|
||||
textdomain (PACKAGE);
|
||||
|
||||
@@ -47,6 +47,7 @@ $(srcdir)/package.m4: $(top_srcdir)/configure.ac
|
||||
|
||||
TESTSUITE_AT = \
|
||||
testsuite.at\
|
||||
comprec.at\
|
||||
delete01.at\
|
||||
delete02.at\
|
||||
delete03.at\
|
||||
@@ -69,6 +70,7 @@ TESTSUITE_AT = \
|
||||
multiv03.at\
|
||||
old.at\
|
||||
options.at\
|
||||
pipe.at\
|
||||
recurse.at\
|
||||
same-order01.at\
|
||||
same-order02.at\
|
||||
|
||||
41
tests/comprec.at
Normal file
41
tests/comprec.at
Normal file
@@ -0,0 +1,41 @@
|
||||
# Process this file with autom4te to create testsuite. -*- Autotest -*-
|
||||
|
||||
# Test suite for GNU tar.
|
||||
# Copyright (C) 2004 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
# 02111-1307, USA.
|
||||
|
||||
AT_SETUP([compressed format recognition])
|
||||
|
||||
AT_KEYWORDS([comprec])
|
||||
|
||||
AT_TAR_CHECK([
|
||||
AT_GZIP_PREREQ
|
||||
genfile --length 10240 > file1
|
||||
echo "separator"
|
||||
tar cfz archive file1
|
||||
echo "separator"
|
||||
mv file1 orig
|
||||
tar xfv archive
|
||||
cmp orig file1
|
||||
],
|
||||
[0],
|
||||
[separator
|
||||
separator
|
||||
file1
|
||||
])
|
||||
|
||||
AT_CLEANUP
|
||||
@@ -35,7 +35,7 @@ tar -cf archive ./file1 directory
|
||||
tar -tf archive \
|
||||
--exclude='./*1' \
|
||||
--exclude='d*/*1' \
|
||||
--exclude='d*/s*/*2' | sort
|
||||
--exclude='d*/s*/*2' | sort 2>/dev/null
|
||||
],
|
||||
[0],
|
||||
[directory/
|
||||
|
||||
@@ -26,6 +26,7 @@ AT_KEYWORDS([gzip])
|
||||
unset TAR_OPTIONS
|
||||
|
||||
AT_CHECK([
|
||||
AT_GZIP_PREREQ
|
||||
tar xfvz /dev/null
|
||||
test $? = 2 || exit 1
|
||||
],
|
||||
@@ -38,4 +39,4 @@ tar: Error exit delayed from previous errors
|
||||
],
|
||||
[],[])
|
||||
|
||||
AT_CLEANUP
|
||||
AT_CLEANUP
|
||||
|
||||
@@ -57,7 +57,7 @@ mv tart/c1 tart/c2
|
||||
touch tart/c2/ca3
|
||||
|
||||
echo Directory contents
|
||||
find tart|sort
|
||||
find tart|sort 2>/dev/null
|
||||
|
||||
sleep 1
|
||||
echo Creating incremental archive
|
||||
@@ -73,10 +73,10 @@ echo Extracting incremental archive
|
||||
# This command should produce three messages about deletion
|
||||
# of the existing files, that may appear in any order. Piping
|
||||
# to sort makes sure we don't depend on any particular ordering.
|
||||
tar -x -v --listed-incremental=tart.incr2 -f archive.2 | sort
|
||||
tar -x -v --listed-incremental=tart.incr2 -f archive.2 | sort 2>/dev/null
|
||||
|
||||
echo Final files:
|
||||
find tart|sort
|
||||
find tart|sort 2>/dev/null
|
||||
],
|
||||
[0],
|
||||
[Create directories
|
||||
|
||||
52
tests/pipe.at
Normal file
52
tests/pipe.at
Normal file
@@ -0,0 +1,52 @@
|
||||
# Process this file with autom4te to create testsuite. -*- Autotest -*-
|
||||
|
||||
# Test suite for GNU tar.
|
||||
# Copyright (C) 2004 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
# 02111-1307, USA.
|
||||
|
||||
# Recognition of compressed formats, introduced with tar 1.15, broke
|
||||
# untarring of archives from standard input.
|
||||
# References:
|
||||
# 1) <20041221040834.GA9635@tigers-lfs.nsw.bigpond.net.au>
|
||||
# http://lists.gnu.org/archive/html/bug-tar/2004-12/msg00031.html
|
||||
# 2) <20041221093801.GA55537@engelschall.com>
|
||||
# http://lists.gnu.org/archive/html/bug-tar/2004-12/msg00026.html
|
||||
|
||||
AT_SETUP([decompressing from stdin])
|
||||
|
||||
AT_KEYWORDS([pipe])
|
||||
|
||||
AT_TAR_CHECK([
|
||||
mkdir directory
|
||||
genfile --length 10240 --pattern zeros > directory/file1
|
||||
genfile --length 13 > directory/file2
|
||||
tar cf archive directory
|
||||
mv directory orig
|
||||
cat archive | tar xfv -
|
||||
echo "separator"
|
||||
cmp orig/file1 directory/file1
|
||||
echo "separator"
|
||||
cmp orig/file2 directory/file2],
|
||||
[0],
|
||||
[directory/
|
||||
directory/file1
|
||||
directory/file2
|
||||
separator
|
||||
separator
|
||||
])
|
||||
|
||||
AT_CLEANUP
|
||||
@@ -24,6 +24,7 @@ AT_KEYWORDS([pax-big-10g])
|
||||
unset TAR_OPTIONS
|
||||
|
||||
AT_CHECK([
|
||||
AT_GZIP_PREREQ([bzip2])
|
||||
AT_STAR_PREREQ([pax-big-10g.tar.bz2])
|
||||
|
||||
tar --utc -tvjf $STAR_TESTSCRIPTS/pax-big-10g.tar.bz2
|
||||
|
||||
@@ -24,6 +24,7 @@ AT_KEYWORDS([ustar-big-2g])
|
||||
unset TAR_OPTIONS
|
||||
|
||||
AT_CHECK([
|
||||
AT_GZIP_PREREQ([bzip2])
|
||||
AT_STAR_PREREQ([ustar-big-2g.tar.bz2])
|
||||
|
||||
tar --utc -tvjf $STAR_TESTSCRIPTS/ustar-big-2g.tar.bz2
|
||||
|
||||
@@ -24,6 +24,7 @@ AT_KEYWORDS([ustar-big-8g])
|
||||
unset TAR_OPTIONS
|
||||
|
||||
AT_CHECK([
|
||||
AT_GZIP_PREREQ([bzip2])
|
||||
AT_STAR_PREREQ([ustar-big-8g.tar.bz2])
|
||||
|
||||
tar --utc -tvjf $STAR_TESTSCRIPTS/ustar-big-8g.tar.bz2
|
||||
|
||||
@@ -50,12 +50,18 @@ test -z "$STAR_TESTSCRIPTS" && AT_SKIP_TEST
|
||||
test -r "$STAR_TESTSCRIPTS/$1" || AT_SKIP_TEST
|
||||
])
|
||||
|
||||
m4_define([AT_GZIP_PREREQ],[
|
||||
cat /dev/null | m4_if([$1],[],gzip,[$1]) - > /dev/null 2>&1 || AT_SKIP_TEST
|
||||
])
|
||||
|
||||
AT_INIT
|
||||
|
||||
AT_TESTED([tar])
|
||||
|
||||
m4_include([version.at])
|
||||
|
||||
m4_include([pipe.at])
|
||||
|
||||
m4_include([options.at])
|
||||
|
||||
m4_include([append.at])
|
||||
@@ -100,6 +106,8 @@ m4_include([sparse01.at])
|
||||
|
||||
m4_include([volume.at])
|
||||
|
||||
m4_include([comprec.at])
|
||||
|
||||
m4_include([star/gtarfail.at])
|
||||
m4_include([star/gtarfail2.at])
|
||||
|
||||
|
||||
Reference in New Issue
Block a user