rS366466 fixed a subtle bug by stripping the trailing \n appended to the output of the popen("cd %s && pwd -P", p->srcdir) call (pardon the pseudo-C syntax).
Looks like the whole point of this call is to resolve the path to the p->srcdir which may contain symlinks. Consider replacing this logic with a single realpath(3) call which avoids spawning a shell, explicit reading from FILE *f with fgets(3), and strdup(3).