Do not use redirection on binary files
authorRichard Levitte <levitte@openssl.org>
Thu, 14 Jan 2016 12:15:45 +0000 (13:15 +0100)
committerRichard Levitte <levitte@openssl.org>
Thu, 14 Jan 2016 12:15:45 +0000 (13:15 +0100)
On some platforms, the shell will determine what attributes a file
will have, so while the program might think it's safely outputting
binary data, it's not always true.

For the sake of the tests, it's therefore safer to use -out than to
use redirection.

Reviewed-by: Rich Salz <rsalz@openssl.org>
test/recipes/20-test_enc.t
test/recipes/tconversion.pl

index 836d9792f95c4aa8e1a0b1704329c934bb36d93b..55f39421fea654fa9597b602e4f598ad28da064a 100644 (file)
@@ -51,10 +51,8 @@ if (!$init) {
                 @d = ( "enc", @{$variant{$t}}, "-d" );
             }
 
-            ok(run(app([$cmd, @e],
-                       stdin => $test, stdout => $cipherfile))
-               && run(app([$cmd, @d],
-                          stdin => $cipherfile, stdout => $clearfile))
+            ok(run(app([$cmd, @e, "-in", $test, "-out", $cipherfile]))
+               && run(app([$cmd, @d, "-in", $cipherfile, "-out", $clearfile]))
                && compare_text($test,$clearfile) == 0, $t);
             unlink $cipherfile, $clearfile;
         }
index 07e34060f395ed63ded85645f9fcf6e89e30c96a..0f9b03b481a41f4ebfc3935ed48078985120df5e 100644 (file)
@@ -53,8 +53,9 @@ sub tconversion {
          ok(run(app([@cmd,
                      "-in", "$testtype-fff.p",
                      "-inform", "p",
-                     "-outform", $to],
-                    stdout => "$testtype-f.$to")), "p -> $to");
+                     "-out", "$testtype-f.$to",
+                     "-outform", $to])),
+            "p -> $to");
       }
 
       foreach my $to (@conversionforms) {
@@ -62,8 +63,9 @@ sub tconversion {
              ok(run(app([@cmd,
                          "-in", "$testtype-f.$from",
                          "-inform", $from,
-                         "-outform", $to],
-                        stdout => "$testtype-ff.$from$to")), "$from -> $to");
+                         "-out", "$testtype-ff.$from$to",
+                         "-outform", $to])),
+                "$from -> $to");
          }
       }