BusyBox tar should assume stdout if no -f FILE argument

Jim Gleason jimg at lineo.com
Wed Nov 8 00:13:21 UTC 2000


Package: busybox
Version: v0.48pre
Severity: normal

When busybox tar is used as follows, it creates a file called "-"
instead of writing to stdout.
        tar -c *

This may seem an odd usage, but it is only a portion of a more common
usage shown below:
	tar -c * | (cd /some/place/else; tar -xv)


The patch for this bug is shown below (basically we move two lines from
inside the 'c' case to a location always processed regardless of the
options).


diff -u -b -B -p -r1.69 tar.c
--- tar.c  2000/10/09 17:54:38 1.69
+++ tar.c  2000/11/08 00:02:36
@@ -198,8 +198,6 @@ extern int tar_main(int argc, char **arg
                 tarName = *(++argv);
                 if (tarName == NULL)
                     fatalError( "Option requires an argument: No file
specified\n");
-                if (!strcmp(tarName, "-") && createFlag == TRUE)
-                    tostdoutFlag = TRUE;
                 stopIt=TRUE;
                 break;
 #if defined BB_FEATURE_TAR_EXCLUDE
@@ -228,6 +226,8 @@ extern int tar_main(int argc, char **arg
        }
       }
 
+      if (!strcmp(tarName, "-") && createFlag == TRUE)
+       tostdoutFlag = TRUE;
       /* 
        * Do the correct type of action supplying the rest of the
        * command line arguments as the list of files to process.

---------------------------------------
Received: (at 1074-close) by bugs.lineo.com; 8 Nov 2000 02:04:50 +0000


More information about the busybox mailing list