Bug 10617 - lseek not receiving arguments properly
lseek not receiving arguments properly
Status: RESOLVED INVALID
Product: Samba 4.1 and newer
Classification: Unclassified
Component: libsmbclient
unspecified
All All
: P5 normal
: ---
Assigned To: Samba QA Contact
Samba QA Contact
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2014-05-19 00:24 UTC by kyleedwardsny
Modified: 2014-10-13 10:48 UTC (History)
0 users

See Also:


Attachments
C program to reproduce the bug (998 bytes, text/x-csrc)
2014-05-19 00:25 UTC, kyleedwardsny
no flags Details
Debug patch to show the whence value (421 bytes, patch)
2014-05-19 00:26 UTC, kyleedwardsny
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description kyleedwardsny 2014-05-19 00:24:11 UTC
I've encountered a very bizarre and unusual bug in libsmbclient. Arguments are not being properly passed into SMBC_lseek_ctx. The bug can be reproduced by running the attached C program.

Expected output from the program:

Return value: 0
Error: Success

Actual output from the program:

Return value: 13
Error: Invalid argument

In addition, when I apply the attached patch, I see the following:

Whence: 139863400

That value changes every time, but I'm expecting it to be 0.

I have seen this happen on Ubuntu, Fedora, Linux Mint, and a copy of libsmbclient that I built from scratch.
Comment 1 kyleedwardsny 2014-05-19 00:25:05 UTC
Created attachment 9951 [details]
C program to reproduce the bug
Comment 2 kyleedwardsny 2014-05-19 00:26:26 UTC
Created attachment 9952 [details]
Debug patch to show the whence value
Comment 3 kyleedwardsny 2014-05-19 02:06:28 UTC
OK, I have some new information about this bug. I've determined that my C program and libsmbclient disagree about the size of off_t. My program thinks it's 4 bytes, and the library thinks it's 8. What could cause this? Is the library redefining off_t somewhere? Or somehow setting it to 64-bit?
Comment 4 kyleedwardsny 2014-05-19 12:27:35 UTC
Never mind, it seems that I've been tripped up by Large File Support. I did not realize that was not enabled by default in the compiler.