Kuberan Naganathan <kubi...@gmail.com> added the comment:
yes. i noticed problem on solaris on the /proc/<pid>/as file which usually
has mapped regions beyond 2^63 in most process files
On Jul 22, 2011 4:35 PM, "Charles-François Natali" <rep...@bugs.python.org>
wrote:
>
> Charles-François Natali <neolo...@free.fr> added the comment:
>
> Patch attached.
>
>> For lseek, we can rely on errno. Try something like that:
>>
>> errno = 0;
>> offset = lseek(...);
>> if (offset == (off_t)-1 && errno) /* error */
>>
>
> It's a little bit overkill :-) (for mktime, time_t can overflow easily
> on 32-bit).
>
>> We can write a test using a sparse file... Or maybe a mmap object?
>>
>
> I'm not sure it's easily testable, because it's really a corner case
> not addressed by POSIX. On my Linux box, I can't get lseek to return a
> negative value, I get EINVAL - which does make sense (the Linux kernel
> doesn't accept or return negative file offsets, see
> http://lwn.net/Articles/138063/).
>
> Kuberan, on what operating system did you notice this problem? Solaris?
>
> ----------
> keywords: +patch
> Added file: http://bugs.python.org/file22719/lseek_negative.diff
>
> _______________________________________
> Python tracker <rep...@bugs.python.org>
> <http://bugs.python.org/issue12545>
> _______________________________________
----------
Added file: http://bugs.python.org/file22721/unnamed
_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue12545>
_______________________________________
<p>yes. i noticed problem on solaris on the /proc/<pid>/as file which
usually has mapped regions beyond 2^63 in most process files</p>
<div class="gmail_quote">On Jul 22, 2011 4:35 PM, "Charles-François
Natali" <<a
href="mailto:rep...@bugs.python.org">rep...@bugs.python.org</a>> wrote:<br
type="attribution">> <br>> Charles-François Natali <<a
href="mailto:neolo...@free.fr">neolo...@free.fr</a>> added the comment:<br>
> <br>> Patch attached.<br>> <br>>> For lseek, we can rely on
errno. Try something like that:<br>>><br>>> errno = 0;<br>>>
offset = lseek(...);<br>>> if (offset == (off_t)-1 && errno) /*
error */<br>
>><br>> <br>> It's a little bit overkill :-) (for mktime,
time_t can overflow easily<br>> on 32-bit).<br>> <br>>> We can
write a test using a sparse file... Or maybe a mmap object?<br>>><br>
> <br>> I'm not sure it's easily testable, because it's
really a corner case<br>> not addressed by POSIX. On my Linux box, I
can't get lseek to return a<br>> negative value, I get EINVAL - which
does make sense (the Linux kernel<br>
> doesn't accept or return negative file offsets, see<br>> <a
href="http://lwn.net/Articles/138063/">http://lwn.net/Articles/138063/</a>).<br>>
<br>> Kuberan, on what operating system did you notice this problem?
Solaris?<br>
> <br>> ----------<br>> keywords: +patch<br>> Added file: <a
href="http://bugs.python.org/file22719/lseek_negative.diff">http://bugs.python.org/file22719/lseek_negative.diff</a><br>>
<br>> _______________________________________<br>
> Python tracker <<a
href="mailto:rep...@bugs.python.org">rep...@bugs.python.org</a>><br>>
<<a
href="http://bugs.python.org/issue12545">http://bugs.python.org/issue12545</a>><br>>
_______________________________________<br>
</div>
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com