Bug 193147

Summary: [patch] Change rand(3) to random(3) in awk(1)
Product: Base System Reporter: horus.li
Component: binAssignee: Pedro F. Giffuni <pfg>
Status: Closed FIXED    
Severity: Affects Only Me CC: delphij
Priority: ---    
Version: 10.0-STABLE   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
The patch.
none
svn-ready patch. none

Description horus.li 2014-08-30 13:39:25 UTC
Created attachment 146536 [details]
The patch.

Change rand(3) to random(3) can result in better randomness.
Other implementations such as OSX's awk & gawk already made this change.
Discussion in freebsd-hackers received positive feedbacks, details can be found here[1].

[1] https://lists.freebsd.org/pipermail/freebsd-hackers/2014-August/045917.html
Comment 1 Pedro F. Giffuni freebsd_committer 2014-09-14 14:45:02 UTC
Created attachment 147313 [details]
svn-ready patch.

For some reason our regular patch(1) and svn patch didn't like the original patch so I redid it.
Comment 2 Pedro F. Giffuni freebsd_committer 2014-09-14 14:48:08 UTC
The patch has been submitted upstream so it makes sense to commit it to head and eventually resync with upstream. I am CC'ing Xin Li since he has been maintaining awk for some time.
Comment 3 commit-hook freebsd_committer 2014-09-19 18:25:00 UTC
A commit references this bug:

Author: pfg
Date: Fri Sep 19 18:24:03 UTC 2014
New revision: 271879
URL: http://svnweb.freebsd.org/changeset/base/271879

Log:
  awk: Use random(3) instead of rand(3)

  While none of them is considered even near to cryptographic
  level, random(3) is a better random generator than rand(3).

  Use random(3) for awk as is done in other systems.

  Thanks to Chenguang Li for discussing this in the lists
  and submitting the patch upstream.

  PR:		193147
  MFC after:	5 weeks

Changes:
  head/contrib/one-true-awk/awk.1
  head/contrib/one-true-awk/main.c
  head/contrib/one-true-awk/run.c
Comment 4 commit-hook freebsd_committer 2014-10-10 23:18:56 UTC
A commit references this bug:

Author: pfg
Date: Fri Oct 10 23:18:46 UTC 2014
New revision: 272918
URL: https://svnweb.freebsd.org/changeset/base/272918

Log:
  MFC	r271879:
  awk: Use random(3) instead of rand(3)

  While none of them is considered even near to cryptographic
  level, random(3) is a better random generator than rand(3).

  Use random(3) for awk as is done in other systems.

  PR:		193147

Changes:
_U  stable/10/
  stable/10/contrib/one-true-awk/awk.1
  stable/10/contrib/one-true-awk/main.c
  stable/10/contrib/one-true-awk/run.c
Comment 5 commit-hook freebsd_committer 2014-10-10 23:19:57 UTC
A commit references this bug:

Author: pfg
Date: Fri Oct 10 23:19:35 UTC 2014
New revision: 272919
URL: https://svnweb.freebsd.org/changeset/base/272919

Log:
  MFC	r271879:
  awk: Use random(3) instead of rand(3)

  While none of them is considered even near to cryptographic
  level, random(3) is a better random generator than rand(3).

  Use random(3) for awk as is done in other systems.

  PR:		193147

Changes:
_U  stable/9/contrib/one-true-awk/
  stable/9/contrib/one-true-awk/awk.1
  stable/9/contrib/one-true-awk/main.c
  stable/9/contrib/one-true-awk/run.c
Comment 6 Pedro F. Giffuni freebsd_committer 2014-10-10 23:21:09 UTC
Merged to stable/10 and stable/9