bin/141175: New cpio in FreeBSD 8 regresed and left out a previous
option: -V (dots)
Philip Kizer
pckizer at nostrum.com
Fri Dec 4 21:50:01 UTC 2009
>Number: 141175
>Category: bin
>Synopsis: New cpio in FreeBSD 8 regresed and left out a previous option: -V (dots)
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: change-request
>Submitter-Id: current-users
>Arrival-Date: Fri Dec 04 21:50:00 UTC 2009
>Closed-Date:
>Last-Modified:
>Originator: Philip Kizer
>Release: FreeBSD 8.0-RELEASE i386
>Organization:
>Environment:
System: FreeBSD discord.test 8.0-RELEASE FreeBSD 8.0-RELEASE #0: Sat Nov 21 15:48:17 UTC 2009 root at almeida.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC i386
>Description:
In the new 8.0 release its replacement cpio is missing an option
that existed in the previous version (and also exists in the various other
OSes I use like Solaris and Linux). The option is "-V" or "--dots" to provide
some level of verbosity while not being as voluminous as the "-v" mechanism.
>How-To-Repeat:
% cpio -oV
Brief Usage:
List: cpio -it < archive
Extract: cpio -i < archive
Create: cpio -o < filenames > archive
Help: cpio --help
>Fix:
The correct behavior should look like:
% find /var/tmp | cpio -oV > /tmp/try.cpio
....
6 blocks
The following patch adapted from the 7.x version re-adds the option to
the 8.x version:
diff -ru cpio-8.0_RELEASE/bsdcpio.1 cpio/bsdcpio.1
--- cpio-8.0_RELEASE/bsdcpio.1 2009-10-24 20:10:29.000000000 -0500
+++ cpio/bsdcpio.1 2009-12-04 14:52:45.000000000 -0600
@@ -223,6 +223,8 @@
(i and p modes)
Unconditionally overwrite existing files.
Ordinarily, an older file will not overwrite a newer file on disk.
+.It Fl V
+Print a single dot (".") for each file to stderr as it is processed.
.It Fl v
Print the name of each file to stderr as it is processed.
With
diff -ru cpio-8.0_RELEASE/cmdline.c cpio/cmdline.c
--- cpio-8.0_RELEASE/cmdline.c 2009-10-24 20:10:29.000000000 -0500
+++ cpio/cmdline.c 2009-12-04 12:07:07.000000000 -0600
@@ -50,7 +50,7 @@
/*
* Short options for cpio. Please keep this sorted.
*/
-static const char *short_options = "0AaBC:F:O:cdE:f:H:hijLlmnopR:rtuvW:yZz";
+static const char *short_options = "0AaBC:F:O:cdE:f:H:hijLlmnopR:rtuvVW:yZz";
/*
* Long options for cpio. Please keep this sorted.
@@ -61,6 +61,7 @@
int equivalent; /* Equivalent short option. */
} cpio_longopts[] = {
{ "create", 0, 'o' },
+ { "dot", 0, 'V' },
{ "extract", 0, 'i' },
{ "file", 1, 'F' },
{ "format", 1, 'H' },
diff -ru cpio-8.0_RELEASE/cpio.c cpio/cpio.c
--- cpio-8.0_RELEASE/cpio.c 2009-10-24 20:10:29.000000000 -0500
+++ cpio/cpio.c 2009-12-04 13:28:58.000000000 -0600
@@ -152,6 +152,7 @@
cpio->argc = argc;
cpio->line_separator = '\n';
cpio->mode = '\0';
+ cpio->dot = 0;
cpio->verbose = 0;
cpio->compress = '\0';
cpio->extract_flags = ARCHIVE_EXTRACT_NO_AUTODIR;
@@ -275,6 +276,9 @@
cpio->extract_flags
&= ~ARCHIVE_EXTRACT_NO_OVERWRITE_NEWER;
break;
+ case 'V':
+ cpio->dot++;
+ break;
case 'v': /* POSIX 1997 */
cpio->verbose++;
break;
@@ -524,6 +528,9 @@
if (r != ARCHIVE_OK)
cpio_errc(1, 0, archive_error_string(cpio->archive));
+ if (cpio->dot)
+ fputc('\n',stderr);
+
if (!cpio->quiet) {
blocks = (archive_position_uncompressed(cpio->archive) + 511)
/ 512;
@@ -660,6 +667,10 @@
if (cpio->verbose)
fprintf(stderr,"%s", destpath);
+ /* Print out a dot per file processed. */
+ if (cpio->dot)
+ fputc('.', stderr);
+
/*
* Option_link only makes sense in pass mode and for
* regular files. Also note: if a link operation fails
@@ -858,6 +869,8 @@
continue;
if (cpio->verbose)
fprintf(stdout, "%s\n", destpath);
+ if (cpio->dot)
+ fputc('.',stderr);
if (cpio->uid_override >= 0)
archive_entry_set_uid(entry, cpio->uid_override);
if (cpio->gid_override >= 0)
@@ -877,6 +890,8 @@
r = archive_write_close(ext);
if (r != ARCHIVE_OK)
cpio_errc(1, 0, archive_error_string(ext));
+ if (cpio->dot)
+ fputc('\n',stderr);
if (!cpio->quiet) {
blocks = (archive_position_uncompressed(a) + 511)
/ 512;
@@ -1081,6 +1096,9 @@
if (r != ARCHIVE_OK)
cpio_errc(1, 0, archive_error_string(cpio->archive));
+ if (cpio->dot)
+ fputc('\n',stderr);
+
if (!cpio->quiet) {
blocks = (archive_position_uncompressed(cpio->archive) + 511)
/ 512;
diff -ru cpio-8.0_RELEASE/cpio.h cpio/cpio.h
--- cpio-8.0_RELEASE/cpio.h 2009-10-24 20:10:29.000000000 -0500
+++ cpio/cpio.h 2009-12-01 13:46:10.000000000 -0600
@@ -51,6 +51,7 @@
char compress; /* -j, -y, or -z */
const char *format; /* -H format */
int bytes_per_block; /* -b block_size */
+ int dot; /* -V */
int verbose; /* -v */
int quiet; /* --quiet */
int extract_flags; /* Flags for extract operation */
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-bugs
mailing list