Search code examples
bashcygwindoxygenjob-scheduling

Bash screwing up execution order?


I'm generating some documentation using doxygen, which generates a lot of files in a folder.

So as not to have to wait for the removal of the previous folder, I decided to move the folder in the current process, delete that moved folder in a separate process and then create the doxygen documents. Except what happens is that the moved folder is still being reference by doxygen. Here is the code:

mv doxygen/ doxygen.tmp
rm -rf doxygen.tmp&
doxygen Doxyfile

I originally had this on one line, but putting it into a script file on multiple lines like this didn't make a difference.

What could be causing the issue? Could it be caused by a cygwin bug? Or am I missing something?

NOTE: The doxygen used is the one for windows, not cygwin. I'm only using cygwin for job control. The windows one is faster due to not using fork which is an expensive emulation on cygwin.

EDIT: Both the windows and the cygwin version of doxygen show the following which I didn't notice before:

windows:

...
Searching for files in directory C:/cygwin/home/Adrian/Projects/genLang
Searching for files in directory C:/cygwin/home/Adrian/Projects/genLang/doxygen
Searching for files in directory C:/cygwin/home/Adrian/Projects/genLang/tmpaaaa
Searching for files in directory C:/cygwin/home/Adrian/Projects/genLang/tmpaaaa/html
Searching for files in directory C:/cygwin/home/Adrian/Projects/genLang/tmpaaaa/html/d0
...

cygwin:

...
Searching INPUT for files to process...
Searching for files in directory /home/Adrian/Projects/genLang
Searching for files in directory /home/Adrian/Projects/genLang/doxygen
Searching for files in directory /home/Adrian/Projects/genLang/tmpaaaa
Searching for files in directory /home/Adrian/Projects/genLang/tmpaaaa/html
Searching for files in directory /home/Adrian/Projects/genLang/tmpaaaa/html/d2
...

Solution

  • I figured out the issue.

    The problem isn't that the inode is being held or bash is screwing up, but that doxygen is recursively searching the directory for files to document. Since the documentation is being put in the same directory as the source, it looks in the documentation directory for stuff to document, which are being deleted, resulting in errors. Adding this:

    EXCLUDE_PATTERNS       = doxygen*
    

    or moving the doxygen document directory to another path location fixes the issue.