Commit Graph

208 Commits

Author SHA1 Message Date
Sergey Poznyakoff
ae23a57d70 Improve option sanity checking
Any two conflicting options are reported only if they both occur in
the command line.  Otherwise, options defined in the command line
silently override those set in the TAR_OPTIONS environment variable.

* src/common.h (option_source): New enum.
(option_locus): New struct.
* src/names.c (name_elt): New member: line.
(name_add_file): Initialize line.
(read_name_from_file): Keep track of input line number for diagnostic
purposes.
(handle_option): Take a pointer to struct name_elt as 2nd parameter;
pass locus info to more_options().
* src/tar.c (tar_args): New member: loc.
(option_class): New enum.
(optloc_save,optloc_lookup)
(option_set_in_cl,optloc_eq): New functions.
(set_use_compress_program_option): Take into account option location.
(set_old_files_option): New function.
(parse_opt): Keep track of option locations.
(more_options): Improve error reporting.
(parse_default_options): New function.
(decode_options): Parse TAR_OPTION and command line separately.
Options from the latter silently override those from the former.

* lib/prepargs.c: Remove.
* lib/prepargs.h: Remove.
* lib/Makefile.am: Update.
2015-08-31 08:37:46 +03:00
Paul Eggert
da06935f6e tar: pacify GCC 5.1 -Wformat-signedness
* lib/wordsplit.c (struct wordsplit_node.flags):
Now unsigned, so that 'printf ("%x", p->flags)' doesn't provoke GCC.
* src/incremen.c (read_num, dumpdir_ok):
Don't printf an int with %x or %o.
2015-07-13 09:53:55 -07:00
Paul Eggert
9c2b57232e tar: port xattr-at.c to Solaris 10
* lib/xattr-at.c (setxattrat, lsetxattrat, getxattrat, lgetxattrat)
(listxattrat, llistxattrat): Compile only if HAVE_XATTRS, so that
the code doesn't call functions that are not declared.
2015-01-05 20:24:42 -08:00
Paul Eggert
55fb2fc38f tar: port wordsplit attribute to Sun C
Reported by Ted Carr in:
http://lists.gnu.org/archive/html/bug-tar/2015-01/msg00002.html
* lib/wordsplit.h (__WORDSPLIT_ATTRIBUTE_FORMAT):
New macro, taken from Gnulib.
(struct wordsplit): Use it.
* lib/wordsplit.c (_wsplt_error): Use it.
2015-01-05 20:09:09 -08:00
Sergey Poznyakoff
48a546b02c Use correct headers/libraries when providing xattr support
See https://savannah.gnu.org/patch/index.php?8252. Patch provided
by Anthony G. Basile.

* acinclude.m4 (TAR_HEADERS_ATTR_XATTR_H): Look for <sys/xattr.h>
first and then for <attr/xattr.h>.  Link against libattr.so if
needed.
* lib/xattr-at.h: Include sys/xattr.h or attr/xattr.h, depending
on which one is detected.
* src/Makefile.am [TAR_LIB_ATTR] (tar_LDADD): Link against -lattr.
2014-02-14 10:55:26 +02:00
Sergey Poznyakoff
45ccda1193 Update copyright years. 2014-01-30 13:54:15 +02:00
Paul Eggert
5c5f62e0dc tar: update ancient configure cruft
* configure.ac: Use AC_PROG_CC_STDC, not just AC_PROG_CC.
Remove obsolete macros AC_ISC_POSIX, AC_HEADER_SYS_WAIT,
AC_HEADER_DIRENT, AC_HEADER_STAT, AC_HEADER_STDC, AC_TYPE_SIGNAL,
AC_TYPE_SIZE_T.
* lib/prepargs.c (IN_CTYPE_DOMAIN): Remove.  All uses removed.
* src/list.c (from_header): Use isspace, not ISSPACE.
* src/system.c (pipe_handler, sys_exec_info_script):
* src/tar.c (sigstat):
Use void, not RETSIGTYPE.
2014-01-03 11:48:57 -08:00
Paul Eggert
17f99bc6f1 tar: remove lint
* lib/wordsplit.c (_wsplit_error): Mark with printf attribute.
(expvar): "Use" defstr to pacify GCC.
* src/system.c (xexec): Now _Noreturn, to pacify GCC.
(run_decompress_program): Add cast to pacify GCC.
(sys_exec_command, sys_exec_info_script, sys_exec_checkpoint_script):
Remove unused variables.
2013-02-20 08:10:10 -08:00
Sergey Poznyakoff
7b5e803963 Pass command line arguments to external commands.
Any option taking a command name as its argument accepts
additional arguments as well.

