Bug#193278: libc6: When restarting, if one fails, rest isn't done
At Mon, 19 May 2003 18:35:43 +0900,
GOTO Masanori wrote:
> > 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.
This bug should be fixed in the next debian-glibc 2.3.2.ds-14.
> 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.
I committed with another simple way as follows:
dpkg -s $check 2> /dev/null | egrep '^Package:|^Status:' | awk '{if ($1 ~ /Package:/) { package=$2 } else if ($0 ~ /Status: .* installed/ ) { print package }}'
> 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 reconsider it. If package is such an invalid state, daemons are not
guaranteed to work correctly. I ignore this.
Regards,
-- gotom
Reply to: