rsync: fix tests in Darwin sandbox#431202
Conversation
al3xtjames
left a comment
There was a problem hiding this comment.
This looks cleaner than my attempt. Thanks!
BTW, it should be possible to readd fakeroot to checkInputs (on line 56) after #427036. This should allow the chown and device tests to pass (they're skipped without it, IIRC). fakeroot also needs to set propagatedSandboxProfile allow System V IPC on Lix, since it's not allowed in the default sandbox profile.
|
Honestly, I would rather do less {
runCommandCC,
role,
}:
let
src = ''
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <sys/ipc.h>
#include <sys/msg.h>
struct message {
long type;
char text[64];
};
int main(int argc, char **argv)
{
int queue = msgget(1234, IPC_CREAT | 0666);
if (strcmp(argv[1], "server") == 0) {
if (msgsnd(queue, &(struct message){
.type = 1,
.text = "hi",
}, sizeof("hi"), 0) < 0) abort();
} else {
struct message m;
if (msgrcv(queue, &m, 64, 1, 0) < 0) abort();
puts(m.text);
}
}
'';
in
runCommandCC "sysv-ipc-test" {
sandboxProfile = "(allow ipc-sysv*)";
} ''
cc ${builtins.toFile "test.c" src}
./a.out ${role}
''It looks like |
8bb1640 to
fea9101
Compare
|
Switched to |
|
Yeah, that makes sense - that example is pretty illustrative. It seems like patching tests which fail in the sandbox (or disabling them, if that's not possible) should be preferred to setting a |
|
I think it depends – there are some cases where there doesn’t seem to be any good reason not to allow access to something by default (e.g. the OS‐provided fonts, to allow CoreText‐using tests to work), and in that case I think the default sandbox profile should be fixed but that it’s fine to use Feel free to ping me on macOS sandbox–related PRs, though my responsiveness is unreliable so no need to block on it. |
Things done
passthru.tests.nixpkgs-reviewon this PR. See nixpkgs-review usage../result/bin/.Add a 👍 reaction to pull requests you find important.