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)
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 rep...@bugs.python.org
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 rep...@bugs.python.org
Ricky Ng-Adam rnga...@lophilo.com 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
Ross Lagerwall rosslagerw...@gmail.com 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
Sergei Lebedev superbo...@gmail.com 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
Changes by STINNER Victor victor.stin...@haypocalc.com:
--
nosy: +haypo
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue12556
___
___
Charles-François Natali neolo...@free.fr 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
STINNER Victor victor.stin...@haypocalc.com 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?
--
Changes by Ralf Schmitt python-b...@systemexit.de:
--
nosy: +schmir
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue12556
___
___
Python-bugs-list
Ross Lagerwall rosslagerw...@gmail.com 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
Sergei Lebedev superbo...@gmail.com 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
Charles-François Natali neolo...@free.fr 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
New submission from Sergei Lebedev superbo...@gmail.com:
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
Changes by Antoine Pitrou pit...@free.fr:
--
nosy: +neologix, rosslagerwall
versions: +Python 3.3 -Python 2.6
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue12556
___
15 matches
Mail list logo