[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Overwriting paths in binary files

On Tue, 15 Jul 1997, Joey Hess wrote:

> David Welton wrote:
> > After packaging ircii epic (hopefully I will upload when things have
> > settled down at my new job), I have become curious about the possibility
> > of 'stomping out' paths in binary files.  Ie, instead of doing a make,
> > doing a make install directly to debian/tmp, and then replacing the bad
> > paths in the binaries.
> > 
> > I would be interested to hear others opinions on this...  it is sort of an
> > ugly thing to do, but I think having to manually copy all the files is
> > ugly as well, and introduces the possibility for error.  
> > 
> > So is there some obvious reason this should not be done?  Maybe it is not
> > very portable?
> I'm not sure I understand. What kind of makefile does the package(es) have? 
> Are you talking about doing a ./configure --prefix=debian/tmp and then you 
> can just do "make ; make install" and everything ends up in debian/tmp
> and then you have to binary edit the debian/tmp out of the paths in the
> binaries? 

> Ugly, and it's not going to work all the time. Suppose (just for the sake of
> argument) that the makefile takes the --prefix setting, and rot-13's it, and
> feeds it into the binary as a #define. Then, you wouldn't find it in the
> binary with a straightforward search and replace.

Yes, it is ugly.  So is manually cp'ing everything, in my opinion.  And
I'm not suggesting this as a general solution, but was considering the
possibility as an experiment.  Do you know if the same thing is possible
in a.out binary format?

> What I tend to do is modify the install: rule of the makefile, and insert
> $(PREFIX) before all paths, then I do "make PREFIX=debian/tmp install" to
> install into debian/tmp.

Hmm I think I see - you use PREFIX as a different variable than the
regular one that might be used?  IE, I the makefile in question has a
prefix already, so modifying it just modifies the paths in the executable,
and it doesn't work right.  You have a seperate variable that you use only
in the install portion of the makefile.  Hmm yes, that's an idea as well..
I'll look into it.  


David Welton   
davidw@efn.org  davidw@freenet.hut.fi  http://www.efn.org/~davidw
Se quest'email e` in Italiano, mi dispiace per gli errori:-) FORZA PANTANI!
			 --Debian GNU/Linux--

TO UNSUBSCRIBE FROM THIS MAILING LIST: e-mail the word "unsubscribe" to
debian-devel-request@lists.debian.org . 
Trouble?  e-mail to templin@bucknell.edu .

Reply to: