os.ftruncate documentation error

Hi folks, The documentation for os.ftruncate seems a little misleading, for both 2.7[1] and 3.6[2] the docs for os.ftruncate say, "Truncate the file corresponding to file descriptor fd, so that it is at most length bytes in size." os.ftruncate is implemented on Unix as a call to ftruncate(2), the man page for which states: "The truncate() and ftruncate() functions cause the regular file named by path or referenced by fd to be truncated to a size of precisely length bytes." The distinction between 'at most' and 'precisely' is quite an important one, it's quite possible that there is some difference in behaviour on certain platforms, but if that is the case then I think the docs ought to make that clear. I'll be quite happy to submit a patch to make the docs clearer, if I can get a little direction on what sort of change would be best. Hope this helps, thanks, Richard Ipsum [1]: https://docs.python.org/2.7/library/os.html?highlight=os.ftruncate#os.ftrunc... [2]: https://docs.python.org/3.6/library/os.html?highlight=os.ftruncate#os.ftrunc...

On Sun, Feb 12, 2017, at 01:53 PM, Richard Ipsum wrote:
Hi folks,
The documentation for os.ftruncate seems a little misleading, for both 2.7[1] and 3.6[2] the docs for os.ftruncate say,
"Truncate the file corresponding to file descriptor fd, so that it is at most length bytes in size."
I just spotted https://docs.python.org/2.7/library/stdtypes.html?highlight=truncate#file.tr... so I guess I'm suggesting that this kind of statement should be included for the truncate functions in the os module as well. Thanks, Richard Ipsum
participants (1)
-
Richard Ipsum