I am sandboxing R on Ubuntu 11.10 using apparmor. One thing I noticed is that for every png or pdf plot that R creates, it shows the warning:
(process:4589): GLib-WARNING **: getpwuid_r(): failed due to: Permission denied.
However, even though read access to /etc/passwd is denied, everything seems to be working perfectly fine. I do not plan to give R these permissions, as it seems unnecessary for what I want to do. However the recurring warning is somewhat annoying.
A quick grep of "getpwuid" in R/src shows three places where it is called:
r-base-2.14.2/src/main/platform.c: stpwd = getpwuid(sb.st_uid);
r-base-2.14.2/src/unix/sys-unix.c: stpwd = getpwuid(getuid());
r-base-2.14.2/src/unix/sys-unix.c: stpwd = getpwuid(geteuid());
However, it not really clear to me what this does.
Questions:
- Why does R need access to the passwd file for creating a plot?
- Is there any way I can prevent R from trying to call getpwuid_r() when writing to a png or pdf device (without recompiling R)?