* lib/wordsplit.c: New file.
* lib/wordsplit.h: New file.
* lib/Makefile.am: Add new files.
* src/system.c (xexec): New function.
(run_decompress_program): Use wordsplit.
(sys_child_open_for_compress,sys_exec_command)
(sys_exec_info_script)
(sys_exec_checkpoint_script): Use xexec to invoke external
command.

* NEWS: Update.
* doc/tar.texi: Update.
2013-02-10 14:43:43 +02:00
Paul Eggert
cd7bdd4076 maint: update copyrights for 2013 and as per current GNU standards 2012-12-31 13:17:15 -08:00
Paul Eggert
cbc51277aa build: new configure option --enable-gcc-warnings
This has a similar meaning as in other GNU applications
such as coreutils and Emacs.
* NEWS: Document it.
* .gitignore: Remove redundant build-aux.
Remove gnu, since gnu/Makefile.am is now in git.
Add gnu/.gitignore, gnu/charset.alias, gnu/*.h, gnu/*/ to cover
autogenerated files.
* bootstrap.conf (gnulib_mk): Remove.
* configure.ac: Add support for --enable-gcc-warnings,
taken from coreutils and simplified.
* gnu/Makefile.am: New file.  Formerly this was autogenerated,
but the autogenerated file has been renamed to gnulib.mk,
its usual name when bootstrapping from gnulib.
This way, AM_CFLAGS can incorporate warning options.
* gnulib.modules: Add manywarnings.
* lib/Makefile.am, src/Makefile.am (AM_CFLAGS): New macro,
incorporating warning options.
* lib/attr-xattr.in.h (ENOATTR): New macro, if not already defined.
* src/buffer.c (magic): Don't rely on incomplete initializers.
* src/common.h (report_difference): Add printf format attribute.
* src/system.c (sys_exec_command, sys_exec_info_script)
(sys_exec_checkpoint_script):
* src/tar.c (update_argv):
Add casts to char * to pacify GCC warnings about using string
literals in a char * context.
* src/xattrs.c, src/xattrs.h (xattrs_clear_setup):
Declare parameters as (void), not ().
* src/xheader.c (xheader_format_name): Initialize pptr to null,
to pacify GCC.  Remove unnecessary test of nptr versus null.
2012-12-18 20:37:03 -08:00
Sergey Poznyakoff
d350b509c0 Use AM_CPPFLAGS instead of INCLUDES. 2012-12-01 19:07:47 +02:00
Sergey Poznyakoff
b997c90f9e Prepare for implementing extended attribute support.
This patch adds *xattr() stubs in case extended attribute support is
not present and implements the *attrat() family of functions.  Based
on the patch by Pavel Raiskup <pavel@raiskup.cz> for gnulib.

