Hi guys, I have a question. Recently when I tested my package manager write in Crystal , I noticed if the files my package manager try to move are mounted in tmpfs like this:
[!] Failed to move /tmp/ism/builtsoftwares/KdeSoftwares-Main/Dolphin/23.8.0/usr/lib/libdolphinvcs.so.5 to /usr/lib/libdolphinvcs.so.5
[!]
Error opening file with mode 'r': '/tmp/ism/builtsoftwares/KdeSoftwares-Main/Dolphin/23.8.0/usr/lib/libdolphinvcs.so.5': No such file or directory
And the function called from my software:
def runSystemCommand(command : String, path = Ism.settings.installByChroot ? "/" : Ism.settings.rootPath, environment = Hash(String, String).new, environmentFilePath = String.new) : Process::Status
environmentCommand = String.new
if environmentFilePath != ""
environmentCommand = "source \"#{environmentFilePath}\" && "
end
environment.keys.each do |key|
environmentCommand += " #{key}=\"#{environment[key]}\""
end
Ism.recordSystemCall(command, path, environment)
if Ism.settings.installByChroot
chrootCommand = <<-CODE
#!/bin/bash
cd #{path} && #{environmentCommand} #{command}
CODE
process = runChrootTasks(chrootCommand)
else
process = Process.run( command,
output: :inherit,
error: :inherit,
shell: true,
chdir: (path == "" ? nil : path),
env: environment)
end
return process
end
def moveFile(path : String, newPath : String)
requestedCommands = "mv #{path} #{newPath}"
process = runSystemCommand(requestedCommands)
if !process.success?
Ism.notifyOfRunSystemCommandError(requestedCommands)
Ism.exitProgram
end
end
Your question seems more related to Linux systems than to Crystal, which might be why you’re not getting many replies. I wasn’t sure either, so I asked ChatGPT for some insight. I know it can be a bit annoying when people share AI-generated answers, so I hope you don’t mind. Here’s what it suggested:
It might be due to the chroot environment affecting access to /tmp or /var/tmp. Since chroot environments can’t access files outside their own directory structure, the files in /tmp might not be available inside the chroot. You might want to check if those directories are properly mounted within the chroot.
Trivia
It’s easy to download a Discourse discussion in Markdown text format. You can easily download the Markdown text for this page from the following URL.