Hi Daniel! Thanks for trying out lbdb and reporting the issue!
On Thu, 10 Apr 2025, Daniel Gröber wrote: > I'm trying to use lbdb for Debian work, but I found some of my > queries are not returning results. Could you please be more concrete in what you executed and what your results are? To become more reproducible with your setup, I copied your ldap.rc enabled METHODS="m_ldap" and LDAP_NICKS="debian" (m_gpg heavily depends on the installed pubring). If I run $ lbdbq roland lbdbq: 8 matches $ lbdbq Roland Rosenfeld lbdbq: no matches (surprisingly, with other backends this works as expected and finds some "Roland Rosenfeld" matches, seems that I have to re-check the ldap backend. BTW: with m_gpg I have 4 matches) $ lbdbq "Roland Rosenfeld" also gives no matches (m_gpg also gives 4 matches). > - eval ${method}_query \""$@"\" >> "$collection" || true > + ${method}_query "$@" >> "$collection" || true I tried your patch with the above 3 variants and get: $ lbdbq-test roland lbdbq: 8 matches $ lbdbq-test Roland Rosenfeld lbdbq: 8 matches (seems that "Rosenfeld" is ignored here) $ lbdbq-test "Roland Rosenfeld" lbdbq: no matches Hmmm, from my point of view there is a bug in m_ldap, which should be possible to find at least one "Roland Rosenfeld" (maybe by internally fetching all "roland" and then grep for "Roland Rosenfeld" in the result). On the other hand I don't think that the behavior gets better with your patch, since searching for Roland Rosenfeld (without quotes) returns 8 Rolands, 7 of them without "Rosenfeld". Searching with quotes has the same bug as my version. So please give me a hint, how you call lbdbq (which parameters and which quoting?) and what result you are getting/expecting (especially with the m_ldap backend). > Instead I submit to you the idea to > just-not-use-eval-at-all-ever-as-it's-rarely-really-actually-needed^TM: To say the truth, I never reviewed this eval before. This was in the original lbdb package by Thomas Roessler and I always kept it without reviewing this. As you mentioned, the behavior was last changed 25 years ago... I'll have to check whether changing this will fix or break something, especially with different implementations of /bin/sh (I use dash myself, but tested your change with bash and dash without noting a behavior change). > This seems to fix my problem at least, but I'm not sure passing the > $@ args individually is the behaviour you intended? If I enter To: Roland Rosenfeld in mutt and press Ctrl-T, I expect that only "Roland Rosenfeld" is found in the results. For this $ lbdbq Roland Rosenfeld should work (otherwise it may be necessary to add some quotes around %s in muttrc set query_command="lbdbq %s" But now please give me some hint what you are executing and what you get so that I can compare this with my results and try to fix it. In the meantime I'll need to have a deeper look into mutt_ldap_query (the backend behind m_ldap), why this doesn't answer to queries with spaces (with or without quotes). Greetings Roland
signature.asc
Description: PGP signature