Report positional options that were used but had no effect during archive creation

* src/names.c (file_selection_option)
(file_selection_option_name): New functions.
(unconsumed_option_push, unconsumed_option_free)
(unconsumed_option_report): New functions.
(name_list_advance): Maintain a list
of eventually unconsumed options during archive creation.
Report unconsumed options, if any.

* tests/positional01.at: New test case.
* tests/positional02.at: New test case.
* tests/positional03.at: New test case.
* tests/Makefile.am: Add new test cases.
* tests/testsuite.at: Likewise.

* NEWS: Document the changes.
* configure.ac: Version 1.29.90
* doc/tar.texi: Document the changes.
This commit is contained in:
Sergey Poznyakoff
2016-05-27 10:39:49 +03:00
parent 20b55f0679
commit 9a33077a7b
9 changed files with 308 additions and 7 deletions

24
NEWS
View File

@@ -1,6 +1,28 @@
GNU tar NEWS - User visible changes. 2016-05-16
GNU tar NEWS - User visible changes. 2016-05-27
Please send GNU tar bug reports to <bug-tar@gnu.org>
version 1.29.90 (Git)
* Report erroneous use of positional options.
During archive creation or update, tar keeps track of positional
options (see the manual, subsection 3.4.4 "Position-Sensitive
Options"), and reports those that had no effect. For example, when
invoked as
tar -cf a.tar . --exclude '*.o'
tar will create the archive, but will exit with status 2, having
issued the following error message
tar: The following options were used after any non-optional
arguments in archive create or update mode. These options are
positional and affect only arguments that follow them. Please,
rearrange them properly.
tar: --exclude '*.o' has no effect
tar: Exiting with failure status due to previous errors
version 1.29 - Sergey Poznyakoff, 2016-05-16