Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAK4o1WxR7gBi-54sp2cOS0DmRDt=H5CcYuvovxneJjyxD-4B2A@mail.gmail.com>
Date: Sun, 21 Sep 2014 14:27:28 +0100
From: Justin Cormack <justin@...cialbusservice.com>
To: "Nadav Har'El" <nyh@...udius-systems.com>
Cc: musl@...ts.openwall.com, Osv Dev <osv-dev@...glegroups.com>
Subject: Re: drand48() gives wrong sequence?

On Sun, Sep 21, 2014 at 12:45 PM, Nadav Har'El <nyh@...udius-systems.com> wrote:
> Hi, I ran the following trivial program on both glibc (on Linux), and Musl
> (on OSv).
>
> #include <stdio.h>
> #include <stdlib.h>
>
> int main() {
>         srand48(12345);
>         printf("%ld %ld %ld\n", lrand48(), lrand48(), lrand48());
> }
>
> Unfortunately, the sequence did not come out the same: On glibc+Linux I got:
>
>      444188209 1973930609 483889296
>
> But on OSv+Musl I got:
>
>      1737082417 264424049 61706384
>
> I expected to get the same sequence because both the drand48(3) man-page on
> Linux and the drand48 specification in Posix
> (http://pubs.opengroup.org/onlinepubs/9699919799/functions/drand48.html) are
> pretty explicit about the formulas that should be used. I also looked at the
> Musl code quickly, and it does seem to use these formulas.
>
> Any ideas why I'm getting the wrong sequence?

Hmm, just checked on a non-OSv Musl system and get the same result as
you. I also checked on NetBSD and FreeBSD and they give the same
result as glibc, so I think there must be a Musl bug.

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.