Jim Meyering | 9 May 2010 20:45
Gravatar

[PATCH 1/4] mkid: use ftello (not ftell) and fail if an offset is 2^32 or larger

FYI,

From eb170e813979f81b9103f51d3616de29389e4513 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering@...>
Date: Wed, 20 Jan 2010 21:31:40 +0100
Subject: [PATCH 1/4] mkid: use ftello (not ftell) and fail if an offset is 2^32 or larger

This is necessary because the internal layout requires that an
offset be representable as a 4-byte quantity.
* src/mkid.c (write_id_file): Use ftello, not ftell.
The latter would fail on files larger than 4GiB.  Now,
we still fail for such files, but use ftello instead --
and give a diagnostic.
---
 gnulib     |    2 +-
 src/mkid.c |   15 ++++++++++++---
 2 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/gnulib b/gnulib
index 0c6cf5a..880f2b6 160000
--- a/gnulib
+++ b/gnulib
 <at>  <at>  -1 +1  <at>  <at> 
-Subproject commit 0c6cf5ab43555377b99d94febb2d6f23fc3d2cb0
+Subproject commit 880f2b69df57af506439d6aaf1fe185a6f960e43
diff --git a/src/mkid.c b/src/mkid.c
index 59ac41a..b1a0fa9 100644
--- a/src/mkid.c
+++ b/src/mkid.c
 <at>  <at>  -710,14 +710,20  <at>  <at>  write_id_file (struct idhead *idhp)
(Continue reading)

Claudio Fontana | 9 May 2010 21:31
Picon

Re: [PATCH 1/4] mkid: use ftello (not ftell) and fail if an offset is 2^32 or larger

Hello Jim,

On Sun, May 9, 2010 at 8:45 PM, Jim Meyering <jim@...> wrote:
> * src/mkid.c (write_id_file): Use ftello, not ftell.

maybe a fallback to ftell should be needed in case ftello is not available?
IIRC, while maintaining idutils for a short while, I was mailed by
people using idutils with old linux versions. I don't know how old,
but..

The man page says

CONFORMING TO
       SUSv2, POSIX.1-2001.

NOTES
       These  functions  are  found  on  System  V-like systems.  They are not
       present in libc4, libc5, glibc 2.0 but are available since glibc 2.1.

Your call.. ciao,

Claudio
Jim Meyering | 9 May 2010 21:59
Gravatar

Re: [PATCH 1/4] mkid: use ftello (not ftell) and fail if an offset is 2^32 or larger

Claudio Fontana wrote:
> On Sun, May 9, 2010 at 8:45 PM, Jim Meyering <jim@...> wrote:
>> * src/mkid.c (write_id_file): Use ftello, not ftell.
>
> maybe a fallback to ftell should be needed in case ftello is not available?
> IIRC, while maintaining idutils for a short while, I was mailed by
> people using idutils with old linux versions. I don't know how old,
> but..
>
> The man page says
>
> CONFORMING TO
>        SUSv2, POSIX.1-2001.
>
> NOTES
>        These  functions  are  found  on  System  V-like systems.  They are not
>        present in libc4, libc5, glibc 2.0 but are available since glibc 2.1.

Hi Claudio,

Thanks for the review -- it's nice to know I'm not alone.

However, there's no need to worry.  Gnulib provides a replacement
ftello function precisely to accommodate such deficient systems.

Gmane