0

I need to execute a compiled program which hardcodes various filesystem paths, with different values for those paths. For practical reasons, adjusting the source code of the program and recompiling it is not an option. Additionally, is is not acceptable to replace the hardcoded files with symlinks, or change the hardcoded files in any other way.

I can only think of two solutions: LD_PRELOAD hooks and patching the binary. The former seems easier and more reliable. Is there any better solution, or perhaps some existing software aiming to solve this problem?

P.S. I am aware I'm speaking of horrible hacks. The hardcoded software in question is widely distributed on Linux distributions, but it appears completely unmaintained, and I don't see any chance of getting a patch in, let alone having it hit distros, in the time I find acceptable.

Ambroz Bizjak
  • 7,809
  • 1
  • 38
  • 49
  • Rebuild it yourself... assuming it's open source, of course. – Jim Garrison Oct 08 '13 at 21:13
  • @JimGarrison Please read the whole question... "For practical reasons, adjusting the source code of the program and recompiling it is not an option." It is open source, I just consider it too impractical for users of my software (including me) to have to do this. Especially since the procedure is different for every Linux distro. – Ambroz Bizjak Oct 08 '13 at 21:15
  • There is no easy answer here. Your requirements close off all the possible avenues. The only real solution is to find all the hardcoded strings and change the software to read the values from a parameter file. Then submit the patch to the project for the benefit of future users. This is the whole point of open-source. Also, note that you haven't even told us what O/S project you're talking about. That might help find a solution as well. – Jim Garrison Oct 09 '13 at 01:38
  • You've ruled out soft links, but what about hard links? Unfortunately, without more details about the problem, it's hard to understand what your options are. I assume you're trying to distribute software which relies on something else... – aleatha Oct 09 '13 at 15:09

0 Answers0