Some ELF programs/shared libraries are sparse.
E.g. on x86-64 if -Wl,-z,relro is used, most of the shared libraries
have around 1MB of zeros in the middle.
$ rpm -qf --qf '%{name}-%{version}-%{release}.%{arch}\n' /usr/lib64/gconv/IBM904.so
glibc-2.3.3-37.x86_64
$ cp -a --sparse=always /usr/lib64/gconv{,.new}
$ du -sk /usr/lib64/gconv{,.new}
197972 /usr/lib64/gconv
6368 /usr/lib64/gconv.new
Either rpm could do what e.g. cpio --sparse does when unpacking,
or it could special case just ELF files which have sufficiently big
gap between PT_LOAD segments.
> Special handling for PT_LOAD and elf within cpio unpacking
> is almost certainly not the right approach.
If you don't want to do this, it is required that you record somehow
somewere in the .rpm file which parts of the original files have been
sparsely allocated. The problem is that you in general cannot just
force every file to be sparse. There are noticeable difference: the
file layout will be non-sequential in some cases (-> performance), or
no disk space can be allocated for a file once data is written to the
sparse area.
On the o ther hand, these issues will never pop up with executables.
So it makes sense to treat them special if you don't want to do it
100% right.
NEEDINFO, I know what to do in rpm, but perhaps installing
all executables sparsely needs to be carefully thought through
before attempting an implementation.
I've never seen any unix user who was not surprised by, say,
cp -R /usr /var/tmp
when there are sparse files that are involved,
one's disk space mysteriously vanishes. And yes I know
there are options to handle sparse files correctly, I
just don't believe those options are widely known or used.
Sure there's no problem installing elf files sparsely in rpm.
The problem is the change when users do "cp -R" or any other
command that does not copy files sparsely. Disk space can/will
be used when sparse blocks are filled in, that is invariably
surprising to end-users.
Again, not my call. You want sparse file handling in rpm, it's
easier to implement than to discuss the merits of sparse files.
Off to distribution, please attach to some tracking bug so that
I have a clue when and where sparse file rpm installs are desired.
Some ELF programs/shared libraries are sparse. -%{version} -%{release} .%{arch} \n' /usr/lib64/ gconv/IBM904. so 3.3-37. x86_64 gconv{, .new} gconv{, .new} gconv.new
E.g. on x86-64 if -Wl,-z,relro is used, most of the shared libraries
have around 1MB of zeros in the middle.
$ rpm -qf --qf '%{name}
glibc-2.
$ cp -a --sparse=always /usr/lib64/
$ du -sk /usr/lib64/
197972 /usr/lib64/gconv
6368 /usr/lib64/
Either rpm could do what e.g. cpio --sparse does when unpacking,
or it could special case just ELF files which have sufficiently big
gap between PT_LOAD segments.