R
R
redcircle2020-05-31 20:13:48
linux
redcircle, 2020-05-31 20:13:48

How to change the path to a file that is opened by a Linux application?

There is an application (no source, an executable file, let's call it "bin-py"), a specialized Python interpreter. It runs a Python script (let's call it "/mnt/ro/ro.py"), which is located on the read-only FS.

You need to add debug printing to this Python script "/mnt/ro/ro.py". To do this, this bin-py application should open instead of the script "/mnt/ro/ro.py" my script "/home/red/my.py", where there are the necessary changes.

I had an idea to do this via ltrace or strace so that they change the "filename" argument to "/home/red/my.py" to the "open" system call when "/mnt/ro/ro.py" is passed to it .
But ltrace/strace doesn't seem to have such functionality out of the box.
You can try to add such functionality to these utilities yourself, but it may be faster to take a ready-made utility, if it exists.

How can such a change be made?
There are no root rights on this machine.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrey Barbolin, 2020-06-01
@dronmaxman

https://www.geeksforgeeks.org/soft-hard-links-unix...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question