bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

tar implicitly tars "."


From: Miek Gieben
Subject: tar implicitly tars "."
Date: Thu, 30 Jan 2003 12:00:52 +0100
User-agent: Vim/Mutt/Linux

Hi,

I think the following behavoir of gnu tar is a bug:
I'm using tar's src/ dir as an example:

1. create list of files to tar:
$ ls *.c > files_to_do

2. tar them
$ ./tar --create --verbose --file /tmp/test.tgz --listed-incremental files_incr 
\
--files-from files_to_do
buffer.c
compare.c
create.c
delete.c
extract.c
incremen.c
list.c
mangle.c
misc.c
names.c
rmt.c
rtapelib.c
tar.c
update.c

2. contents of files_incr
$ cat files_incr
1043855760

3. make the files_to_do empty
$ > files_to_do

4. run tar from (2) again
$ ./tar --create --verbose --file /tmp/test.tgz --listed-incremental files_incr 
\
--files-from files_to_do
./tar: ./.deps: Directory is new
./
./.deps/
./files_incr
./files_to_do
./.deps/buffer.Po
./.deps/compare.Po
./.deps/create.Po
./.deps/delete.Po
./.deps/extract.Po
./.deps/incremen.Po
./.deps/list.Po
./.deps/mangle.Po
./.deps/misc.Po
./.deps/names.Po
./.deps/rmt.Po
./.deps/rtapelib.Po
./.deps/tar.Po
./.deps/update.Po

--------

So it looks like "." is implicit when there are no files to tar. 
I think that is not right.

The following patch makes tar complain in stead of just tarring ".":

--- tar-1.13.25-orig/src/names.c        2001-08-29 23:33:54.000000000 +0200
+++ tar-1.13.25/src/names.c     2003-01-29 17:15:12.000000000 +0100
@@ -781,9 +781,9 @@
   if (listed_incremental_option)
     read_directory_file ();

-  if (!namelist)
-    addname (".", 0);
-
+  if (!namelist)
+         FATAL_ERROR ((0, 0, _("Cowardly refusing to create an empty 
archive")));
+
   for (name = namelist; name; name = next_name)
     {
       next_name = name->next;

For some weird reason (i'm not that good in C) I could not get tar to link when
I used USAGE_ERROR in stead of FATAL_ERROR.

regards,
Miek Gieben

PS please CC me, as a'm not on this list
--
:wq!




reply via email to

[Prev in Thread] Current Thread [Next in Thread]