[fwiw ...] I wonder if things would be cleaner if the path argument to start_subfile (name, dirname) was processed the same as each subfile's path (subfile->name, subfile->dirname). Otherwise it seems like a potential bug source (not necessarily now, but down the road). There (apparently) have been edits to this area of the code in the past that have introduced bugs. i.e. how about writing a utility to process name,dirname and using that utility for both the argument to start_subfile and each subfile in the comparison loop? This patch is untested, I'm just providing a definitive example of the suggestion. Another question: In the case where dirname is prepended to name, should the whole thing be passed to rewrite_source_path, instead of just dirname?