[issue12556] Disable size checks in mmap.mmap()

2014-05-12 Thread Charles-François Natali
Charles-François Natali added the comment: Scratch that. I'll try to work on a patch that doesn't break guarantees for regular files (we try to limit the possibilities of segfault). -- ___ Python tracker __

[issue12556] Disable size checks in mmap.mmap()

2014-05-12 Thread Charles-François Natali
Charles-François Natali added the comment: >From a cursory inspection, we only check the size for regular files. What exception are you seeing exactly? What does stat return on this file? -- ___ Python tracker

[issue12556] Disable size checks in mmap.mmap()

2014-05-12 Thread Josh Triplett
Josh Triplett added the comment: This rejection is indeed problematic. If mmap.mmap receives an explicit size, checking that size against stat will break on devices or special files. It's perfectly reasonable that mmap.mmap's automatic logic when passed length=0 (to map the entire file) won'

[issue12556] Disable size checks in mmap.mmap()

2012-07-27 Thread Ricky Ng-Adam
Ricky Ng-Adam added the comment: I find this resolution to rejected somewhat questionable. It has been pointed that the mmap behavior in Python differs from the behavior of the underlying mmap as defined by the system documentation. I think the incorrect assumption here is that mmap is used

[issue12556] Disable size checks in mmap.mmap()

2011-07-21 Thread Sergei Lebedev
Sergei Lebedev added the comment: > Passing mmap(2) a 0 length doesn't make much sense anyway - for example, Linux returns EINVAL. Yup, but passing mmap(2) a zero-sized file and a non-zero length works just fine. > Why do you want a mmap? Why not using a file? Because Xen requires me to mmap i

[issue12556] Disable size checks in mmap.mmap()

2011-07-21 Thread Ross Lagerwall
Ross Lagerwall added the comment: > That's what I thought, it's really uncommon: in that case, I'm > reluctant to making such a change, for the reason explained above. > Ross, Victor? Even if Linux did accept a a length of 0 (which it doesn't since 2.6.12), what would be the point? Wouldn't yo

[issue12556] Disable size checks in mmap.mmap()

2011-07-21 Thread Ralf Schmitt
Changes by Ralf Schmitt : -- nosy: +schmir ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.o

[issue12556] Disable size checks in mmap.mmap()

2011-07-21 Thread STINNER Victor
STINNER Victor added the comment: > That's what I thought, it's really uncommon: in that case, I'm > reluctant to making such a change, for the reason explained above. > Ross, Victor? Why do you want a mmap? Why not using a file? -- ___ Python track

[issue12556] Disable size checks in mmap.mmap()

2011-07-21 Thread Charles-François Natali
Charles-François Natali added the comment: > By the way, I've checked mmap(2) manpage -- it looks like the C-version has > nothing > against mmaping 0-sized files, Why does Python's `mmap` still checks file > size? It doesn't check explicitely that the size is non-0, but rather that the offset

[issue12556] Disable size checks in mmap.mmap()

2011-07-21 Thread STINNER Victor
Changes by STINNER Victor : -- nosy: +haypo ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.

[issue12556] Disable size checks in mmap.mmap()

2011-07-21 Thread Sergei Lebedev
Sergei Lebedev added the comment: > Do you have an example of a /proc entry with st_size == 0 that can be mmapped > (mapping /proc/sys/debug/exception-trace fails with EACCESS)? Yes, I've ran into the issue, while trying to mmap /proc/xen/xsd_kva, which is an interface to XenBus [1]. Unfortun

[issue12556] Disable size checks in mmap.mmap()

2011-07-21 Thread Ross Lagerwall
Ross Lagerwall added the comment: > I don't like the idea of adding an argument which doesn't have a > counterpart in the POSIX version (especially to address such corner > cases). Indeed, it seems rather messy for a corner case that may well not exist. If there are definite cases where this u

[issue12556] Disable size checks in mmap.mmap()

2011-07-15 Thread Charles-François Natali
Charles-François Natali added the comment: A couple remarks: - if st_size == 0, then you have to specify an explicit length (your example passes 0, which would fail with EINVAL without the check) - most enties in /proc don't support mmap file operation, so it's likely to fail anyway (with ENOD

[issue12556] Disable size checks in mmap.mmap()

2011-07-14 Thread Antoine Pitrou
Changes by Antoine Pitrou : -- nosy: +neologix, rosslagerwall versions: +Python 3.3 -Python 2.6 ___ Python tracker ___ ___ Python-bugs

[issue12556] Disable size checks in mmap.mmap()

2011-07-14 Thread Sergei Lebedev
New submission from Sergei Lebedev : Current `mmap` implementation raises a ValueError if a sum of offset and length exceeds file size, as reported by `fstat`. While perfectly valid for most use-cases, it doesn't work for "special" files, for example: >>> with open("/proc/sys/debug/exception-t