\printglossaries and friends insert the content of files created by
\null if that does not exist), see
makeglossaries initializes the respective files with
\\null\n before it executes xindy or makeindex to make really, really sure that something is inserted at the place of
\printglossaries. The documentation states that as well:
While the external files are missing, these commands will just do \null for each missing glossary to assist dic- tionary style documents that just use \glsaddall without inserting any text.
This is a problem in some situations where this
\null changes the output to the worse (e.g., glossaries: count the number of used abbreviations (i.e. those to be output by \printacronyms)).
Apparently I am not the only one noticing this caveat because someone worked around it by jumping through a few hoops: https://github.com/egraff/ult-base/blob/master/texmf-tds/tex/latex/ult-base/ult-printglossary.sty
Why does glossaries do that at all (I don't get the explanation in the manual)? Are there better workarounds?