From: Filip Navara <filip.navara@gmail.com>
To: Avi Kivity <avi@redhat.com>
Cc: Paolo Bonzini <bonzini@gnu.org>,
Glauber Costa <glommer@redhat.com>,
Jan Ondrej <ondrejj@salstar.sk>, Alexander Graf <agraf@suse.de>,
qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] Re: [PATCH] Fix checksum writing in signboot.sh
Date: Sun, 2 Aug 2009 12:25:44 +0200 [thread overview]
Message-ID: <5b31733c0908020325k3e035b91n3b0089a2f865de3@mail.gmail.com> (raw)
In-Reply-To: <4A756491.6020004@redhat.com>
On Sun, Aug 2, 2009 at 12:04 PM, Avi Kivity<avi@redhat.com> wrote:
> On 08/01/2009 12:48 PM, Alexander Graf wrote:
>>
>> The printf command takes an octal value after \, so we have to convert
>> our decimal representation to octal first and then write it.
>>
>> This unbreaks extboot signing. Multiboot wasn't affected yet because
>> the checksum was< 8.
>>
>> Spotted and first patch by Glauber Costa<glommer@redhat.com>.
>> Printf idea by Paolo Bonzini<bonzini@gnu.org>.
>>
>> Signed-off-by: Alexander Graf<agraf@suse.de>
>> CC: Glauber Costa<glommer@redhat.com>
>> CC: Paolo Bonzini<bonzini@gnu.org>
>> CC: Jan Ondrej<ondrejj@salstar.sk>
>> ---
>> pc-bios/optionrom/signrom.sh | 3 ++-
>> 1 files changed, 2 insertions(+), 1 deletions(-)
>>
>> diff --git a/pc-bios/optionrom/signrom.sh b/pc-bios/optionrom/signrom.sh
>> index 4322811..975b27d 100755
>> --- a/pc-bios/optionrom/signrom.sh
>> +++ b/pc-bios/optionrom/signrom.sh
>> @@ -39,7 +39,8 @@ done
>>
>> sum=$(( $sum % 256 ))
>> sum=$(( 256 - $sum ))
>> +sum_octal=$( printf "%o" $sum )
>>
>> # and write the output file
>> cp "$1" "$2"
>> -printf "\\$sum" | dd of="$2" bs=1 count=1 seek=$size conv=notrunc
>> 2>/dev/null
>> +printf "\\$sum_octal" | dd of="$2" bs=1 count=1 seek=$size conv=notrunc
>> 2>/dev/null
>>
>
> While the patch is good, the code is unreadable. Can we mandate python for
> such tricks?
No, please, no! Throwing additional tools at the problem is only going
to make it worse for Windows users. I'm not happy with using sh script
as it already added dependency on coreutils, but at least that's easy
to install. Python is a nightmare compared to that.
BTW, for years in ReactOS we had a way to build host tools with host
CC and these tools were written in plain ordinary C. This worked great
for both Windows and Linux builds and also for cross-compiling.
Best regards,
Filip Navara
next prev parent reply other threads:[~2009-08-02 10:25 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-08-01 9:48 [Qemu-devel] [PATCH] Fix checksum writing in signboot.sh Alexander Graf
2009-08-02 10:04 ` [Qemu-devel] " Avi Kivity
2009-08-02 10:25 ` Filip Navara [this message]
2009-08-02 11:15 ` Avi Kivity
2009-08-02 11:58 ` Alexander Graf
2009-08-02 12:21 ` Avi Kivity
2009-08-02 21:29 ` [Qemu-devel] " Sebastian Herbszt
2009-08-03 2:30 ` [Qemu-devel] " Anthony Liguori
2009-08-03 6:12 ` Paolo Bonzini
2009-08-03 12:55 ` Avi Kivity
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5b31733c0908020325k3e035b91n3b0089a2f865de3@mail.gmail.com \
--to=filip.navara@gmail.com \
--cc=agraf@suse.de \
--cc=avi@redhat.com \
--cc=bonzini@gnu.org \
--cc=glommer@redhat.com \
--cc=ondrejj@salstar.sk \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).