Closed djberg96 closed 2 years ago
Seems an ancient feature.
https://github.com/ruby/ruby/commit/9bf9b3ef95e5a699b931435f482087c57439eda3
But it's never been properly specified - see here it specifies that it raises an error if not given an integer, but then also specifies that you can't set it to root
, using the string, but in order to trigger an unrelated error.
Implementation would go here.
Should be relatively easy to fix, could be a good beginner project. First thing would be specifications and then an implementation.
Converting the user name to a uid can be done with Etc.getpwnam(user).uid
, which is what fileutils does:
https://github.com/oracle/truffleruby/blob/0e730617b83d1007818ecc7452933e4a54a8832b/lib/mri/fileutils.rb#L1110-L1111
That means it needs require 'etc'
but that seems fine since it's a rarely-used method.
Note that Process.egid=
has the same issue.
Looks like the issue is fixed and the PR is merged.
Ruby 3.0.2 allows a string for Process.euid=, and will (I assume) do a user lookup in that case:
But using Truffleruby 22.0.0.2: