Bug#1034547: manpages-dev: *stat might return EOVERFLOW also for time related fields

2023-04-19 Thread Uwe Kleine-König
Hello,

I did some more research about this issue, so I'm adding some more
information.

On Mon, Apr 17, 2023 at 11:46:38PM +0200, Uwe Kleine-König wrote:
> Package: manpages-dev
> Version: 6.03-1
> Severity: normal
> X-Debbugs-Cc: uklei...@debian.org
> 
> Hello,
> 
> the manpage for stat, fstat, lstat and fstatat specify that the error
> EOVERLFLOW means:
> 
>   pathname or fd refers to a file whose  size,  inode  number,  or
>   number  of  blocks  cannot  be represented in, respectively, the
>   types off_t, ino_t, or blkcnt_t.  This error can occur when, for
>   example,  an  application  compiled on a 32-bit platform without
>   -D_FILE_OFFSET_BITS=64 calls stat() on a file whose size exceeds
>   (1<<31)-1 bytes.
> 
> However at least in libc6-2.35 and later EOVERFLOW is also returned if
> st_atim.tv_sec, st_mtim.tv_sec or st_ctim.tv_sec don't fit into an
> int32_t on platforms with __TIME_SIZE == 32.

This happens since commit 4c4e90ccf8e4 ("linux: Implement 
fstatat with __fstatat64_time64") in glibc, that's between 2.33.9000 and
2.34. Commit aa03f722f3b994aaf81e72a8904bf33196780930 that was added for
2.33 is also slightly relevant (for platforms with LFS but 32 bit
time_t).

There are a few more calls that can return an undocumented EOVERFLOW:

 - clock_gettime
   (since commit ec138c67cbda ("sysdeps/clock_gettime: Use clock_gettime64 if 
avaliable")
   that is already in glibc 2.31)

 - ftime
   (since commit 5d8aa97da233 ("time: Add 64-bit time_t support for ftime")
   that is included in glibc 2.33)

 - gettimeofday
   (since commit 7455b700279e ("y2038: linux: Provide __gettimeofday64 
implementation")
   that is included in glibc 2.31)

 - sched_rr_get_interval
   (since commit b112f53e9d0f ("y2038: linux: Provide __sched_rr_get_interval64 
implementation")
   that is included in glibc 2.32)

 - time
   (since commit 75c4044b9a49 ("y2038: linux: Provide __time64 implementation")
   included in glibc 2.33)

 - timespec_get
   (since commit f1c314d27552 ("y2038: linux: Provide __timespec_get64 
implementation")
   included in glibc 2.32)
   I didn't find documenation about this function in manpages-dev, seems
   to have appeard for isoc11.

Best regards
Uwe

-- 
Pengutronix e.K.   | Uwe Kleine-König|
Industrial Linux Solutions | https://www.pengutronix.de/ |


signature.asc
Description: PGP signature


Bug#1034547: manpages-dev: *stat might return EOVERFLOW also for time related fields

2023-04-17 Thread Uwe Kleine-König
Package: manpages-dev
Version: 6.03-1
Severity: normal
X-Debbugs-Cc: uklei...@debian.org

Hello,

the manpage for stat, fstat, lstat and fstatat specify that the error
EOVERLFLOW means:

  pathname or fd refers to a file whose  size,  inode  number,  or
  number  of  blocks  cannot  be represented in, respectively, the
  types off_t, ino_t, or blkcnt_t.  This error can occur when, for
  example,  an  application  compiled on a 32-bit platform without
  -D_FILE_OFFSET_BITS=64 calls stat() on a file whose size exceeds
  (1<<31)-1 bytes.

However at least in libc6-2.35 and later EOVERFLOW is also returned if
st_atim.tv_sec, st_mtim.tv_sec or st_ctim.tv_sec don't fit into an
int32_t on platforms with __TIME_SIZE == 32.

Best regards
Uwe

-- System Information:
Debian Release: 12.0
  APT prefers testing-security
  APT policy: (700, 'testing-security'), (700, 'testing-debug'), (700, 
'stable-security'), (700, 'stable-debug'), (700, 'testing'), (700, 'stable'), 
(600, 'unstable'), (500, 'unstable-debug'), (500, 'stable-updates'), (500, 
'oldstable-updates'), (500, 'oldstable-debug'), (500, 'oldoldstable'), (500, 
'oldstable'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 6.1.0-6-amd64 (SMP w/4 CPU threads; PREEMPT)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), 
LANGUAGE=en_US:en
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages manpages-dev depends on:
ii  manpages  6.03-1

manpages-dev recommends no packages.

Versions of packages manpages-dev suggests:
ii  man-db [man-browser]  2.11.2-2

-- no debconf information