* acinclude.m4 (TAR_HEADERS_ATTR_XATTR_H): New defun.
* configure.ac: Call TAR_HEADERS_ATTR_XATTR_H
* lib/Makefile.am: Add xattr-at.[ch], distribute attr-xattr.in.h
[!TAR_COND_XATTR_H]: Build attr/xattr.h
* lib/attr-xattr.in.h: New file.
* lib/xattr-at.c: New file.
* lib/xattr-at.h: New file.
2012-11-18 19:55:43 +02:00
Paul Eggert
9fe65e2520 .gitignore: update
* .gitignore: Add rmt.
* lib/.gitignore: New file.
2011-08-13 10:20:40 -07:00
Paul Eggert
bb971a1e8a tar: adjust to paxutils change: paxexit.c -> paxexit-status.c
* lib/Makefile.am (libtar_a_SOURCES): paxexit.c renamed to
paxexit-status.c.
2010-11-23 21:41:50 -08:00
Paul Eggert
0ab5e64ac0 tar: remove trailing white space from source files
* ChangeLog.1, ChangeLog.CVS, Makefile.am, NEWS, README:
* README-hacking, directory, doc/Makefile.am, doc/dumpdir.texi:
* doc/gendocs_template, doc/intern.texi, doc/mastermenu.el:
* doc/snapshot.texi, doc/sparse.texi, doc/tar-snapshot-edit.texi:
* doc/value.texi, lib/Makefile.am, scripts/backup-specs:
* scripts/dump-remind.in, scripts/tar-snapshot-edit, scripts/tarcat:
* scripts/xsparse.c, src/arith.h, src/buffer.c, src/compare.c:
* src/create.c, src/delete.c, src/exit.c, src/suffix.c, src/tar.c:
* src/tar.h, src/update.c, src/warning.c, src/xheader.c:
* tests/append01.at, tests/append02.at, tests/atlocal.in:
* tests/delete03.at, tests/exclude.at, tests/exclude06.at:
* tests/extrac04.at, tests/extrac05.at, tests/extrac06.at:
* tests/extrac07.at, tests/filerem01.at, tests/filerem02.at:
* tests/incr01.at, tests/incr02.at, tests/incr03.at, tests/incr06.at:
* tests/label02.at, tests/label03.at, tests/label04.at:
* tests/label05.at, tests/link02.at, tests/link03.at:
* tests/listed01.at, tests/listed02.at, tests/long01.at:
* tests/longv7.at, tests/multiv01.at, tests/multiv02.at:
* tests/multiv03.at, tests/multiv05.at, tests/multiv06.at:
* tests/multiv07.at, tests/multiv08.at, tests/options.at:
* tests/options02.at, tests/remfiles03.at, tests/rename01.at:
* tests/rename02.at, tests/rename03.at, tests/rename04.at:
* tests/rename05.at, tests/same-order01.at, tests/same-order02.at:
* tests/shortfile.at, tests/shortupd.at, tests/sparse01.at:
* tests/sparse02.at, tests/sparsemv.at, tests/sparsemvp.at:
* tests/star/README, tests/star/gtarfail2.at:
* tests/star/multi-fail.at:
* tests/star/pax-big-10g.at, tests/star/quicktest.sh:
* tests/star/ustar-big-2g.at, tests/star/ustar-big-8g.at:
* tests/update01.at, tests/update02.at, tests/volsize.at:
* tests/volume.at:
Remove trailing spaces and tabs from lines, and remove
trailing empty lines from files.  This makes it a bit easier
to share code among coreutils and other projects that do this.
2010-08-19 15:50:07 -07:00
Sergey Poznyakoff
c4acbdaa97 Enable silent build mode.
* configure.ac: Require automake 1.11, autoconf 2.63. Enable silent rules.
* NEWS: Update.
* lib/Makefile.am (rmt-command.h): Silent the rule.
2010-01-26 13:42:48 +02:00
Sergey Poznyakoff
c30c4ffb9f Remove files that were removed in CVS, but reappeared after migration to Git 2009-06-18 14:24:50 +03:00
Sergey Poznyakoff
ac6caa71bc Migrate to Git 2009-03-07 16:30:44 +02:00
Sergey Poznyakoff
5fa60b8d43 Version 1.22 2009-03-05 07:22:56 +00:00
Sergey Poznyakoff
7a968d67c8 Minor fix 2009-01-19 10:53:58 +00:00
Sergey Poznyakoff
b4ec8aedf9 * NEWS, configure.ac: Version 1.20.91
* doc/tar.texi: Document transformation scope flags.
* src/common.h (transform_symlinks_option): Remove in favor of
transformation scope flags.
(XFORM_REGFILE, XFORM_LINK, XFORM_SYMLINK, XFORM_ALL): New macros.
(transform_name, transform_member_name, transform_name_fp): Take
an additional argument, specifying scope flags.
* src/create.c: Reflect changes to transform_name.
* src/extract.c (extract_link, extract_symlink): Remove calls to
transform_member_name. It is done in read_header.
* src/list.c (decode_xform): Reflect change in data type of 2nd
argument.
(transform_member_name): 2nd arg is int.
(decode_header): Transform file name and link target names.
* src/tar.c: Remove --transform-symlinks.
* src/transform.c (struct transform): New member `flags'.
(transform_flags): New variable.
(parse_transform_expr): Parse transformation scope flags. Allow to
set global flags using `flags=' syntax.
(_transform_name_to_obstack, transform_name_fp)
(transform_name): Take an additional argument, specifying scope
flags.
2008-10-30 14:13:01 +00:00
Sergey Poznyakoff
57bfbbde90 * src/common.h (transform_symlinks_option): New global.
* src/create.c (dump_file0): Transform symlink targets only if
explicitly required.  Thanks Cyril Strejc for reporting the
problem.
* src/tar.c (parse_opt): New options --transform-symlinks and
--no-transform-symlinks. New alias --xform to the --transform
option.
* doc/tar.texi: Document --transform-symlinks
* NEWS: Update.
* THANKS: Update.

