This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
[PATCH] Warn about using _ino_t without -D_FILE_OFFSET_BITS=64.
- From: OndÅej BÃlka <neleai at seznam dot cz>
- To: Mike Frysinger <vapier at gentoo dot org>
- Cc: libc-alpha at sourceware dot org, Paul Eggert <eggert at cs dot ucla dot edu>, Denis Obrezkov <reprofy at etersoft dot ru>
- Date: Mon, 17 Mar 2014 18:44:52 +0100
- Subject: [PATCH] Warn about using _ino_t without -D_FILE_OFFSET_BITS=64.
- Authentication-results: sourceware.org; auth=none
- References: <1393521776-1102-1-git-send-email-reprofy at etersoft dot ru> <530F79C1 dot 2040508 at cs dot ucla dot edu> <20140305091331 dot GA6031 at domone dot podge> <5239512 dot EEmGNsN1rx at vapier>
On Tue, Mar 11, 2014 at 06:51:55AM -0400, Mike Frysinger wrote:
> On Wed 05 Mar 2014 10:13:31 OndÅej BÃlka wrote:
> > On Thu, Feb 27, 2014 at 09:45:37AM -0800, Paul Eggert wrote:
> > > Squashing an inode that way has a small chance of introducing what
> > > could be a serious bug. If glibc is going to squash them, it should
> > > do so reliably, by maintaining a table of all the inodes it's ever
> > > seen and making sure there are no collisions.
> > >
> > > Why bother to squash them at all, though? Programs that care about
> > > files should be compiled with _FILE_OFFSET_BITS defined to 64. If
> > > we're worried about programs that don't define _FILE_OFFSET_BITS, we
> > > could change glibc to default to _FILE_OFFSET_BITS=64; that's a
> > > better long-term solution anyway.
> >
> > Changing default would be better. I dig while how to do it and can not
> > find a nonugly solution. How should we do this?
>
> isn't it simply:
>
> --- a/include/features.h
> +++ b/include/features.h
> @@ -303,7 +303,7 @@
> # define __USE_LARGEFILE64 1
> #endif
>
> -#if defined _FILE_OFFSET_BITS && _FILE_OFFSET_BITS == 64
> +#if !defined _FILE_OFFSET_BITS || _FILE_OFFSET_BITS == 64
> # define __USE_FILE_OFFSET64 1
> #endif
>
>
> the glibc source files themselves seem to expect default of
> _FILE_OFFSET_BITS=32 though, so we might have to add that to default CPPFLAGS
> when building.
>
> i kind of feel like deploying this on Gentoo systems to see what breaks ;).
> -mike
Yes, it is. Could we in this release at least add this warning?
I tried to restrict warning only when _ino_t is used but warning
attribute does not apply to types and using __attribute__ ((deprecated))
would confuse users.
* dirent/dirent.h [defined __USE_XOPEN && defined __ino_t_defined
&& ! defined __USE_FILE_OFFSET64]: Add warning.
diff --git a/dirent/dirent.h b/dirent/dirent.h
index f6db6c6..35c0a93 100644
--- a/dirent/dirent.h
+++ b/dirent/dirent.h
@@ -31,6 +31,7 @@ __BEGIN_DECLS
#ifdef __USE_XOPEN
# ifndef __ino_t_defined
# ifndef __USE_FILE_OFFSET64
+# warning Please use -D_FILE_OFFSET_BITS=64 to support long files.
typedef __ino_t ino_t;
# else
typedef __ino64_t ino_t;