[puppet/f17] Apply upstream fix for fqdn_rand function with ruby-1.9 (#880959)

Todd Zullinger tmz at fedoraproject.org
Wed Mar 20 14:12:24 UTC 2013


commit d8c6dcbfe6752b754919ed3f174fbd5074d40bdd
Author: Todd Zullinger <tmz at pobox.com>
Date:   Mon Mar 18 11:36:14 2013 -0400

    Apply upstream fix for fqdn_rand function with ruby-1.9 (#880959)
    
    This was made upstream on the 3.0 branch and won't be backported to
    2.7 because ruby 1.9 is not supported there.

 ...-Update-fqdn_rand-for-ruby-1.9.2-rand-bug.patch |   34 ++++++++++++++++++++
 puppet.spec                                        |   12 +++++--
 2 files changed, 43 insertions(+), 3 deletions(-)
---
diff --git a/0001-8814-Update-fqdn_rand-for-ruby-1.9.2-rand-bug.patch b/0001-8814-Update-fqdn_rand-for-ruby-1.9.2-rand-bug.patch
new file mode 100644
index 0000000..ad67f9a
--- /dev/null
+++ b/0001-8814-Update-fqdn_rand-for-ruby-1.9.2-rand-bug.patch
@@ -0,0 +1,34 @@
+From a38ee8acc43c0c76a3297db2c524f5656a03b5ff Mon Sep 17 00:00:00 2001
+From: Nan Liu <nan at puppetlabs.com>
+Date: Thu, 11 Aug 2011 22:18:48 -0500
+Subject: [PATCH/puppet] (#8814) Update fqdn_rand for ruby 1.9.2 rand bug.
+
+Ruby 1.9.2 does not accept a string for rand function, so rand('1')
+fails even though this works in Ruby 1.8.x and the string is implicitly
+converted to a number. We added to_i to avoid this bug.
+
+Conflicts:
+
+	lib/puppet/parser/functions/fqdn_rand.rb
+
+Cherry-picked to 2.7.x by Todd Zullinger <tmz at pobox.com>.
+---
+ lib/puppet/parser/functions/fqdn_rand.rb |    2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+diff --git a/lib/puppet/parser/functions/fqdn_rand.rb b/lib/puppet/parser/functions/fqdn_rand.rb
+index dd8d568..6184f34 100644
+--- a/lib/puppet/parser/functions/fqdn_rand.rb
++++ b/lib/puppet/parser/functions/fqdn_rand.rb
+@@ -7,7 +7,7 @@ Puppet::Parser::Functions::newfunction(:fqdn_rand, :type => :rvalue, :doc =>
+ 
+       $random_number = fqdn_rand(30)
+       $random_number_seed = fqdn_rand(30,30)") do |args|
+-    max = args.shift
++    max = args.shift.to_i
+     srand(Digest::MD5.hexdigest([lookupvar('::fqdn'),args].join(':')).hex)
+     rand(max).to_s
+ end
+-- 
+1.7.6
+
diff --git a/puppet.spec b/puppet.spec
index 6c046eb..318b215 100644
--- a/puppet.spec
+++ b/puppet.spec
@@ -13,7 +13,7 @@
 
 Name:           puppet
 Version:        2.7.21
-Release:        1%{?dist}
+Release:        2%{?dist}
 Summary:        A network tool for managing many disparate systems
 License:        ASL 2.0
 URL:            http://puppetlabs.com
@@ -21,8 +21,10 @@ Source0:        http://downloads.puppetlabs.com/%{name}/%{name}-%{version}.tar.g
 Source1:        http://downloads.puppetlabs.com/%{name}/%{name}-%{version}.tar.gz.asc
 Source2:        puppetstoredconfigclean.rb
 Source3:        puppet-nm-dispatcher
-
-# All patches we used to carry are now upstream.
+# http://projects.puppetlabs.com/issues/8814
+# https://bugzilla.redhat.com/show_bug.cgi?id=880959
+# https://github.com/puppetlabs/puppet/commit/d3c747b
+Patch0:         0001-8814-Update-fqdn_rand-for-ruby-1.9.2-rand-bug.patch
 
 Group:          System Environment/Base
 
@@ -82,6 +84,7 @@ The server can also function as a certificate authority and file server.
 
 %prep
 %setup -q
+%patch0 -p1
 patch -s -p1 < conf/redhat/rundir-perms.patch
 
 # Fix some rpmlint complaints
@@ -286,6 +289,9 @@ fi
 rm -rf %{buildroot}
 
 %changelog
+* Mon Mar 18 2013 Todd Zullinger <tmz at pobox.com> - 2.7.21-2
+- Apply upstream fix for fqdn_rand function with ruby-1.9 (#880959)
+
 * Wed Mar 13 2013 Michael Stahnke <stahnma at puppetlabs.com> - 2.7.21-1
 - Fixes for CVE-2013-1640 CVE-2013-1652 CVE-2013-1653 CVE-2013-1654
 - CVE-2013-1655 CVE-2013-2274 CVE-2013-2275


More information about the scm-commits mailing list