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

Bug#586554: update-initramfs fails to generate initrd.img-2.6.32-5-686 in Debian testing when upgrading from 0.96 to 0.97



On 07/05/2010 07:19 PM, Brendon Higgins wrote:
Something really odd seems to be going on. It works without errors when I try
this:
awk '{print $2}' $STATE_DIR/clean-files \
     | while read file; do
     echo "ha"
     test -e ${DESTDIR}$file&&  rm -f ${DESTDIR}$file
     echo "ho"
done

However, if I comment out the echo "ho" line, it fails. It's like the result
of the test on that last line is erroneously propagating as the result of the
loop, or something.
You're right, but it is not erroneous. According to the bash manual page it is correct behaviour.

The documentation for "while" states that "the exit status of the while and until commands is the exit status of the last do list command executed, or zero if none was executed."

With regards to the "&&" operator, the manual states that "the return status of AND and OR lists is the exit status of the last command executed in the list."

This together means that the "while" loop was inheriting the failed status of the "test" command and causing the script to exit with a failed status.

The documentation for "if" states that "the exit status is the exit status of the last command executed, or zero if no condition tested true."

That explains why using an "if" statement makes the script work as expected.

I couldn't find anything in the dash manual page about all this but it seems to be working in the same way.

This behaviour appears to be a relatively recent change.

I also noticed that both files listed in clean-files actually exist, both before
and after I run update-initramfs. But the rm shouldn't return an error, and
even if it does, adding an echo command after it shouldn't fix it. At least, I
don't see why.
The files in clean-files exist on your file system, but the script checks for and erases these files from the initrd file system (i.e. DESTDIR), and not from your regular file system.

So I think we've finally cleared this up. Thanks for all your help Brendon. It's really appreciated.

We'll be releasing an updated iscan-data package as soon as we can. I'll reply here with the details when we do.

Happy scanning,
--
Alesh Slovak                    Linux Team -- AVASYS Corporation
alesh.slovak@avasys.jp          http://avasys.jp



Reply to: