[news.software.b] Cnews mkhistory problem

rac@sherpa.uucp (Roger Cornelius) (06/23/91)

Recently I converted from Bnews to Cnews and had a problem with the
history file which had me pulling my hair for few a days.  After
building and installing the software, I rm'd the Bnews history file
and ran mkhistory to rebuild it.  There is a bit of code in mkhistory
which builds a list of the directories to search for news articles:

cd $NEWSARTS
them=
for f in `ls | egrep -v '\.'`
do
	if test -d $f
	then
		them="$them $f"
	fi
done

On this system, $NEWSARTS is a mounted filesystem and one of it's
directories is lost+found.  lost+found has rwx------ perms and is
owned by bin.  When the find command which follows the above code
attempts to search lost+found, it quits with an error message and
consequently fails to search the rest of the news directories in the
list for articles.  So history wasn't built correctly, and expire
wasn't expiring the articles mkhistory missed.  I didn't notice
that articles weren't being expired until several days later.

I never bothered to check the window I ran mkhistory in to see if it
failed or succeeded or I would have noticed the error from find.
Once I discovered the cause, my solution was to change the "test" in
the above code to make sure a directory is readable before adding it
to the list to be searched:

cd $NEWSARTS
them=
for f in `ls | egrep -v '\.'`
do
	if test -d $f -a -r $f
	then
		them="$them $f"
	fi
done

Maybe this should be changed in the Cnews distribution?
-- 
Roger Cornelius          rac@sherpa.UUCP         uunet!sherpa!rac

henry@zoo.toronto.edu (Henry Spencer) (06/25/91)

In article <1991Jun22.233741.11143@sherpa.uucp> rac@sherpa.uucp (Roger Cornelius) writes:
>On this system, $NEWSARTS is a mounted filesystem and one of it's
>directories is lost+found.  lost+found has rwx------ perms and is
>owned by bin.  When the find command which follows the above code
>attempts to search lost+found, it quits ...
>Once I discovered the cause, my solution was to change the "test" in
>the above code to make sure a directory is readable ...

Changes along these lines are in the working copy of mkhistory here,
and will be in the next patch (soon).  Only readable directories go
in the search list, and lost+found never goes in even if it is readable.
-- 
"We're thinking about upgrading from    | Henry Spencer @ U of Toronto Zoology
SunOS 4.1.1 to SunOS 3.5."              |  henry@zoo.toronto.edu  utzoo!henry