All of lore.kernel.org
 help / color / mirror / Atom feed
From: Max Reitz <mreitz@redhat.com>
To: Eric Blake <eblake@redhat.com>, qemu-devel@nongnu.org
Cc: fullmanet@gmail.com, qemu-block@nongnu.org,
	qemu-stable@nongnu.org, Kevin Wolf <kwolf@redhat.com>
Subject: Re: [Qemu-devel] [PATCH 1/2] qemu-img: Fix dd with skip= and count=
Date: Thu, 16 Aug 2018 04:19:38 +0200	[thread overview]
Message-ID: <81792fb8-72c4-08ca-1673-fb2f6afda6b3@redhat.com> (raw)
In-Reply-To: <7ac0b1de-dada-33a9-30f1-5c5122982284@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 1903 bytes --]

On 2018-08-16 04:17, Eric Blake wrote:
> On 08/15/2018 09:03 PM, Max Reitz wrote:
> 
>>> @@ -4559,19 +4559,23 @@ static int img_dd(int argc, char **argv)
>>>           goto out;
>>>       }
>>>
>>> +    /* Overflow means the specified offset is beyond input image's
>>> size */
>>> +    if (dd.flags & C_SKIP && (in.offset > INT64_MAX / in.bsz ||
>>> +                              size < in.bsz * in.offset)) {
>>> +        size = 0;
>>> +        error_report("%s: cannot skip to specified offset",
>>> in.filename);
>>
>> in_pos should be initialized as well (to "size", I suppose), or my gcc
>> will continue to complain. :-)
>>
> 
> Serves me right for compiling with -g instead of -O2 (gcc only does that
> warning on optimized builds, for some weird reason).  Will fix in v2.
> 
> 
>>> +++ b/tests/qemu-iotests/160
>>> @@ -44,6 +44,7 @@ _supported_os Linux
>>>   TEST_SKIP_BLOCKS="1 2 30 30K"
>>>
>>>   for skip in $TEST_SKIP_BLOCKS; do
>>> +  for count in '' 'count=1 '; do
>>
>> Ah, so this is why we indent everything by four spaces!  So you can
>> squeeze in three more block headers without having to re-indent
>> everything.  I finally see. O:-)
> 
> I'm seriously thinking of reindenting things in this and the next patch,
> rather than my initial quick-and-dirty "squeeze it in".  'git diff -w'
> is not that hard to use, after all.
> 
>>
>> (Not sure why you put a space after the 'count=1', though, but OK)
> 
> For this line:
> 
> +    echo "== Converting the image with dd with ${count}skip=$skip =="
> 
> so that when $count is empty, the .out file doesn't end up with a double
> space.  Okay, I do have some sense of output aesthetics, even if my
> re-indentation skills are lacking ;=)

Ah, right, I forgot you'd get the double space.  That's true.

Max


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

  reply	other threads:[~2018-08-16  2:19 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-15  2:56 [Qemu-devel] [PATCH 0/2] Improve qemu-img dd Eric Blake
2018-08-15  2:56 ` [Qemu-devel] [PATCH 1/2] qemu-img: Fix dd with skip= and count= Eric Blake
2018-08-16  2:03   ` Max Reitz
2018-08-16  2:17     ` Eric Blake
2018-08-16  2:19       ` Max Reitz [this message]
2018-08-15  2:56 ` [Qemu-devel] [PATCH 2/2] qemu-img: Add dd seek= option Eric Blake
2018-08-16  2:20   ` Max Reitz
2018-08-16  2:39     ` Eric Blake
2018-08-16  2:49       ` Eric Blake
2018-08-16  2:49       ` Max Reitz
2018-08-16  2:57         ` Eric Blake
2018-08-16  3:00           ` Max Reitz
2018-08-16  7:15         ` Kevin Wolf
2018-08-17 19:22           ` Max Reitz
2018-08-20  2:07     ` Fam Zheng
2018-08-20 12:20       ` Max Reitz
2018-08-16  2:04 ` [Qemu-devel] [PATCH 0/2] Improve qemu-img dd Eric Blake
2018-08-16  2:12 ` Eric Blake
2018-08-16 19:39 ` no-reply
2018-08-16 20:00 ` no-reply

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=81792fb8-72c4-08ca-1673-fb2f6afda6b3@redhat.com \
    --to=mreitz@redhat.com \
    --cc=eblake@redhat.com \
    --cc=fullmanet@gmail.com \
    --cc=kwolf@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-stable@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.