proc is a program that ‘compiles’ Pro*C into C or C++. It’s shocking that a big company like Oracle could produce something so shoddy.

Each time the program runs, it generates three temporary files in the current directory and leaves them there! After a few builds I’ve got thousands and thousands of these files. Sometimes I get so many of them that a simple “rm *” blows up with a command line too long error.

There’s no way to convince proc to put them anywhere other than the current directory. I can’t just remove all of the temporary files every time I call the program – that breaks parallel builds where two or more procs are running at the same time. In fact there’s no easy way at all to keep my working directory clear of these bloody files.

What the hell were Oracle’s engineers thinking when they wrote this turd? Do they ever use it themselves??

MJH said,

I have to deal with this sort of thing now and again, too. Usually, I first ltrace(1) the program and see if it refers to any environment variables with names that suggest they might influence the placement of the files.

If I have no luck there, the next step is to craft up an LD_PRELOAD-able shim that, in this case, would record the filenames of the temp files as they’re created and then unlink them on exit.

Ben Aveling said,

If the names follow a regular pattern then you could automatically delete any such files that are older than an hour, a day, or whatever. Not perfect, but simple.

Alternately, you could have a check of the process table or set a flag somewhere before running a cleanup – so that if there are two compiles running in parallel, the first one does nothing and the second one cleans up everything.