summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorAndreas Rogge <arogge@dv.rb.solvention.de>2008-04-02 19:55:25 +0200
committerLuke Kanies <luke@madstop.com>2008-04-03 10:39:21 -0500
commit6f1c46955a49647c14ede85304c25c7137dd9ab6 (patch)
tree1ee7ae538927a1d69c78a2ab0309ee87276c49b1 /lib
parente621985d24fbd417690f763276d7d895c0640042 (diff)
downloadpuppet-6f1c46955a49647c14ede85304c25c7137dd9ab6.tar.gz
puppet-6f1c46955a49647c14ede85304c25c7137dd9ab6.tar.xz
puppet-6f1c46955a49647c14ede85304c25c7137dd9ab6.zip
Extend workaround from 56aad69f8cdf8b0b08fdb7985014986223fa4455 to not only fix UIDs but also GIDs
Fixes #1169 Fixes #804 (workaround was probably incomplete, as required changes in lib/puppet/util/posix.rb were missing) Signed-off-by: Andreas Rogge <a.rogge@solvention.de>
Diffstat (limited to 'lib')
-rwxr-xr-xlib/puppet/type/file/group.rb20
-rwxr-xr-xlib/puppet/util/posix.rb4
2 files changed, 15 insertions, 9 deletions
diff --git a/lib/puppet/type/file/group.rb b/lib/puppet/type/file/group.rb
index 5f7caf342..cc482ff31 100755
--- a/lib/puppet/type/file/group.rb
+++ b/lib/puppet/type/file/group.rb
@@ -11,12 +11,8 @@ module Puppet
end
def id2name(id)
- if id > 70000
- return nil
- end
- if id.is_a?(Symbol)
- return id.to_s
- end
+ return id.to_s if id.is_a?(Symbol)
+ return nil if id > Puppet[:maximum_uid].to_i
begin
group = Etc.getgrgid(id)
rescue ArgumentError
@@ -73,7 +69,17 @@ module Puppet
@method = :chown
end
- return stat.gid
+ currentvalue = stat.gid
+
+ # On OS X, files that are owned by -2 get returned as really
+ # large GIDs instead of negative ones. This isn't a Ruby bug,
+ # it's an OS X bug, since it shows up in perl, too.
+ if currentvalue > Puppet[:maximum_uid].to_i
+ self.warning "Apparently using negative GID (%s) on a platform that does not consistently handle them" % currentvalue
+ currentvalue = :silly
+ end
+
+ return currentvalue
end
# Determine if the group is valid, and if so, return the GID
diff --git a/lib/puppet/util/posix.rb b/lib/puppet/util/posix.rb
index c518a8797..cc0340ef7 100755
--- a/lib/puppet/util/posix.rb
+++ b/lib/puppet/util/posix.rb
@@ -13,7 +13,7 @@ module Puppet::Util::POSIX
end
prefix = "get" + space.to_s
if id.is_a?(Integer)
- if id > 1000000
+ if id > Puppet[:maximum_uid].to_i
Puppet.err "Tried to get %s field for silly id %s" % [field, id]
return nil
end
@@ -40,7 +40,7 @@ module Puppet::Util::POSIX
end
if id.is_a?(Integer)
integer = true
- if id > 1000000
+ if id > Puppet[:maximum_uid].to_i
Puppet.err "Tried to get %s field for silly id %s" % [field, id]
return nil
end