After sqlite 3.29 -> 3.31 upgrade, we started seeing issues related to differences in /dev/null in Solaris.

Recently, O_NOFOLLOW was added to several calls into robust_open(). In that function, if the fd returned by open() is too low (in the stdio range 0-2), then it closes it, and opens /dev/null to pad out the fd's until we reach at least fd#3.

However, it uses the same flags to open /dev/null as were passed in for the database open(), resulting in O_NOFOLLOW being passed to open("/dev/null"). The issue we are seeing is that /dev/null is a symlink on Solaris, and hence this returns ELOOP, and robust_open() returns an error.

$> ls -l /dev/null
lrwxrwxrwx 1 root root 27 Feb 12 18:05 /dev/null -> ../devices/pseudo/mm@0:null

I propose to patch this one of two ways:

a) replace the flags with known hard-coded values (as there is no need to use caller-supplied flags to open /dev/null):
            -    if( osOpen("/dev/null", f, m)<0 ) break;
            +    if( osOpen("/dev/null", O_RDONLY, m)<0 ) break;

    b) mask out the O_NOFOLLOW, but allow all others to come through.
            -    if( osOpen("/dev/null", f, m)<0 ) break;
            +    if( osOpen("/dev/null", f & ~O_NOFOLLOW, m)<0 ) break;

_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to