Bug#193278: libc6: When restarting, if one fails, rest isn't done
At Sun, 18 May 2003 00:20:15 +0200,
Paul Slootman wrote:
>
> On Sat 17 May 2003, GOTO Masanori wrote:
> > >
> > > > > dpkg gives an extra empty line if a not-installed package name is given,
> > > > > which is probably what is confusing the awk script.
> > > >
> > > > Could you provide us your "dpkg -s apache apache2-common proftpd"?
> > >
> > > Between the lines:
> > > --------
> > > Package: apache
> >
> > I don't understand why you thought "dpkg gives an extra empty line if
> > a not-installed package name is given". Look at libc6.postinst. You
> > see some packages which are not installed on your machine, don't you?
>
> ?? Of course I see packges listed in libc6.postinst that aren't
> installed, that's the whole problem! Those not-installed packages are
> causing extra empty lines that the awk script can't handle.
> In the dpkg -s output I see NOTHING about apache2-common, which is not
> installed. Between the output for apache and the output for proftpd I
> see two (2) empty lines. If I leave out the "apache2-common", i.e.
> simply do "dpkg -s apache proftpd", then I see exactly one (1) empty
> line there. That is why I say "dpkg gives an extra empty line if a
> not-installed package name is given", because it does... If I give the
> "apache2-common" parameter twice, I get three empty lines, etc.
>
> dpkg -s *does* give an error line for not-installed packages, but that
> is sent to stderr and that is directed to /dev/null in libc6's postinst.
The problem is:
gotom@celesta:~> dpkg -s missing-package-name
Package `missing-package-name' is not installed and no info is available.
Use dpkg --info (= dpkg-deb --info) to examine archive files,
and dpkg --contents (= dpkg-deb --contents) to list their contents.
goes to stderr, not stdout, is it ok?
> The awk script has:
> RS="\n\n";FS="\n"
> meaning that the record separator is ONE empty line, and every line
> after that is a separate field. Then $2 is checked for:
> /Status: .* installed$/
> Unfortunately, with 2 emtpy line, the $2 is the line "Package: proftpd"
> and not the "Status:" line.
Ah I've confirmed this. When not-installed package is existed, then
the next package name in libc6.postinst entry is not detected.
If we have the following line in libc6.postinst:
check="ssh netbase missing-package-name netbase samba"
Then samba is detected, but netbase is not detected. Well, it's problem.
One idea to fix is your "dpkg -l" way:
dpkg -l $check 2> /dev/null | awk '{ if (i > 4) { print $0 }; i++; }' | egrep -i '^.[ihufc]' | awk '{print $2}'
Or, looping dpkg -s each_package_name like:
for pkg in $check; do
dpkg -s $pkg 2> /dev/null | awk 'BEGIN{RS="\n\n";FS="\n"}{ if ( $2 ~ /Status: .* installed$/ ) { print $1 } }' | cut -f 2 -d ' '
done
I would like to take the latter because I don't know that the length
of "dpkg -l" is really guaranteed (thus, it's not truncated) or not.
BTW, I also noticed the current restart script checks only "installed".
However, if it's "half-installed, half-configured, or unpacked", then
the daemon may be running. Hmm, they should be included to check...
> I had hoped you would have understood this, without me having to
> spell it out; after all, *you* wrote the awk script?
Partially. Jeff Bailey wrote this script mainly.
Regards,
-- gotom
Reply to: