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

Bug#4784: Stale links on iConnect Debian CD-ROM



Hi,

After the long list of nags I sent, here is a contribution that is meant
to be useful. :-)

The problem is with dangling symlinks. 'find . -follow' exits with exit
code `1' when it finds one. For the proper functioning of dpkg this error
is not critical, IMHO, but dpkg simply aborts on 'any error', AFAIK.

I did a 'ps' when a 'dpkg -iGROEB' was running and saw that these
arguments were passed to find:

..../binary-i386/ -follow -name *.deb -type f -print0

Now, this seems ok, but it can't handle dangling symlinks. I suggest that
something like the following is used to take care of it. I know dpkg is
written in C, but I don't know much about C, so this is bash syntax.

findfiles () {
   TEMPFILE=`tempfile`
   find "$1" -follow -name *.deb -type f -print0 2> $TEMPFILE
   if grep -v "No such file or directory" $TEMPFILE >&2
   then
      RETURN=1
   else
      RETURN=0
   fi
   rm -f $TEMPFILE
   return $RETURN
}

This findfiles function can be used in any pipe with the directory name as
the single argument. Any error produced by the `find' command that is not
about a dangling symlink is sent to stderr, the filenames are sent to
stdout.

Remco


--
TO UNSUBSCRIBE FROM THIS MAILING LIST: e-mail the word "unsubscribe" to
debian-devel-request@lists.debian.org . 
Trouble?  e-mail to templin@bucknell.edu .


Reply to: