Fwd: Re: the files listed with du -a do not match ls -R, possible bug?

Aaron Wegner <[email protected]>
Newsgroups gmane.comp.gnu.fileutils.bugs
Message-ID <[email protected]>
Subject: Re: the files listed with du -a do not match ls -R, possible bug?
Date: Mon, 26 Aug 2002 15:54:45 -0500
From: Aaron Wegner <[email protected]>
To: Jim Meyering <[email protected]>

> I'm pretty sure that's not caused by a bug in du.
>
> Don't depend on the last `field' of each line of ls -lR output
> being the file name.  That's not true for symlinks.
> If you want to find all files with the .op suffix, just use `find',
> e.g., like this:
>
>   find . -name '*.op'

Well, I did one more experiment, and I found another instance of the bug.  I
went to my /usr directory, which is just a large directory on my machine,
about 1.9 GB.  I typed the following commands.

# find . | sort > findlog
# du -a | awk '{printf("%s\n", $2)}' | sort > dulog
# sdiff -s dulog findlog > difference

The file difference is 2245 lines long, with every line except one containing
a '>' indicating that the line is in the findlog but not in the dulog.

The one exception is a '|' on one line:

./share/config/colors/40	|	./share/config/colors/40 Colors

Apparently find didn't get the whole "40 Colors" filename since it has a
 space in it, but that's off the topic.

The other 2244 lines are files that were found by 'find' but not by 'du'.

Some such files are:
> ./share/man/man3/3DBorder.3.gz
> ./share/man/man3/AddErrInfo.3.gz
> ./share/man/man3/AddOption.3.gz
> ./share/man/man3/Alloc.3.gz
> ./share/man/man3/AllowExc.3.gz

So, I went into the directory /usr/share/man/man3, and I entered the
following:

# du -a | grep AddErrInfo
# ls | grep AddErrInfo
AddErrInfo.3.gz
#

It appears that du -a is not finding files that 'find' and 'ls' find.  Also,
sometimes du -a will only list files if I am in the directory.  Such is the
case with

/usr/share/zoneinfo/US

which has 12 files.

If I go up one directory to

/usr/share/zoneinfo

du -a doesn't find any of the 12 files.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.