[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Bug diff: no difference between 0 byte files and no files.
From: |
J.C. Pizarro |
Subject: |
Re: Bug diff: no difference between 0 byte files and no files. |
Date: |
Tue, 31 Jul 2007 15:11:46 +0200 |
2007/7/31, Andreas Schwab <address@hidden> wrote:
> "J.C. Pizarro" <address@hidden> writes:
>
> > Hi, diff v2.8.1 and v2.8.7 ignore 0 byte files, and it's a bug.
> >
> > The program diff doesn't see the difference between 0 byte file and no file.
> >
> > mkdir dir1 dir2 2> /dev/null ; cat /dev/null > dir1/empty.out ; \
> > tree dir1 dir2 ; echo "Differences between dir1 and dir2 from diff:" ; \
> > diff -Nduar dir1 dir2 ; rm -f dir1/empty.out ; rmdir dir1 dir2
>
> Not a bug:
>
> -N --new-file Treat absent files as empty.
>
> Andreas.
>
> --
> Andreas Schwab, SuSE Labs, address@hidden
> SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
> PGP key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
> "And now for something completely different."
>
Yes a bug (without -N option):
mkdir dir1 dir2 2> /dev/null ; cat /dev/null > dir1/empty.out ; \
tree dir1 dir2 ; echo "Differences between dir1 and dir2 from diff:" ; \
diff -duar dir1 dir2 | tee dir1_to_dir2.patch ; rm -f dir1/empty.out ; \
rmdir dir1 dir2
ls -l dir1_to_dir2.patch ; cat dir1_to_dir2.patch ; \
mkdir dir1 2> /dev/null ; cat /dev/null > dir1/empty.out ; \
patch -p0 < dir1_to_dir2.patch ; mv dir1 dir2 ; tree dir2 ; \
rm -f dir2/empty.out 2> /dev/null ; rmdir dir2 ; rm -f dir1_to_dir2.patch
In the console:
address@hidden:~$
dir1
`-- empty.out
dir2
0 directories, 1 file
Differences between dir1 and dir2 from diff:
Only in dir1: empty.out
address@hidden:~$
address@hidden:~$
-rw-r--r-- 1 jc jc 24 2007-07-31 14:55 dir1_to_dir2.patch
Only in dir1: empty.out
patch: **** Only garbage was found in the patch input.
dir2
`-- empty.out
0 directories, 1 file
address@hidden:~$
The problem will be the same.
The bug of the no-elimination of 0 byte file dir2/empty.out still exists.
Without -N appears "patch: **** Only garbage was found in the patch input."
With -N option doesn't appear this strange previous message.
J.C. sincerely yours :)