Bug#604928: stat.2: EOVERFLOW not only for st_size; bit/byte confusion

2012-11-11 Thread Michael Kerrisk (man-pages)
tags 604928 fixed-upstream
thanks

On Tue, Oct 23, 2012 at 1:55 AM, Simon Paillard  wrote:
> Control: -1 found 3.42-1
>
> On Thu, Nov 25, 2010 at 03:08:30PM +0100, Lionel Elie Mamane wrote:
>> stat(2) says:
>>
>> ERRORS
>>  (...)
>>EOVERFLOW
>>  (stat())  path  refers to a file whose size cannot be represented in the
>>  type off_t.  This can occur when an application compiled on a 32-bit
>>  platform without -D_FILE_OFFSET_BITS=64 calls stat() on a file whose
>>  size exceeds (2<<31)-1 bits.
>>
>> 1) It would seem to me that the condition for this to occur would be a
>>file whose size exceeds (2<<31)-1 *bytes*, not "bits".
>
> Still applicable to manpages 3.43.
>
>> 2) I got this for an overflow on st_ino (64 bit kernel, 32 bit
>>userland, CIFS mount of a Windows-served share).
>
> Confirmed with
> OpenGroup:  http://pubs.opengroup.org/onlinepubs/009695399/functions/stat.html
>[EOVERFLOW]
>   The file size in bytes or the number of blocks allocated to the file or
>   the file serial number cannot be represented correctly in the structure
>   pointed to by buf.
>
> egblic: sysdeps/unix/sysv/linux/xstatconv.c it can be st_ino, st_size or 
> st_blocks
>
>> So I'd suggest this text become something along the lines of:
>>
>>path or fd refers to a file for which the value of a field of the
>>stat structure cannot be represented in its type. This usually
>>occurs with applications compiled on a 32-bit platform without
>>-D_FILE_OFFSET_BITS=64. The most common occurrence is when such an
>>application calls stat() on a file whose size exceeds
>>(2<<31)-1 bytes; but it can also occur e.g. for the st_ino field,
>>e.g. when such an application is run on a 64 bit kernel.
>
> An other proposal attached.

Thanks Simon. I applied a modified version of your patch, as below.

Cheers,

Michael

--- a/man2/stat.2
+++ b/man2/stat.2
@@ -341,17 +341,23 @@ A component of the path prefix of
 is not a directory.
 .TP
 .B EOVERFLOW
-.RB ( stat ())
 .I path
-refers to a file whose size cannot be represented in the type
-.IR off_t .
-This can occur when an application compiled on a 32-bit platform without
+or
+.I fd
+refers to a file whose size, inode number,
+or number of blocks cannot be represented in, respectively, the types
+.IR off_t ,
+.IR ino_t ,
+or
+.IR blkcnt_t .
+This error can occur when, for example,
+an application compiled on a 32-bit platform without
 .I -D_FILE_OFFSET_BITS=64
 calls
 .BR stat ()
 on a file whose size exceeds
 .I (1<<31)-1
-bits.
+bytes.
 .SH "CONFORMING TO"
 These system calls conform to SVr4, 4.3BSD, POSIX.1-2001.
 .\" SVr4 documents additional


-- 
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Author of "The Linux Programming Interface"; http://man7.org/tlpi/


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org



Bug#604928: stat.2: EOVERFLOW not only for st_size; bit/byte confusion

2012-10-22 Thread Simon Paillard
Control: -1 found 3.42-1

On Thu, Nov 25, 2010 at 03:08:30PM +0100, Lionel Elie Mamane wrote:
> stat(2) says:
> 
> ERRORS
>  (...)
>EOVERFLOW
>  (stat())  path  refers to a file whose size cannot be represented in the
>  type off_t.  This can occur when an application compiled on a 32-bit
>  platform without -D_FILE_OFFSET_BITS=64 calls stat() on a file whose
>  size exceeds (2<<31)-1 bits.
> 
> 1) It would seem to me that the condition for this to occur would be a
>file whose size exceeds (2<<31)-1 *bytes*, not "bits".

