Juergen Spitzmueller wrote: > the citation dialog does not list the contents of a bib file if that file > has been inserted without path (i.e. is in the texmf path). This is not > related to my latest changes.
I tried to spot the bug. This is what I have for now: InsetBibtex::getFiles calls findtexfile(ChangeExtension(tmp, "bib"), "bib"); but gets an empty result. In findtexfile (filetools.C), we have (while fil is the first member arg): string const kpsecmd = "kpsewhich " + fil; cmd_ret const c = RunCommand(kpsecmd); lyxerr[Debug::LATEX] << "kpse status = " << c.first << '\n' << "kpse result = `" << rtrim(c.second, "\n") << '\'' << endl; if (c.first != -1) return os::internal_path(rtrim(c.second, "\n\r")); else return string(); This means, for the file test.bib, "kpsewhich test.bib" is called. Now when running lyx -dbg latex, we get: kpse status = -1 kpse result = `/usr/share/texmf/bibtex/bib/base/test.bib' Bibfile: The question is now: why is kpsestatus=-1, which leeds to an empty return string, even though kpse has found the correct path? Let's have a look at RunCommand: cmd_ret const RunCommand(string const & cmd) { // One question is if we should use popen or // create our own popen based on fork, exec, pipe // of course the best would be to have a // pstream (process stream), with the // variants ipstream, opstream FILE * inf = ::popen(cmd.c_str(), os::popen_read_mode()); // (Claus Hentschel) Check if popen was succesful ;-) if (!inf) { return make_pair(-1, string()); lyxerr << "popen NOT successful!" << endl; } string ret; int c = fgetc(inf); while (c != EOF) { ret += static_cast<char>(c); c = fgetc(inf); } int const pret = pclose(inf); return make_pair(pret, ret); } Note that I have inserted a print statement to check if popen was succesful. Obviously this is the case, so pret must be -1. What does that mean (and what the heck is popen and pclose)? Thanks, Jürgen.