Subject: bug#79266: Replacement (substitution) variable references not supported in TESTS

From: Karl Berry <[email-masked]>
Date: Mon, 18 Aug 2025 15:37:58 -0600

Hi Richard,

    I did not see any mention of this issue in the manual or existing bug 
    reports.  Please let me know if I overlooked something.

Pretty sure you haven't overlooked anything. Don't recall seeing
any mention of this before.

    I will send a patch adding test cases as soon as I know what this
    bug's number will be.  

79266, evidently.

    I am willing to propose patches to fix this; 

Thanks much! 

    a pointer to where in the code this bug lives would be appreciated.

I took a quick look at bin/automake.in for regexps using %,
searching for "s/.*%". The one that looks suspicious to me is around
line 6966, in the fn preprocess_file:
  # Substitute Automake template tokens.
  s/(?: % \?? [\w\-]+ %
      | \? !? [\w\-]+ \?
    )/transform($&, %transform)/gex;

which looks like it's replacing more or less any word chars between two
% (or ?) signs with the result of calling the (passed) transform fn. 

What exactly these "templates" and "transformations" are about, I'm
afraid I have no good idea. We'll have to dig in ... I hope you can, as
it will be a couple weeks (at best) before I can take any serious look
at the code.

Thanks again,
Karl