* src/names.c (name_gather): Use xzalloc.
* src/buffer.c (short_read): Move record size detection before
the loop.
2008-10-16 11:07:19 +00:00
Sergey Poznyakoff
985637ab5a Bugfixes.
* src/buffer.c (try_new_volume): Print more information with error
diagnostics.
(_gnu_flush_write): Improve error checking.  Adjust
real_s_sizeleft before calling new_volume to avoid creating
malformed multivolume headers.
* tests/delete05.at, tests/gzip.at, tests/ignfail.at,
tests/longv7.at, tests/lustar01.at, tests/lustar02.at,
tests/shortfile.at: Update to match new diagnostic wording
(see 2008-05-06).

* NEWS: Update.
2008-06-26 06:32:25 +00:00
Sergey Poznyakoff
e496c1b529 * bootstrap: Use rsync to get translations.
* doc/tar.texi: Minor change.
* lib/.cvsignore: Update
* po/.cvsignore: Update
* src/system.c: Remove include setenv.h.
* tests/atlocal.in (STAR_DATA_URL): Update.
* tests/star/README: Update URL.
2008-03-06 08:17:33 +00:00
Sergey Poznyakoff
7efe3850f6 * NEWS: Update.
* configure.ac: Version 1.19.90
* po/POTFILES.in: Add missing files.
* src/compare.c (verify_volume): Honor --ignore-zeros.
Proposed by Jan-Benedict Glaw.
* tests/shortfile.at (AT_KEYWORDS): Add shortfile0.
2008-02-08 14:12:22 +00:00
Paul Eggert
3f12066739 Adjust to recent gnulib changes.
* configure.ac: Dont' check for strerror, since gnulib now does this.
* .cvsignore: Add m4, tar-[0-9]*.
* lib/.cvsignore: Adjust to various gnulib file name changes.
Add .deps, rmt-command.h.

SCALAR(0x830b0dc)
directories.

