alire icon indicating copy to clipboard operation
alire copied to clipboard

Running `alr` in folder owner by other user raises ALIRE.CHECKED_ERROR

Open onox opened this issue 1 year ago • 3 comments

If I change the current working directory to for example / and then try to run any alr command, I get:

stderr: Cannot create temporary file

raised ALIRE.CHECKED_ERROR : alire-stored-error:1

onox avatar Jul 23 '22 08:07 onox

Thanks, there are two separate problems here:

  • [ ] Just alr shouldn't fail anywhere.
  • [ ] Temporaries require write access to the current folder, but the error should be nicer.

mosteo avatar Jul 23 '22 09:07 mosteo

Is this because of the GNAT-TEMP-000xxx.TMP files? (that seems to show up with strace)

It seems Alire.OS_Lib.Subprocess calls Create_Temp_Output_File.

An alternative is to replace this call with your own implementation to create a temp file. For Linux 3.17 with glibc 2.27, it could use memfd_create(2) (file lives in RAM), otherwise it could create a temp file in /tmp with mkstemp(3).

onox avatar Jul 23 '22 19:07 onox

Yep, we are using the GNAT temp file API. The in-memory alternative looks nice, but we would need something portable.

mosteo avatar Jul 25 '22 07:07 mosteo