Re: [PATCH] unbreak booting with virtio

Ján ONDREJ (SAL)
2009-08-01T08:47:15Z

On Sat, Aug 01, 2009 at 10:19:20AM +0200, Alexander Graf wrote:
>
> On 01.08.2009, at 10:01, Ján ONDREJ (SAL) wrote:
>
>> On Sat, Aug 01, 2009 at 09:04:55AM +0200, Ján ONDREJ (SAL) wrote:
>>> On Fri, Jul 31, 2009 at 09:55:39PM +0200, Alexander Graf wrote:
>>>>
>>>> On 31.07.2009, at 20:19, Glauber Costa <glommer@redhat.com> wrote:
>>>>
>>>>> cp "$1" "$2"
>>>>> +sum=$(echo "obase=8; $sum" | bc)
>>>>> printf "\\$sum" | dd of="$2" bs=1 count=1 seek=$size conv=notrunc
>>>>> 2>/
>>>>> dev/null
>>>
>>> May be it's better to use awk:
>>>
>>> echo $sum | awk '{ printf("%c", $1) }' \
>>> | dd of="$2" bs=1 count=1 seek=$size conv=notrunc 2>/dev/null
>>>
>>> This version accepts decimal $sum, does not need conversion to octal.
>>
>> Ane may be it's better to write whole checksum in awk, it's faster and
>> cleaner. See attached patch (I am sorry, I don't know how to use git-
>> email).
>
> My awk magic is pretty bad, but I think this version is missing the
> padding, right?

Right. If you prefer this version agains Paolos double printf, I can
update it, if not, just use Pauols solution.

SAL