SCALAR(0x831ad2c)
2007-10-11 22:04:44 +00:00
Sergey Poznyakoff
3b74fbfc3b Update 2007-10-10 11:04:25 +00:00
Sergey Poznyakoff
1fb35e7374 Final update for GPLv3 2007-06-29 20:20:02 +00:00
Sergey Poznyakoff
3fe0f0d7f8 Update 2007-06-27 14:06:55 +00:00
Sergey Poznyakoff
c3d4fee823 Restore after an accidental remove 2007-06-27 13:46:15 +00:00
Sergey Poznyakoff
a0fb51e136 Relicense under GPLv3 2007-06-27 13:30:12 +00:00
Sergey Poznyakoff
eeb610da48 Update 2007-05-19 17:04:34 +00:00
Paul Eggert
f32828d577 Adjust to latest Gnulib.
* lib/.cvsignore: Add dirfd.c, dirfd.h, float+.h, mbscasecmp.c,
stdio.h, stdio_.h, stdlib.h, stdlib_.h, time.h, time_.h, unistd.h.
Remove exit.h, getcwd.h, mempcpy.h, memrchr.h, mkdtemp.h, stpcpy.h,
strcase.h, strchrnul.h, strdup.h, strndup.h, strnlen.h, time_r.h,
vsnprintf.h.
* m4/.cvsignore: Remove localedir.h.  Sort.
2007-04-13 00:51:07 +00:00
Paul Eggert
5c890a6003 Adjust to recent gnulib changes.
* lib/.cvsignore: Add fchownat.c, rmt-command.h, strerror.c, string.h,
string_.h, sys, sys_time_.h, unistd_.h, wchar_.h, wctype_.h.
Remove localedir.h, size_max.h, xsize.h.
* src/xheader.c: Don't include stpcpy.h; no longer needed, now that
gnulib string.h defines stpcpy on all platforms.
2007-01-26 23:02:40 +00:00
Paul Eggert
409bddf38c * lib/.cvsignore: Add fstatat.c, gnulib.mk, openat-proc.c, same-inode.h, stat_.h,
tempname.c, tempname.h, uinttostr.c.
2006-11-30 06:27:24 +00:00
Paul Eggert
c930802f31 Port to latest gnulib. There were a lot of changes, so the
simplest way to get this up and running was to switch to coreutils
bootstrap procedure.  I noticed one feature missing after this
merge: the ability to update a single .po file.  I can add that
later if need be.
* README-cvs, bootstrap.conf: New files.
* lib/.cvsignore: Remove Makefile.am, printf-parse.c, vasnprintf.c.
* lib/printf-parse.c, lib/vasnprintf.c: New files, from coreutils,
to override gnulib, so that we don't need xsize.h.
* bootstrap: Replace with coreutils bootstrap, except add support
for paxutils.
* configure.ac (gl_USE_SYSTEM_EXTENSIONS): Remove, as gl_EARLY now
does this.
(gl_EARLY, gl_INIT): Add.
(tar_GNULIB): Remove.
* gnulib.modules: Add configmake.
* lib/Makefile.tmpl: Remove, replacing with....
* lib/Makefile.am: New file.
* src/Makefile.am (tar.o): Remove dependency: Automake does this
for us.
* src/tar.c: Include <configmake.h> and <rmt-command.h>, not
<localedir.h>.
2006-11-30 00:14:10 +00:00
Paul Eggert
bf7f4fdc1e Add at-func.c, configmake.h, fchmodat.c,
fcntl.h, fcntl_.h, inttypes_.h, lstat.c, lstat.h.
2006-09-08 23:27:45 +00:00
Paul Eggert
94de7c4c77 * bootstrap: Redo po file retrieval to match Bison's method,
since the translation project changed its index format.
Don't use --assume-autoconf; it's now replaced
by looking in configure.ac.
(m4/codeset.m4, m4/intdiv.m4, m4/inttypes-pri.m4, m4/isc-posix.m4):
(m4/lcmessage.m4, m4/onceonly_2_57.m4, m4/gettext.m4, m4/glibc21.m4):
(m4/inttypes_h.m4, m4/lib-ld.m4, m4/lib-prefix.m4, m4/po.m4):
(m4/stdint_h.m4, m4/uintmax_t.m4, m4/ulonglong.m4):
Don't rename to ..._gl.m4, as this is no longer needed.
(m4/geteext.m4): Patch to remove the need for intl/*.
Use autopoint manually, then remove the intl files,
then undo changes to gnulib files that autoreconf made,
and then run aclocal/autoconf/autoheader/automake.
This makes our bootstrap procedure closer to Bison's.
(po/Makevars): Generate automatically.
* configure.ac (AC_PREREQ): Update from 2.59 to 2.60.
(gl_AC_TYPE_INTMAX_T, jm_AC_TYPE_UINTMAX_T): Remove.
* gnulib.modules: Add inttypes, stdint.
* lib/.cvsignore: Add close-stream.c, close-stream.h,
stdint.h, stdint_.h.
* po/Makefile: Remove; now automatically generated.
2006-08-07 22:57:25 +00:00
Paul Eggert
8ad985ea6c Adjust to recent gnulib changes.
* lib/.cvsignore: Remove atexit.c, exit.c, getndelim2.c, getndelim2.h,
pathmax.h, paxconvert.c, paxerror.h, xstrdup.c.
Add inttypes.h, mktime.c, wcwidth.h, xstrndup.c, xstrndup.h.
* src/create.c (start_header): Adjust to API change to mode_adjust.
2006-07-17 05:47:26 +00:00
Sergey Poznyakoff
a3dd97d9be Update 2006-06-09 13:55:36 +00:00
Sergey Poznyakoff
19498c9172 Initialize AM_CPPFLAGS 2006-05-25 19:29:03 +00:00
Sergey Poznyakoff
90088ff00d Update 2006-05-13 12:02:58 +00:00
Paul Eggert
db0f0804f5 Remove unistd_.h from lib/.cvsignore. 2006-03-08 02:00:47 +00:00
Paul Eggert
6c1020d386 * lib/.cvsignore: Add unistd_.h. Sort. 2006-03-08 00:23:34 +00:00
Paul Eggert
f2bf9f2ffa Avoid installation glitches on Solaris 8 with Sun C 5.4.
* lib/.cvsignore: Add system-ioctl.h.
* lib/Makefile.tmpl (noinst_HEADERS): Add system-ioctl.h.
* src/buffer.c: Include system-ioctl.h.
* src/compare.c: Likewise.
* src/delete.c: Likewise.
* src/system.c: Include <getline.h>, <setenv.h>.
* src/tar.c: Include <getline.h>.
2006-02-20 08:15:31 +00:00
Paul Eggert
84378fa99a * gnulib.modules: Add closeout, exitfial.
* lib/.cvsignore: Add __fpending.c, __fpending.h, closeout.c,
closeout.h.
* src/buffer.c: Incluse closeout.h.
(_open_archive): Use freopen rather than fopen, so
that stdlis is always either stdout or stderr.  Use
close_stdout_set_file_name to report its name.
* src/tar.c: Include closeout.h and exitfail.h.
(parse_opt, usage): Call close_stdout as appropriate, to check for
write errors.
(decode_options): Exit with status TAREXIT_FAILURE, not 1.
(main): Set exit_failure, to exit with proper status on memory
allocation failure and the like.
Use close_stdout rather than rolling our own test.
2006-02-07 23:51:37 +00:00
Paul Eggert
78b078b455 * NEWS: --version now outputs copyright etc., to conform to the
GNU coding standards.  Remove --license.
* gnulib.modules: Add version-etc-fsf.
* doc/tar.texi: Document the change.
* lib/.cvsignore: Add version-etc-fsf.c, version-etc.c, version-etc.h.
* scripts/Makefile.am (SED_CMD): Update PAKCAGE_NAME, not PACKAGE.
* scripts/backup.in: Remove --license.  Change --version to conform
to GCS.
* scripts/restore.in: Likewise.
* scripts/backup.sh.in (license): Output briefer license in the
style of coreutils, for consistency with other changes.
* src/tar.c: Include <version-etc.h>.
(LICENSE_OPTION): Remove.
(options): Remove --license.
(license): Remove.
(parse_opt): Use version_etc instead of rolling it ourselves.
Remove --license.
* tests/version.at (tar --version): Check only the first line of
output.
2006-02-07 22:18:36 +00:00
Paul Eggert
0f4660c786 Add argp-pin.c, mkdirat.c, openat-priv.h. 2006-01-09 22:52:34 +00:00
Paul Eggert
3fbdf738de * lib/.cvsignore: Add malloc.h, regcomp.c, regex.c, regex.h,
regex_internal.c, regex_internal.h, regexc.c; used by rpmatch.
2005-11-29 19:39:06 +00:00