Louis Guillaume wrote:
> Max Bowsher wrote:
>> Max Bowsher wrote:
>>> Louis Guillaume wrote:
>>>> Hi,
>>>>
>>>> The attached patch should fix a portability problem in subversion/tests/cmdline/davautocheck.sh.
>>>>
>>>> * subversion/tests/cmdline/davautocheck.sh
...
>>>>   (2) Replaced use of `$RANDOM' with `(( $$ % 32768 ))'.
>>> Why 32768?
>>>
>>> IMO:
>>> HTTPD_PORT=$(( $$ % 64511 + 1024 ))
>>>
>>> is a more suitable calculation.
> 
> Agreed. That's better. I was just reproducing what $RANDOM does...
> 
> from bash(1)
> 
>   RANDOM Each time this parameter is referenced, a random integer between
>          0 and 32767 is generated.  The sequence of random numbers may be
>          initialized by assigning a value to RANDOM.  If RANDOM is unset,
>          it  loses  its  special  properties,  even if it is subsequently
>          reset.
> 
>> Note that the use of $RANDOM seems entirely fine to me, so long as the
>> shebang line is still specifying /bin/bash explicitly.
> 
> But that assumes that /bin/bash is on every system, which it isn't by default.
> It's not there on NetBSD or AIX and I'm pretty sure it's not in Solaris.
> Probably others too, but I can't speak to those.
Yes, but that's not the point.
So long as the script say "#!/bin/bash", it's not even _trying_ to be
portable - there's no point trying to enhance the portability, if the
script declares that it is not portable.
Max.
Received on Thu Mar 29 00:07:26 2007