9

In my package {bigstatsr}, I get this error for CRAN checkings when testing on Solaris (see https://www.r-project.org/nosvn/R.check/r-patched-solaris-x86/bigstatsr-00check.html).

I managed to reproduce this issue using rhub::check_on_solaris(). By default the files created were with permissions 644 because umask was set to 22.

Then, I tried to change umask to be 0, which worked and I got file permissions as 666 (see https://builder.r-hub.io/status/bigstatsr_1.0.0.tar.gz-a15ab823b9e44e6ca790ee9a143ebadb#L5816).

How I can get this error with file permissions while having permissions on this file at 666?

F. Privé
  • 11,423
  • 2
  • 27
  • 78
  • 2
    Not giving much help, but I guess that the issue is on permissions over a memory region and not on a file. You got a segmentation fault, which you usually receive when you try to read or write to memory blocks which are not owned by your application. – nicola Dec 18 '19 at 11:15
  • 1
    @nicola This is helpful. Do you mean that I'm reading outside of where I should? How could this be the case on Solaris only? – F. Privé Dec 18 '19 at 13:14
  • 1
    Yes, you are probably going outside the region you own. This results in an undefined behaviour and what happens after depends on how C/C++ compiler are implemented; it might result in nothing most of the times. Try to check with `valgrind` if that's the case (see here: http://www.hep.by/gnu/r-patched/r-exts/R-exts_87.html). Check also memory allocated on the stack (`valgrind` just checks for memory on the heap). – nicola Dec 18 '19 at 13:24

1 Answers1

1

One possibility is that you are trying to allocate large amounts of memory. I encounter a similar error on Fedora, but not Windows (I've not tried Solaris), when I attempt

int * my_array = (int*) std::calloc(x * y, sizeof(int))

and x * y * sizeof(int) + k >= 232, where k denotes a compiler-specific memory overhead that stores properties of my_array.

On Windows,

if (!my_array) std::length_error("Object too large");

fails gracefully with an error; on Fedora, I seem to encounter the 'invalid permissions' seg fault without triggering this error.

Martin Smith
  • 3,687
  • 1
  • 24
  • 51