Skip to content
callmeej edited this page Sep 5, 2016 · 7 revisions

So how did I do it?

Why did we do it?

Can you estimate how many projects you have been a part of over past month? Is it 1, 3, 10 or 20? With a big amount of work done daily it is only natural that one would start forgetting bits and pieces about the projects that he has finished.

Particularly that reason has inspired the project. Research work involves a lot of graph generation, which includes creating small gnuplot scripts with different data sets. Often, we would lose the scripts/datasets and would spend a lot of time trying to find out which and how particular file generated a particular graph.

What is it like? How does it work?

The idea behind the project is similar to the idea of the functions in the functional languages: a particular function always produces the same output given the same input. A particular executable is going to produce the same output given that the environment is the same!

There are multiple software utilities that give similar sort of functionality (e.g. recipy), but in our case we wanted to create something that can be used regardless of the languages used and would not require us to supply a list of dependencies manually for each particular program. Also, one of the requirements was that the utility is not going to require the external db dependencies, but is going to be based on the file system.

In order to do that we need to find out the dependence of the program in the run-time. We have chosen to make use of ptrace interface - ptrace allows one process to observe/control the execution of another process. The idea is, given that a particular executable can only get information from the files/sockets (currently only files are supported) and thus we can deduce what the executable is dependent on. Given the dependency information it is possible to rebuild the environment for the particular executable.

How to use it?

The utility keeps its configuration in the ~/.sarrrc The example for the file format is available here, also, one is created by default when make is invoked with -f Makefile. Utility treats lines with a hash sign as a first character to be comments and ignores them. First two lines are directories and all the other lines are considered to be regex for the files to track. We advise to specify home directory to be listed there, as otherwise files opened from e.g. /usr/lib/ are going to be tracked as well.

Once the configuration is set up it is really simple to run it - simply take the executable and supply it with a command to execute! ./utility "command"

Once the command is executed it is possible to run ./utility -f file(can be run with -m flag to supply sha512) to output how to build a file or run ./utility -b file to build an environment where it is possible to build a file.

With this functionality it is possible to rebuild any file given that you still have the recipe after months of work!

Clone this wiki locally