GNU bug report logs - #7362
dd strangeness

Previous Next

Package: coreutils;

Reported by: Lucia Rotger <lucia <at> aircomp.aero>

Date: Wed, 10 Nov 2010 10:26:01 UTC

Severity: normal

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

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Pádraig Brady <P <at> draigBrady.com>
To: Paul Eggert <eggert <at> cs.ucla.edu>
Cc: 7362 <at> debbugs.gnu.org
Subject: bug#7362: dd strangeness
Date: Wed, 02 Mar 2011 23:29:23 +0000
On 02/03/11 17:55, Paul Eggert wrote:
> On 03/02/2011 04:53 AM, Pádraig Brady wrote:
>> +  /* Enable 'fullblock' with 'direct' or 'cio' as we don't want to
>> +     write partial blocks to output, which would disable O_DIRECT. An
>> +     alternative would be to enable C_TWOBUFS to accumulate full output
>> +     blocks.  However that wouldn't work when a count is specified, and
>> +     is also less efficient.  */
>> +  if (output_flags & (O_DIRECT | O_CIO))
>> +    input_flags |= O_FULLBLOCK;
> 
> I'm afraid this patch feels wrong somehow.  It's conflating four
> issues: counting, efficiency, disabling O_DIRECT, and disabling O_CIO.
> Some thoughts:
> 
> 1.  Offhand I don't see why O_CIO has anything to do with blocking;
> why is it mentioned here?
> 
> 2.  If C_TWOBUFS is already in effect, then dd needn't set
> O_FULLBLOCK, since C_TWOBUFS already prevents the disabling of
> O_DIRECT.
> 
> 3.  The counting issue is independent of oflag=direct or oflag=cio:
> any solution for counting should work regardless of oflag settings.
> 
> The more I think about it, the more I suspect that this
> O_FULLBLOCK-inferring code should be omitted.  It adds little benefit, as
> it covers a rare combination of flags that is likely to be used only
> by experts, who should know the gotchas in this area anyway.  And the
> extra complexity in documentation will penalize everybody who reads
> it, even the non-experts.

Hmm I actually thought of something that may be better.
The O_DIRECT -> normal switch done in iwrite() for the
last write, should only happen once.
If it happens more than that, we can print a warning,
suggesting the use of iflag=fullblock.

cheers,
Pádraig.




This bug report was last modified 14 years and 168 days ago.

Previous Next


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