[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Problems with dd and the keywords swab and sync



On Wed, Apr 18, 2001 at 04:50:03PM +0100, Andrew Josey wrote:

> You might want to look at dd in SUSv3. The wording in SUSv2
> is from POSIX 1003.2, and there have been POSIX interpretations
> in this area and the fixes are in SUSv3. Draft 6 of SUSv3 is now available at
> http://www.opengroup.org/austin/  (you need to join the Austin
> Group reflector to get an acct to download the spec).

I asked Andrew to mail me a copy, which he did (Thanks Andrew). 

I asked Andrew if I may quote the interesting paragraphs from SUSv3.

For me the SUSv3 page on dd reads such that the extra (odd) character
is NOT to be ignored, but output after the swabbed byte pairs. 

But did´nt dd output a newline before this last character? 

There is a test case, but this test case:
	echo ababx | dd conv=swab
	babax

is giving us a false alarm:

The error only occurs, if the ababx is followed by a newline character:
Proof:   (Type in ababX followed by 2 times <Ctrl+D>   )
      $ dd conv=swab of=x
      ababX0+1 records in
      0+1 records out
      $ cat x
      babaX$ 

The reason is that (without the block directive) dd is treating Newline
as a normal character and not as a line end. 


The info page on dd is clear enough and (I think) in line with SUS_v3:

    `swab'
          Swap every pair of input bytes.  GNU `dd', unlike others,
          works when an odd number of bytes are read--the last byte is
          simply copied (since there is nothing to swap it with).


So I think, we have no standard deviation with dd from fileutils.




 


-- 
     ______   ___        
    /  ___/__/  /                 Caldera (Deutschland) GmbH          
   /  /_/ _  / /__        Naegelsbachstr. 49c, 91052 Erlangen, Germany 
  /_____/_/ /____/            software developer / lsb project 
 ==== /____/ =====   Dipl. Inf. Johannes Poehlmann, mail: jhp@caldera.de
Caldera OpenLinux    phone: ++49 9131 7192 335, fax: ++49 9131 7192 399



Reply to: