Opened 5 months ago
Closed 5 months ago
#23276 closed defect (fixed)
ruby installs files owned by root in user dir
| Reported by: | pierre | Owned by: | blfs-book |
|---|---|---|---|
| Priority: | normal | Milestone: | 13.1 |
| Component: | BOOK | Version: | git |
| Severity: | medium | Keywords: | |
| Cc: |
Description (last modified by )
To reproduce:
- use a terminal and cli (no graphical environment, since this one would create
~/.local/share) - be logged in as a user (not root)
rm -r ~/.local- build ruby with book instructions
- after
sudo -E make install, dols -al ~/.local
Then .local is owned by root, and contains a share (empty) directory owned by root.
Change History (4)
comment:1 by , 5 months ago
| Description: | modified (diff) |
|---|
comment:2 by , 5 months ago
comment:3 by , 5 months ago
I think we should recommend to use sudo -E -H instead of just sudo -E in the note for sudo configuration. But we might be concerned about creating files in /root directory...
The code creating this directory seems to be in .bundle/gems/rdoc-7.0.3/lib/rdoc.rb:
[...]
##
# Searches and returns the directory for settings.
#
# 1. <tt>$HOME/.rdoc</tt> directory, if it exists.
# 2. The +rdoc+ directory under the path specified by the
# +XDG_DATA_HOME+ environment variable, if it is set.
# 3. <tt>$HOME/.local/share/rdoc</tt> directory.
#
# Other than the home directory, the containing directory will be
# created automatically.
def self.home
rdoc_dir = begin
File.expand_path('~/.rdoc')
rescue ArgumentError
end
if File.directory?(rdoc_dir)
rdoc_dir
else
require 'fileutils'
begin
# XDG
xdg_data_home = ENV["XDG_DATA_HOME"] || File.join(File.expand_path("~"), '.local', 'share')
unless File.exist?(xdg_data_home)
FileUtils.mkdir_p xdg_data_home
end
File.join xdg_data_home, "rdoc"
rescue Errno::EACCES
end
end
end
[...]
(I'm not a ruby expert but the code seems to create ~/.local/share if it does not exist)
We may want to use:
XDG_DATA_HOME=/tmp make install
(with a command explanation of course)
Note:
See TracTickets
for help on using tickets.

Note that with
sudo make install, the .local directory is created in /root. But HOME is passed to sudo by sudo -E. So more a problem of sudo configuration...