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

Re: Problems with dd and the keywords swab and sync



Hmmm, this means that SUSv2 and SUSv3 differ on this issue. v2 clearly
says "ignore" the extra character, while v3 clearly says to deal with it.

Can we reference SUSv3 in this spec? How do I do that?

BTW, different version of dd behave differently, and on different systems
and distros the same version can behave differently. Here is one place
where deciding on "the standard" will help the various tools come into
conformance (any luck at all ;-)

Now, about the block,sync conversion problems...

Soon,

On Thu, 19 Apr 2001, Johannes Poehlmann wrote:

> 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
> 
> 

Dwarf
--
_-_-_-_-_-   Author of "Dwarf's Guide to Debian GNU/Linux"  _-_-_-_-_-_-
_-                                                                    _-
_- aka   Dale Scheetz                   Phone:   1 (850) 656-9769     _-
_-       Flexible Software              11000 McCrackin Road          _-
_-       e-mail:  dwarf@polaris.net     Tallahassee, FL  32308        _-
_-                                                                    _-
_-_-_-_-_-  Released under the GNU Free Documentation License   _-_-_-_-
              available at: http://www.polaris.net/~dwarf/



Reply to: