[PATCH] elfcompress: Don't rewrite file if no section data needs to be updated.

Mark Wielaard mark@klomp.org
Sun Jul 22 20:39:00 GMT 2018

Hi Igor,

On Sun, Jul 22, 2018 at 10:06:47PM +0200, Igor Gnatenko wrote:
> On Sun, Jul 22, 2018 at 5:20 PM Mark Wielaard <mark@klomp.org> wrote:
> > > However, if nothing needs
> > > compression/decompression - why to rewrite file?
> >
> > Indeed. That is why I wrote this patch. Because it might still change
> > the file. It might remove some padding between sections, correct
> > alignment of some data in the file, change permission/ownership, etc.
> >
> > In general you wouldn't want that if not necessary for (de)compression
> > of some ELF section data.
> But we want this in RPM, right?

Sorry, I don't understand what 'this' refers to.
What do you want in RPM?
I think you would never want to use --force for RPM.

> > Again that is arguably useless, so only really used for testing purposes
> > to see that elfcompress works correctly.
> >
> > > Probably we should create
> > > new option --force-on-noop or -f -f or something like that?
> >
> > If possible I would like only one option for "do something useless even
> > if not necessary".
> Can we just make it to not rewrite file if it won't be changed at all?

I believe that is what this patch does. But I might misunderstand your

Before this patch elfcompress would always rewrite/update the file even
if nothing needed to be (de)compressed. With this patch it will not
change the file if it detects nothing needs to be done.

Unless you use --force to say you really want the file to be updated
anyway even if it was already complete (de)compressed.

The idea behind the patch is that you might want to run eu-elfcompress
on everything to make sure that everything has compressed (debug) ELF
sections (or run eu-elfcompress -t none to make sure no file has). But 
if a file is already fully (de)compressed then eu-elfcompress can stop
early without needing to do any unnecessary updates.



More information about the Elfutils-devel mailing list