Debian Bug report logs -
#10879
[CONFFILE] /etc/init.d/sysklogd vanished
Reported by: rjk@greenend.org.uk
Date: Fri, 27 Jun 1997 20:48:02 UTC
Severity: important
Tags: patch
Merged with 33046,
47267,
90623,
98210,
109691,
146167,
155456,
204275
Found in versions 1.4.0.8, 1.4.1.1, 1.9.16, 1.9.21
Fixed in version dpkg/1.10.21
Done: Scott James Remnant <scott@netsplit.com>
Bug is archived. No further changes may be made.
Toggle useless messages
Report forwarded to debian-bugs-dist@lists.debian.org, Klee Dienes and Ian Jackson <dpkg-maint@chiark.greenend.org.uk>
:
Bug#10879
; Package dpkg
.
(full text, mbox, link).
Acknowledgement sent to Richard Kettlewell <richard@greenend.org.uk>
:
New bug report received and forwarded. Copy sent to Klee Dienes and Ian Jackson <dpkg-maint@chiark.greenend.org.uk>
.
(full text, mbox, link).
Message #5 received at submit@bugs.debian.org (full text, mbox, reply):
Package: dpkg
Version: 1.4.0.8
(It's possible that this isn't a bug in dpkg. Please re-assign it if
isn't. But as far as I can tell, the package being on hold means that
its own scripts shouldn't get a lookin.)
I have the sysklogd package on hold for various reasons. Last night I
ran dselect against a tape of Debian that Austin brought back from the
CL.
I now find that /etc/init.d/sysklogd no longer exists!
The package is still listed as on hold. The version installed is
1.3-14; the version in the archive is 1.3-15.
: sfere; dpkg -s sysklogd
Package: sysklogd
Status: hold ok installed
Priority: required
Section: base
Installed-Size: 91
Maintainer: Martin Schulze <joey@linux.de>
Version: 1.3-14
Replaces: syslogd
Provides: syslogd
Depends: libc5 (>= 5.4.17-1)
Conflicts: syslogd
Conffiles:
/etc/syslog.conf 1158ff9e7d55009929f1b4f1673d0348
/etc/init.d/sysklogd 23285bae1fb5d991133e580c50e76773
/etc/cron.weekly/sysklogd 4b8230ad5898fbc52f1036f701a5e340
Description: Description: Kernel and system logging daemons
This package implements two system log daemons. The syslogd daemon is
an enhanced version of the standard Berkeley utility program. This
daemon is responsible for providing logging of messages received from
programs and facilities on the local host as well as from remote
hosts.
.
The klogd daemon listens to kernel message sources and is responsible
for prioritizing and processing operating system messages. The klogd
daemon can run as a client of syslogd or optionally as a standalone
program. Klogd can now be used to decode EIP addresses if it can
determine a System.map file.
: sfere; dpkg --listfiles sysklogd
/.
/usr
/usr/doc
/usr/doc/sysklogd
/usr/doc/sysklogd/readme.gz
/usr/doc/sysklogd/copyright
/usr/doc/sysklogd/changelog.Debian.gz
/usr/man
/usr/man/man5
/usr/man/man5/syslog.conf.5.gz
/usr/man/man8
/usr/man/man8/syslogd.8.gz
/usr/man/man8/klogd.8.gz
/usr/man/man8/sysklogd.8.gz
/sbin
/sbin/syslogd
/sbin/klogd
/etc
/etc/init.d
/etc/init.d/sysklogd
/etc/cron.weekly
/etc/cron.weekly/sysklogd
/etc/syslog.conf
/var
/var/log
: sfere; ls -l /etc/init.d/sys*
zsh: no matches found: /etc/init.d/sys*
: sfere;
--
Richard Kettlewell http://www.elmail.co.uk/~richard/
Information forwarded to debian-bugs-dist@lists.debian.org, Klee Dienes and Ian Jackson <dpkg-maint@chiark.greenend.org.uk>
:
Bug#10879
; Package dpkg
.
(full text, mbox, link).
Acknowledgement sent to Juan Cespedes <cespedes@debian.org>
:
Extra info received and forwarded to list. Copy sent to Klee Dienes and Ian Jackson <dpkg-maint@chiark.greenend.org.uk>
.
(full text, mbox, link).
Message #10 received at 10879@bugs.debian.org (full text, mbox, reply):
From: Richard Kettlewell <richard@greenend.org.uk>
> I have the sysklogd package on hold for various reasons. Last night I
> ran dselect against a tape of Debian that Austin brought back from the
> CL.
>
> I now find that /etc/init.d/sysklogd no longer exists!
>
> The package is still listed as on hold. The version installed is
> 1.3-14; the version in the archive is 1.3-15.
I don't know how could that happen. Are you sure it was
removed during the dselect?
`dpkg' or `dselect' shouldn't have removed it; it may have
been one of the {pre,post}{inst,rm} files of one of the packages you
updated.
Of course, it's not reproducible. Is it?
Thanks.
--
Juan Cespedes
Bug closed, send any further explanations to Richard Kettlewell <richard@greenend.org.uk>
Request was from Richard Kettlewell <rjk@greenend.org.uk>
to control@bugs.debian.org
.
(full text, mbox, link).
Bug reopened, originator set to rjk@greenend.org.uk.
Request was from Richard Kettlewell <rjk@greenend.org.uk>
to control@bugs.debian.org
.
(full text, mbox, link).
Information forwarded to dpkg@packages.qa.debian.org
:
Bug#10879
; Package dpkg
.
(full text, mbox, link).
Acknowledgement sent to Thomas Hood <jdthood@yahoo.co.uk>
:
Extra info received and filed, but not forwarded. Copy sent to dpkg@packages.qa.debian.org
.
(full text, mbox, link).
Message #19 received at 10879-quiet@bugs.debian.org (full text, mbox, reply):
Housekeeping ...
Report 10879 reports a queer phenomenon that was
attributed to dpkg. Do you think that the report
can now be closed, or have you been able to
reproduce it, or ...?
--
Thomas
Tags added: moreinfo
Request was from Thomas Hood <jdthood@yahoo.co.uk>
to control@bugs.debian.org
.
(full text, mbox, link).
Severity set to `important'.
Request was from Thomas Hood <jdthood@yahoo.co.uk>
to control@bugs.debian.org
.
(full text, mbox, link).
Tags removed: moreinfo
Request was from Thomas Hood <jdthood@yahoo.co.uk>
to control@bugs.debian.org
.
(full text, mbox, link).
Acknowledgement sent to Thomas Hood <jdthood@yahoo.co.uk>
:
Extra info received and filed, but not forwarded.
(full text, mbox, link).
Message #32 received at 10879-quiet@bugs.debian.org (full text, mbox, reply):
I have been able to reproduce the improper deletion of conffiles.
Please see #47267 for details.
Please follow up at #47267.
Changed Bug title.
Request was from Adam Heath <doogie@brainfood.com>
to control@bugs.debian.org
.
(full text, mbox, link).
Tags added: patch, pending
Request was from Scott James Remnant <scott@netsplit.com>
to control@bugs.debian.org
.
(full text, mbox, link).
Acknowledgement sent to Scott James Remnant <scott@netsplit.com>
:
Extra info received and filed, but not forwarded.
(full text, mbox, link).
Message #45 received at 10879-quiet@bugs.debian.org (full text, mbox, reply):
[Message part 1 (text/plain, inline)]
tags 10879 patch pending
thanks
There's quite a few people on this list, so I'll start out by saying
that if you don't care about this bug anymore, or are just glad I think
I've fixed it, then you don't really need to read this mail. There's a
patch at the bottom, the rest is going to be pretty technical :-)
First a summary of this bug, picking on bind as it's a handy package
that can be used to reliably produce the symptoms.
1. Install bind
2. Install bind9, this will remove bind.
3. Purge bind
You'll now find that a random selection of bind9's configuration files
have been removed.
The clue to solving this bug occurred when we realised that the
selection wasn't random at all, and in fact was the same on every
machine.
Here's the important bit of debug output concerning the purging of bind:
D000200: removal_bulk set to new conffile `/etc/init.d/bind'
D000020: removal_bulk conffile not ours any more `/etc/bind/named.conf'
D000020: removal_bulk conffile not ours any more `/etc/bind/named.conf.local'
D000020: removal_bulk conffile not ours any more `/etc/bind/named.conf.options'
D000020: removal_bulk conffile not ours any more `/etc/bind/db.0'
D000020: removal_bulk conffile not ours any more `/etc/bind/db.127'
D000020: removal_bulk conffile not ours any more `/etc/bind/db.255'
D000020: removal_bulk conffile not ours any more `/etc/bind/db.local'
D000020: removal_bulk conffile not ours any more `/etc/bind/db.root'
dpkg is correctly realising that the only conffile it needs to remove is
‘/etc/init.d/bind’ and that the rest should be kept because bind9 has
taken them over.
However it's removing some of them, and fortunately the ones it removes
is constant. It removes ‘named.conf.local’, ‘db.0’, ‘db.255’ and
‘db.root’.
If we number the configuration files that it shouldn't remove, starting
at 1, it's removing #2, #4, #6 and #8.
That's a pretty damned specific pattern! It also explains why the
single-conffile test package pairs don't exhibit the bug, if they had
two conffiles the second would get wrongly deleted.
A more extreme example (a test package I created):
#1 should be kept
#2 needs deleting
#3 should be kept
#4 should be kept
#5 needs deleting
#4 gets incorrectly deleted by dpkg.
To put the problem into words; every second conffile in a consecutive
subset that need to be kept get incorrectly deleted.
Old C hands should already be thinking ‘linked list bug’ at this point.
We now cast our attention on the removal_bulk_remove_configfiles()
function in main/remove.c. What it does can be summed up as follows:
1. Iterate the conffiles list, removing nodes if the conffile isn't
ours anymore or is part of a diversion.
2. Iterate the conffiles list again (which will have the nodes removed)
and do the actual work.
Reading the debug output, during the second iteration there are nodes
that were supposed to have been removed that weren't. We're really
thinking ‘linked list bug’ at this point, almost certainly a classic
‘bad node removal’ problem.
So we focus our attention on the first loop, and walk through it. I'm
going to assume you've got the code in front of you at this point, feel
free to grab it if you're interested.
Our players in this are:
pkg->installed.conffiles
A pointer to the first node in a linked list of conffile
structures. Each structure has a ‘next’ pointer which either
points to the next one in the list, or NULL.
lconffp
At the start of the loop, this points to the linked list pointer
itself (pkg->installed.conffiles), otherwise it points to the
‘next’ member of the previous node.
conff
A pointer to a node. This is set at the start of each iteration
to the contents of whatever lconffp points to, so the first node
for the first iteration, and each subsequent node.
Let's go back to using bind/bind9 as our example pair, because that's
quite an elegant example.
The first conffile needs to be deleted, so nothing interesting happens
until the loop's step statement:
lconffp= &conff->next;
This alters lconffp to point to the current node's ‘next’ pointer, and
when the list begins, conff will point at the next node.
The second conffile needs to be kept, so the node needs to be removed
from the linked list. Here's the code that does that:
*lconffp= conff->next;
This alters either the linked list pointer, or the previous node's
‘next’ pointer (which is pointed to by lconffp) to point to the next
node, not the current one. In other words, it removes the current node
from the linked list.
Now we get to the step instruction:
lconffp= &conff->next;
This alters lconffp to point to the current node's ‘next‘ pointer.
Hopefully your brain just threw an exception there. That's right,
lconffp is now pointing to *the wrong thing*; if the next node needs to
be removed as well, the ‘next’ pointer of a node that's been removed
from the linked list will be changed.
We start off with:
[ |--->[ |--->[ |x]
^ ^
[**] [--]
([**] is lconffp, [--] is conff)
We alter the pointer to remove the node:
[ |----------->[ |x]
^ [ |--->
| ^
[**] [--]
Then we end up pointing at the wrong next node:
[ |----------->[ |x]
[ |---> ^
^ |
[**] [--]
If we need to remove the next node as well, we'll end up altering the
wrong pointer:
[ |----------->[ |x]
[ |x]
^
[**] [--]
In fact, we didn't need to move lconffp at all. If we remove a node,
the linked list pointer itself or the previous ‘next’ pointer is still
the previous node pointer.
In other words, we only need to run the step statement if we don't
remove the node. If we modify the code to do that, and run that
simulation again:
We start off with:
[ |--->[ |--->[ |x]
^ ^
[**] [--]
([**] is lconffp, [--] is conff)
We alter the pointer to remove the node:
[ |----------->[ |x]
^ [ |--->
| ^
[**] [--]
And we begin the new iteration of the loop with no step condition:
[ |----------->[ |x]
^ [ |---> ^
| |
[**] [--]
The removed node has now become irrelevant. First let's simulate
removing the next node, as that's what's failing. We alter the pointer
to remove the node:
[ |x] [ |x]
^
[**] [--]
That's done the right thing, both nodes have been removed. Now let's
assume that node needed keeping. We don't alter the pointer to remove
the node, instead we *do* run the loop's step condition:
[ |----------->[ |x]
^
[**] [--]
This correctly removes the second node, but keeps the third in the
list. If the next node was to be removed, the right pointer would be
modified.
So in summary, what was causing this bug was some incorrect code to
remove nodes from a linked list. The step condition caused a pointer to
be moved that should've been kept where it was. By only running this
step condition when we haven't removed a node, the right pointers are
modified and the list can be traversed properly the second time around.
Patch attached and committed.
I'm a little nervous about trying to push this change for sarge without
some extensive testing.
Scott
--
Have you ever, ever felt like this?
Had strange things happen? Are you going round the twist?
[dpkg-conffile-list.patch (text/x-patch, inline)]
Index: ChangeLog
===================================================================
--- ChangeLog (revision 1897)
+++ ChangeLog (working copy)
@@ -1,3 +1,13 @@
+Fri Mar 12 19:02:21 GMT 2004 Scott James Remnant <scott@netsplit.com>
+
+ * main/remove.c (removal_bulk_remove_configfiles): Don't change the
+ "previous pointer" pointer if we remove the node from the linked list,
+ ensuring that if the next node is to be removed the right thing will
+ happen.
+
+ This corrects the bug where every second shared or diverted conffile
+ would be incorrectly deleted by dpkg.
+
Fri Mar 12 15:05:52 GMT 2004 Scott James Remnant <scott@netsplit.com>
* utils/start-stop-daemon.c: Don't require an argument for -V (version).
Index: debian/changelog
===================================================================
--- debian/changelog (revision 1897)
+++ debian/changelog (working copy)
@@ -1,6 +1,10 @@
dpkg (1.10.21) unstable; urgency=low
* Don't require argument for start-stop-daemon -V. Closes: #237589.
+ * Fix incorrect linked list node removal code that caused every second
+ shared or diverted conffile to be deleted by dpkg.
+ Closes: #10879, #33046, #47267, #90623, #98210, #109691, #146167.
+ Closes: #155456, #204275.
-- Scott James Remnant <scott@netsplit.com> UNRELEASED
Index: main/remove.c
===================================================================
--- main/remove.c (revision 1891)
+++ main/remove.c (working copy)
@@ -403,9 +403,7 @@
* are involved in diversions, except if we are the package doing the
* diverting.
*/
- for (lconffp= &pkg->installed.conffiles;
- (conff= *lconffp) != 0;
- lconffp= &conff->next) {
+ for (lconffp= &pkg->installed.conffiles; (conff= *lconffp) != 0; ) {
for (searchfile= pkg->clientdata->files;
searchfile && strcmp(searchfile->namenode->name,conff->name);
searchfile= searchfile->next);
@@ -422,6 +420,7 @@
} else {
debug(dbg_conffdetail,"removal_bulk set to new conffile `%s'",conff->name);
conff->hash= NEWCONFFILEFLAG; /* yes, cast away const */
+ lconffp= &conff->next;
}
}
modstatdb_note(pkg);
[signature.asc (application/pgp-signature, inline)]
Acknowledgement sent to Adam Heath <doogie@debian.org>
:
Extra info received and filed, but not forwarded.
(full text, mbox, link).
Message #50 received at 10879-quiet@bugs.debian.org (full text, mbox, reply):
ps: You didn't have to cc all the bugs, as they were merged. Just one would
have been enough.
On Fri, 12 Mar 2004, Scott James Remnant wrote:
> I'm a little nervous about trying to push this change for sarge without
> some extensive testing.
Well, this is a very good explanation, and the patch looks fine to me. I have
no problems having this part of sarge.
Reply sent to Scott James Remnant <scott@netsplit.com>
:
You have taken responsibility.
(full text, mbox, link).
Notification sent to rjk@greenend.org.uk
:
Bug acknowledged by developer.
(full text, mbox, link).
Message #55 received at 10879-close@bugs.debian.org (full text, mbox, reply):
Source: dpkg
Source-Version: 1.10.21
We believe that the bug you reported is fixed in the latest version of
dpkg, which is due to be installed in the Debian FTP archive:
dpkg-dev_1.10.21_all.deb
to pool/main/d/dpkg/dpkg-dev_1.10.21_all.deb
dpkg-doc_1.10.21_all.deb
to pool/main/d/dpkg/dpkg-doc_1.10.21_all.deb
dpkg_1.10.21.dsc
to pool/main/d/dpkg/dpkg_1.10.21.dsc
dpkg_1.10.21.tar.gz
to pool/main/d/dpkg/dpkg_1.10.21.tar.gz
dpkg_1.10.21_i386.deb
to pool/main/d/dpkg/dpkg_1.10.21_i386.deb
dselect_1.10.21_i386.deb
to pool/main/d/dpkg/dselect_1.10.21_i386.deb
A summary of the changes between this version and the previous one is
attached.
Thank you for reporting the bug, which will now be closed. If you
have further comments please address them to 10879@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.
Debian distribution maintenance software
pp.
Scott James Remnant <scott@netsplit.com> (supplier of updated dpkg package)
(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing ftpmaster@debian.org)
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Format: 1.7
Date: Sun, 25 Apr 2004 18:55:10 +0100
Source: dpkg
Binary: dpkg-doc dpkg dselect dpkg-dev dpkg-static
Architecture: source all i386
Version: 1.10.21
Distribution: unstable
Urgency: low
Maintainer: Dpkg Development <debian-dpkg@lists.debian.org>
Changed-By: Scott James Remnant <scott@netsplit.com>
Description:
dpkg - Package maintenance system for Debian
dpkg-dev - Package building tools for Debian
dpkg-doc - Dpkg Internals Documentation
dselect - a user tool to manage Debian packages
Closes: 10879 33046 47267 90623 98210 102094 109669 109691 115352 120970 124225 146167 151799 155456 158916 160761 161156 166052 171489 174973 174978 179192 187952 200701 200763 204275 207758 214699 219210 220776 225086 233614 237589 237624 237864 239000 240081 241503 242870 243191 244098 244316
Changes:
dpkg (1.10.21) unstable; urgency=low
.
* Fix incorrect linked list node removal code that caused every second
shared or diverted conffile to be deleted by dpkg.
Closes: #10879, #33046, #47267, #90623, #98210, #109691, #146167.
Closes: #155456, #204275.
* Call mknod with the required device type. Closes: #158916.
* Correct the default query output format to be consistent with
what the underlying library expects. Closes: #174973.
* Fix missing NULL-termination in dpkg-query -W display of dependency
fields. Closes: #174978
* Strip output from md5sum(1) after the first whitespace character.
Closes: #200763.
* Output a warning if we cannot open a configuration file instead of
treating it as a fatal error, in case our home directory is not readable
by root. Closes: #200701.
* Set LC_ALL to C before spawning off dpkg --search, to avoid searching
on localized strings. Closes: #244316.
* Don't require argument for start-stop-daemon -V. Closes: #237589.
* Correct use of @ARGV within dpkg-scanpackages, allowing -u to work
once again. Closes: #225086, #241503.
* Make sure file permissions passed to dpkg-statoverride are numeric.
Closes: #161156.
* Correctly break out of the loop in install-info.
Closes: #124225, #160761.
* Add --dir-file option to install-info for GNU install-info
compatibility. Closes: #179192
* Refer to debian-policy in dpkg-doc's description instead of the
non-existant packaging-manual. Closes: #120970.
* Remove incorrect mention of build-essential from dpkg-checkbuilddeps
manpage. Closes: #219210.
* Add a note about diverting shared libraries to the dpkg-divert
manpage. Closes: #214699.
* Updated Translations:
- Brazilian Portugese (Andre Luis Lopes). Closes: #237864.
- Catalan (Jordi Mallach).
- Danish (Claus Hindsgaul). Closes: #237624.
- Dutch (Pieter-Paul Spiertz, Bart Cornelis, Erwin).
Closes: #102094, #151799, #207758.
- French (Sam Hocevar). Closes: #243191.
- German (Florian Ernst). Closes: #109669, #115352, #187952, #244098.
- Japanese manpages (KISE Hiroshi). Closes: #220776.
- Polish (Bartosz Fenski). Closes: #242870.
- Spanish (Javier Fernández-Sanguino Peña). Closes: #166052.
- Swedish (Peter Karlsson).
* New Translations:
- Japanese dpkg-source manpage (KISE Hiroshi). Closes: #239000.
- Norwegian Nynorsk (Gaute Hvoslef Kvalnes). Closes: #233614.
- Portguese (Miguel Figueiredo). Closes: #240081.
- Spanish dpkg-source manpage (Ruben Porras). Closes: #171489.
Files:
3c0ee1d26bd55362b92eee8e6255aee0 798 base required dpkg_1.10.21.dsc
a9f6c43891db74d727beab7dfc0ee663 1682647 base required dpkg_1.10.21.tar.gz
e492251ba4cf345982782b7880056e1f 1220962 base required dpkg_1.10.21_i386.deb
132ac9df0f3dd8fd8b7adbf409f8ed3e 105530 base required dselect_1.10.21_i386.deb
48e0a00caea19997c46ad2d7539b2731 137490 utils standard dpkg-dev_1.10.21_all.deb
794381a64e07416e48af7d6bb4ae52d0 10620 doc optional dpkg-doc_1.10.21_all.deb
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)
iD8DBQFAi/2fIexP3IStZ2wRAn8pAJ9/rxk0uozGIQta1eA1i+IQZIQx9QCgpA1B
Hn7++hlhNM0b38XnzfCRzhg=
=GiSq
-----END PGP SIGNATURE-----
Send a report that this bug log contains spam.
Debian bug tracking system administrator <owner@bugs.debian.org>.
Last modified:
Fri Mar 29 14:00:43 2024;
Machine Name:
bembo
Debian Bug tracking system
Debbugs is free software and licensed under the terms of the GNU
Public License version 2. The current version can be obtained
from https://bugs.debian.org/debbugs-source/.
Copyright © 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson,
2005-2017 Don Armstrong, and many other contributors.