Re: pax/tar/cpio: use stdout if TAPE is set to -
On Sun, Mar 1, 2015 at 12:41 AM, Dmitrij D. Czarkoff wrote: > The diff below makes tar treat "-" in TAPE environment variable as > stdout, making it consistant with "-f" argument. Could be a sane > default for those who have no tape device. Frankly, I think someone using TAPE=- would be *in*sane. If a program/script depends on tar writing to $TAPE (because it invokes tar without 'f' option), then it probably also writes to stdout, which will break the tar file in the suggested usage. I would *almost* rather make using tar without the -f option an error... Also, the diff has a bug: "TAPE=- tar cv" won't behave correctly. Philip Guenther
pax/tar/cpio: use stdout if TAPE is set to -
Hi! The diff below makes tar treat "-" in TAPE environment variable as stdout, making it consistant with "-f" argument. Could be a sane default for those who have no tape device. -- Dmitrij D. Czarkoff Index: bin/pax/options.c === RCS file: /var/cvs/src/bin/pax/options.c,v retrieving revision 1.86 diff -u -p -r1.86 options.c --- bin/pax/options.c 24 May 2014 18:51:00 - 1.86 +++ bin/pax/options.c 1 Mar 2015 08:27:13 - @@ -1006,6 +1006,8 @@ tar_options(int argc, char **argv) arcname = getenv("TAPE"); if ((arcname == NULL) || (*arcname == '\0')) arcname = _PATH_DEFTAPE; + else if ((arcname[0] == '-') && (arcname[1]== '\0')) + arcname = NULL; } }