Open aklomp opened 10 years ago
SEEK_SET
.fcntl64(11, F_GETLK64, {type=F_UNLCK, whence=SEEK_SET, start=4294967299, len=3, pid=0})
off_t
(which is sorta worrying). However, not when I call the library from my c program.Compiled within the PHP stack, this line (hand-patched in our libsmbclient.c) gives me the large negative offset:
if ((ret = smbc_lseek(state->ctx, file, 3, (int)whence)) > -1)
But the same line in my c program is fine.
Found this while writing testcases. This innocent-looking script will generate a 4.1GB sparse file on my machine:
Expected outcome: a file of 14 bytes in size: the characters 'abcdefgh', three zero bytes, and 'foo'.
I tried unsuccessfully to reproduce this behaviour with an equivalent c program, which leads me to conclude that this is a bug in libsmbclient-php somewhere.
Makefile:
The c program outputs a file 11 bytes in size, containing the string 'abcdefghfoo'. Better, but also not what I expected.
More weirdness: in the PHP version, the lseek call returns '3'. In the c version, the lseek call returns '8'. Neither is correct from the documentation's point of view, since the return value should be the current absolute offset into the file (that is, '11').