Open andrewchambers opened 2 years ago
The symptom of this bug looks a lot like a circular dependency, which has probably confused a lot of users in the past (me included)
Hi Andrew, hi Leah,
It appeared, that I've already hit this bug in my "dev" branch, You can look at https://github.com/AndreyDobrovolskyOdessa/redo-c/commit/40b16244c04c86e8928a74404d00d43d823f20ba Seems that I was simply trying to avoid extra double-dots, but this commit seems very likely to fight the issue. As You can notice it costs additional global dnrel[] which in fact stores REDO_DIRPREFIX and then use it in write_dep(). Will it be appropriate to create the pull request?
Best regards!
The commit I've mentioned is from the stalled branch and of course needs correction. I want to note that the same filename conversion must be applied in redo_ifcreate(). As I can see in my dev branch I united later both into write_dep() with additional parameter.
Thanks Andrey, it's an unfortunate bug indeed.
I've just discovered this issue. I also observed the described behaviour.
Another thing I observed is that paths like .././projdir/text.txt
are written. The deeper the directory structure the longer and more confusing these paths will get.
I tried fixing these issues and stumbled upon a new problem:
The last dependency written, is the target itself. The path passed to write_dep
in this case is just a filname (i.e. text.txt
). Just avoiding to prepend uprel
to that, is enough to record a valid path. But if the dofile contains a call like
redo-ifchange test.meta.xml.attrs
the path passed to write_dep
is also just a filename, with the difference that it is not located in the directory of our dependency file.
To summarize: If uprel
is prepended to all paths which only consist of a filename, the path to our test.meta.xml.attrs
would be correct, but the path to the target file would be wrong. However, if uprel
is not prepended to such paths, the path to our target is correct and the path to test.meta.xml.attrs
is wrong. Perhaps a solution might be to prepend the REDO_DIRPREFIX
before passing the target to write_dep
.
I have created a small dummy project to reproduce these bugs: https://github.com/lions-tech/redo-c-testproj.
https://github.com/andrewchambers/redo-c-bug