Bug#301671: apt-listbugs: cron.daily destroys the contents of symlinked /etc/apt/preferences

2005-04-11 Thread paddy
Thanks for the quick reply, Steve.
I didn't mean to imply that it wasn't a good reason.
I take it that all such removals are documented by the RC bugs.

The contents of the preferences file seem to get destroyed by the
line:

  /usr/share/apt-listbugs/aptcleanup  /etc/apt/preferences.apt-listbugs.$$

when it is writing to the same file it is reading from.

Perhaps something more like:
(stealing shamelessly from /etc/cron.monthly/acct)

  #!/bin/sh -e
  
  prefclean() {
  
test -x /usr/share/apt-listbugs/aptcleanup || return 0
test -x /usr/sbin/apt-listbugs || return 0
test -f /etc/apt/preferences || return 0
  
PTMP=$(tempfile)
/usr/share/apt-listbugs/aptcleanup  $PTMP
if ! diff $PTMP /etc/apt/preferences  /dev/null; then
  savelog /etc/apt/preferences
  mv $PTMP /etc/apt/preferences
fi
/bin/rm -f $PTMP
  
  }
  
  prefclean
  
savelog doesn't seem to handle the symlink either.

better options might be something along the lines of

  cp -aH /etc/apt/preferences /etc/apt/preferences.0

or resolving the symlink and rotating in the parent directory of the file.

(the difference between making the backup at the client or the server
in Zed's configuration where preferences is mounted shared from a server)

or perhaps savelog should.

Regards,
Paddy
-- 
Perl 6 will give you the big knob. -- Larry Wall


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



Bug#301671: apt-listbugs: cron.daily destroys the contents of symlinked /etc/apt/preferences

2005-04-11 Thread paddy
On Mon, Apr 11, 2005 at 01:33:16PM +0100, paddy wrote:
 PTMP=$(tempfile)
 /usr/share/apt-listbugs/aptcleanup  $PTMP
 if ! diff $PTMP /etc/apt/preferences  /dev/null; then
   savelog /etc/apt/preferences
   mv $PTMP /etc/apt/preferences
 fi

D'oh!

s/mv/cp/

Regards,
Paddy
-- 
Perl 6 will give you the big knob. -- Larry Wall


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]