Still applicable to manpages 3.43.
 
> 2) I got this for an overflow on st_ino (64 bit kernel, 32 bit
>userland, CIFS mount of a Windows-served share).

Confirmed with
OpenGroup:  http://pubs.opengroup.org/onlinepubs/009695399/functions/stat.html
   [EOVERFLOW]
  The file size in bytes or the number of blocks allocated to the file or
  the file serial number cannot be represented correctly in the structure
  pointed to by buf.

egblic: sysdeps/unix/sysv/linux/xstatconv.c it can be st_ino, st_size or 
st_blocks
 
> So I'd suggest this text become something along the lines of:
> 
>path or fd refers to a file for which the value of a field of the
>stat structure cannot be represented in its type. This usually
>occurs with applications compiled on a 32-bit platform without
>-D_FILE_OFFSET_BITS=64. The most common occurrence is when such an
>application calls stat() on a file whose size exceeds
>(2<<31)-1 bytes; but it can also occur e.g. for the st_ino field,
>e.g. when such an application is run on a 64 bit kernel.

An other proposal attached.

-- 
Simon Paillard
diff --git a/man2/stat.2 b/man2/stat.2
index 0b82e1d..fb2f9dd 100644
--- a/man2/stat.2
+++ b/man2/stat.2
@@ -343,15 +343,18 @@ is not a directory.
 .B EOVERFLOW
 .RB ( stat ())
 .I path
-refers to a file whose size cannot be represented in the type
-.IR off_t .
-This can occur when an application compiled on a 32-bit platform without
+refers to a file whose size, inode number, or number of blocks cannot be represented in their respective type
+.IR off_t ,
+.IR ino_t ,
+or
+.IR blkcnt_t .
+This usually occurs when an application compiled on a 32-bit platform without
 .I -D_FILE_OFFSET_BITS=64
 calls
 .BR stat ()
 on a file whose size exceeds
 .I (1<<31)-1
-bits.
+bytes.
 .SH "CONFORMING TO"
 These system calls conform to SVr4, 4.3BSD, POSIX.1-2001.
 .\" SVr4 documents additional


Bug#604928: stat.2: EOVERFLOW not only for st_size; bit/byte confusion

2010-11-25 Thread Lionel Elie Mamane
Package: manpages-dev
Version: 3.24-1
Severity: normal

stat(2) says:

ERRORS

 (...)

   EOVERFLOW
  (stat())  path  refers to a file whose size cannot be
  represented in the type off_t.  This can occur when an
  application compiled on a 32-bit platform without
  -D_FILE_OFFSET_BITS=64 calls stat() on a file whose size
  exceeds (2<<31)-1 bits.


1) It would seem to me that the condition for this to occur would be a
   file whose size exceeds (2<<31)-1 *bytes*, not "bits".

2) I got this for an overflow on st_ino (64 bit kernel, 32 bit
   userland, CIFS mount of a Windows-served share).

   So I'd suggest this text become something along the lines of:

   path or fd refers to a file for which the value of a field of the
   stat structure cannot be represented in its type. This usually
   occurs with applications compiled on a 32-bit platform without
   -D_FILE_OFFSET_BITS=64. The most common occurrence is when such an
   application calls stat() on a file whose size exceeds
   (2<<31)-1 bytes; but it can also occur e.g. for the st_ino field,
   e.g. when such an application is run on a 64 bit kernel.


-- System Information:
Debian Release: squeeze/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.32-5-amd64 (SMP w/2 CPU cores)
Locale: LANG=fr_LU.UTF-8, LC_CTYPE=fr_LU.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages manpages-dev depends on:
ii  manpages  3.24-1 Manual pages about using a GNU/Lin

manpages-dev recommends no packages.

Versions of packages manpages-dev suggests:
ii  man-db [man-browser]  2.5.7-3on-line manual pager

-- no debconf information



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org