Skip to content

package installation needs the file utility on Unix

3 messages · Tomas Kalibera, Gábor Csárdi

#
The new staged package installation shells out to the 'file' utility
on Unix systems:
https://github.com/wch/r-source/blob/31ee14c620eb1b939acd322f3b5617f998aab8e8/src/library/tools/R/install.R#L578

Although 'file' is usually present on most Unix systems, it might be
missing from small Docker containers, where the aim is to make the
container as small possible. The magic file of 'file' is about 5MB, so
that is significant in this case.

R uses 'file' to decide if a .so, .dll, etc. file is indeed a shared
library, and (as I understand) if it is, it then goes on to try to fix
the hardcoded installation path in it, using an os specific tool.

As the second part needs to handle errors anyway, I wonder if it would
make sense to skip the 'file' call completely, after all it is quite
unlikely that a .dll or .so, etc. file is _not_ a shared library, and
even if it is not, the errors will be caught later.

Thanks, Gabor
#
Well, this only applies to source installs of packages that have some 
files with the special extension, so on systems where a compiler 
toolchain needs to be installed, so the image cannot be really tiny, 
anyway. But ok, I've made stage install use "file" only when it is 
available. When it isn't and some file with extension sl, so, dylib or 
dll in the package installation is not in fact a shared object, one will 
get a number of error messages from the respective tools, but the 
installation passes. Currently on Linux this is the case of RcppParallel 
and FastRWeb.

Tomas
On 3/7/19 11:57 PM, G?bor Cs?rdi wrote:
#
Thanks! Good point about the compiler toolchain.....on Alpine Linux,
which tends to be small, gcc can be less than 100MB, so still might
matter a bit....

Gabor
On Fri, Mar 8, 2019 at 1:44 PM Tomas Kalibera <tomas.kalibera at gmail.com> wrote: