Jesse Weinstein
2013-Mar-20 02:49 UTC
[flac-dev] [PATCH] Change test scripts shell to bash, to avoid lack of arithmetic support in dash, which is sh on Ubuntu 10.04
The subject line mostly says it all, but for reference, having #!/bin/sh causes the following error: arithmetic expression: expecting primary: " % 255 + 1" --- test/test_flac.sh | 2 +- test/test_grabbag.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/test/test_flac.sh b/test/test_flac.sh index 10981c0..257c5ea 100755 --- a/test/test_flac.sh +++ b/test/test_flac.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # FLAC - Free Lossless Audio Codec # Copyright (C) 2001,2002,2003,2004,2005,2006,2007,2008,2009 Josh Coalson diff --git a/test/test_grabbag.sh b/test/test_grabbag.sh index 5d9f9d1..959bda5 100755 --- a/test/test_grabbag.sh +++ b/test/test_grabbag.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # FLAC - Free Lossless Audio Codec # Copyright (C) 2001,2002,2003,2004,2005,2006,2007,2008,2009 Josh Coalson -- 1.7.0.4
Erik de Castro Lopo
2013-Mar-20 03:22 UTC
[flac-dev] [PATCH] Change test scripts shell to bash, to avoid lack of arithmetic support in dash, which is sh on Ubuntu 10.04
Jesse Weinstein wrote:> The subject line mostly says it all, but for reference, having #!/bin/sh causes the following error: > > arithmetic expression: expecting primary: " % 255 + 1"Arithmetic support is actually not the issue, rather its that dash/sh doesn't support $RANDOM. The solution to this is to replace $RANDOM with $(date +%N) which is obviouslsy not all that random, but which is close enough to random for this usage. Since Jaren is in the process of making the scripts POSIX shell compliant, I think swicthing to bash is a bad idea :-). I was going to do the $RANDOM to $(date +%N) conversion after Jaren's POSIX patches were all applied. Cheers, Erik -- ---------------------------------------------------------------------- Erik de Castro Lopo http://www.mega-nerd.com/
Jaren Stangret
2013-Mar-20 03:29 UTC
[flac-dev] [PATCH] Change test scripts shell to bash, to avoid lack of arithmetic support in dash, which is sh on Ubuntu 10.04
Erik, I was thinking of doing this: export MALLOC_PERTURB_=$(awk 'BEGIN { srand(); print int(rand() * 32767 % 255 + 1) }') Or would you prefer using 'date'? On Tue, Mar 19, 2013 at 10:22 PM, Erik de Castro Lopo <mle+la at mega-nerd.com>wrote:> Jesse Weinstein wrote: > > > The subject line mostly says it all, but for reference, having #!/bin/sh > causes the following error: > > > > arithmetic expression: expecting primary: " % 255 + 1" > > Arithmetic support is actually not the issue, rather its that dash/sh > doesn't support $RANDOM. The solution to this is to replace $RANDOM > with $(date +%N) which is obviouslsy not all that random, but which > is close enough to random for this usage. > > Since Jaren is in the process of making the scripts POSIX shell > compliant, I think swicthing to bash is a bad idea :-). > > I was going to do the $RANDOM to $(date +%N) conversion after Jaren's > POSIX patches were all applied. > > Cheers, > Erik > -- > ---------------------------------------------------------------------- > Erik de Castro Lopo > http://www.mega-nerd.com/ > _______________________________________________ > flac-dev mailing list > flac-dev at xiph.org > http://lists.xiph.org/mailman/listinfo/flac-dev >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.xiph.org/pipermail/flac-dev/attachments/20130319/03f15ffb/attachment.htm