GNU bug report logs - #9157
[PATCH] dd: sparse conv flag

Previous Next

Package: coreutils;

Reported by: Roman Rybalko <devel <at> romanr.info>

Date: Sat, 23 Jul 2011 22:42:04 UTC

Severity: normal

Tags: patch

Done: Pádraig Brady <P <at> draigBrady.com>

Bug is archived. No further changes may be made.

Full log


Message #20 received at 9157 <at> debbugs.gnu.org (full text, mbox):

From: Pádraig Brady <P <at> draigBrady.com>
To: "Roman Rybalko (devel)" <devel <at> romanr.info>
Cc: 9157 <at> debbugs.gnu.org, Jim Meyering <jim <at> meyering.net>
Subject: Re: bug#9157: [PATCH] dd: sparse conv flag
Date: Mon, 27 Feb 2012 15:20:00 +0000
[Message part 1 (text/plain, inline)]
I recently noticed a use case for this feature:
  https://review.openstack.org/#change,4435
But I managed to forget we had a patch pending for this,
and spent a couple of hours writing my own version :p
Well at least it's good practise for reviewing Roman's...

I notice Roman's seeks() the output for any run of NULs,
while mine only considers blocks of the full output block size.
Checking the full block is a bit more CPU efficient,
and gives a bit more control, so I'm marginally leaning
towards doing that?

Also Roman's doesn't handle the case where a seek
is done at the end of the file. In that case an ftruncate()
or write() is needed to correctly set the size.

Notes on my version attached are:
 I first need to refactor is_nul() for use by cp too.
 My version is advisory also
 We may need to coalesce seeks to larger ones? something like cache_round()?
   I thought it better to keep the code simple in this regard though
   as it's probably not of practical concern.
 I used conv= for bsd compat, rather than oflag=.
 Needs tests and docs yet.

cheers,
Pádraig.
[dd-sparse.patch (text/x-patch, attachment)]

This bug report was last modified 13 years and 182 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.