[Systrace] filename normalisation breaks POSIX

Nikolay Sturm sturm+systrace at sec-tud.de
Tue Jan 20 22:29:20 EST 2004


Hi!

Different system functions deal differently when presented with empty
strings as pathnames. While, for example dirname() translates an empty
string to ".", at least stat() should not do so but return ENOENT.

systrace does not distinguish between these cases and happily rewrites
"" to "." in all cases, breaking stat() and thus test(1). No idea what
else breaks.

Running the following test case with and without systrace shows the
problem. (OpenBSD-current, in case it matters :)

#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>

int
main(void)
{
	struct stat sb;
	int err;

	err=stat("", &sb);
	printf("%d\n", err);
	
	return 0;
}



More information about the systrace mailing list