This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH 0/2] Squashing long inodes.
- From: Denis Obrezkov <reprofy at etersoft dot ru>
- To: Carlos O'Donell <carlos at redhat dot com>
- Cc: Florian Weimer <fweimer at redhat dot com>, <libc-alpha at sourceware dot org>, Paul Eggert <eggert at cs dot ucla dot edu>
- Date: Wed, 05 Mar 2014 17:32:23 +0400
- Subject: Re: [PATCH 0/2] Squashing long inodes.
- Authentication-results: sourceware.org; auth=none
- References: <1393521776-1102-1-git-send-email-reprofy at etersoft dot ru> <53104E9A dot 3040706 at redhat dot com> <5310E3B9 dot 8000406 at redhat dot com>
I understand that glibc has its own global purposes and its own view
on the problem. Let me introduce user's view.
First of all, I completely agree that programs should be compiled
with _FILE_OFFSET_BITS defined to 64. Also I believe that one day all
programs will use only proper structures for proper aims.
But unfortunately today isn't this day, probably tomorrow isn't too.
Thus we have some legacy programs which couldn't be recompiled at all
and programs which couldn't be recompiled with this flag due to their
nature(mixing 32bit and 64bit things will cause undefined behavior).
And these programs aren't work because hundreds of packages and
libraries
use stat only to make sure themselves that needed file exists. They
fail
every time when they want to checkout file's existence. I think it's
more serious bug than all the bugs which may be caused by squashing.
Also in this case(changing somehow inodes) we could take care of users
by outputting some kind of dmesg that squashing s used. So the question
is:
could you tell me what is the better way - squash or zeroing?
Even if we wouldn't do something with inode in glibc, we, simple users,
have to make our programs work. For your impartiality could I remind
you
that there are a lot of implementations of squashing inodes in the
kernel scope, e g fuse:
/*
* ino_t is 32-bits on 32-bit arch. We have to squash the 64-bit value
down
* so that it will fit.
*/
static ino_t fuse_squash_ino(u64 ino64)
{
ino_t ino = (ino_t) ino64;
if (sizeof(ino_t) < sizeof(u64))
ino ^= ino64 >> (sizeof(u64) - sizeof(ino_t)) * 8;
return ino;
}
Moreover, in some programs if inode is zero, they think that file
doesn't
exist, not the perfect way to use stat, doesn't it? So, zeroing inode
is
precisely safer way, but it also has its own minuses.
And there is one thing that I can't understand. Linux kernel has its
own
function, wrapper around stat64 for old systems, it's called
cp_old_stat.
This function has behavior similar to glibc's __xstat32_conv but it
also
outputs the warning message about old stat using. So why glibc doesn't
use it?