On 05/07/2014 03:43 AM, Paul Eggert wrote:
> Thanks for reporting that bug.  Who would have thought that after all 
> these years, GNU 'dd' would still be mishandling EBCDIC conversion?  The 
> GNU dd implementation of conv=ascii is clearly incorrect.  I installed 
> the attached patch.

ooh, thanks!

There is a testing artifact left in the new test:

  > cp ./in ./out ./exp /tmp

I corrected this besides other minor nits in the attached patch.
Pushing later.

Have a nice day,
Berny
>From 119a81890f2194668bddc99f3f56f86fc180eadd Mon Sep 17 00:00:00 2001
From: Bernhard Voelker <[email protected]>
Date: Wed, 7 May 2014 09:14:34 +0200
Subject: [PATCH] tests: improve new ascii test of dd

* tests/dd/ascii.sh: Avoid unnecessary subshells.  Catch dd's
exit code.  Remove testing artifact.  In the case of a comparison
failure, show the differences in octal format in addition to
"binary files differ".
---
 tests/dd/ascii.sh | 22 ++++++++++++----------
 1 file changed, 12 insertions(+), 10 deletions(-)

diff --git a/tests/dd/ascii.sh b/tests/dd/ascii.sh
index 9ef158f..f2cc375 100755
--- a/tests/dd/ascii.sh
+++ b/tests/dd/ascii.sh
@@ -19,13 +19,13 @@
 . "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
 print_ver_ dd
 
-(
+{
   # Two lines, EBCDIC " A A" and " A  ", followed by all the bytes in order.
   printf '\100\301\100\301\100\301\100\100' &&
-  printf $(for i in $(seq 0 255); do printf '\\%03o' $i; done; echo '')
-) >in || framework_failure_
+  printf $(for i in $(seq 0 255); do printf '\\%03o' $i; done; echo '');
+} >in || framework_failure_
 
-(
+{
   # The converted lines, with trailing spaces removed.
   printf ' A A\n A\n' &&
   printf '\000\001\002\003\n\234\011\206\177\n' &&
@@ -59,13 +59,15 @@ print_ver_ dd
   printf '\134\237\123\124\n\125\126\127\130\n' &&
   printf '\131\132\364\365\n\366\367\370\371\n' &&
   printf '\060\061\062\063\n\064\065\066\067\n' &&
-  printf '\070\071\372\373\n\374\375\376\377\n'
-) >exp || framework_failure_
+  printf '\070\071\372\373\n\374\375\376\377\n';
+} >exp || framework_failure_
 
-dd if=in of=out conv=ascii cbs=4
-cp ./in ./out ./exp /tmp
+dd if=in of=out conv=ascii cbs=4 || fail=1
 
-fail=0
-compare exp out || fail=1
+compare exp out \
+  || { od -v -to1 exp > exp2 || framework_failure_;
+       od -v -to1 out > out2 || framework_failure_;
+       compare exp2 out2;
+       fail=1; }
 
 Exit $fail
-- 
1.8.4.5

Reply via email to