Mailing List Archive

normalized config format?
exim -bP config

-----

^^ Is this meant to output a normalized parse of the config file?

It seems to leave certain (inconsequential?) whitespace changes in place that make it hard to compare a changeset in an automated way, e.g.:

-----
- local_parts = ${if eq{$domain}{$primary_hostname}{+path_safe_localparts}{*}}
+ local_parts = ${if eq {$domain} {$primary_hostname} {+path_safe_localparts} {*} }
-----

I’d like to compare two versions of an exim.conf file, one of which uses different spacing from the other but *should* be otherwise identical. I’d love to do a diff on the two files and see it be identical to verify that they’re the same … is there anything out there that could do this?

Thank you!

-FG
--
## List details at https://lists.exim.org/mailman/listinfo/exim-users
## Exim details at http://www.exim.org/
## Please use the Wiki with this list - http://wiki.exim.org/
Re: normalized config format? [ In reply to ]
On 05/04/2021 18:55, Felipe Gasper via Exim-users wrote:
> exim -bP config
>
> -----
>
> ^^ Is this meant to output a normalized parse of the config file?

No; that would require far more cleverness than is applied.
--
Cheers,
Jeremy

--
## List details at https://lists.exim.org/mailman/listinfo/exim-users
## Exim details at http://www.exim.org/
## Please use the Wiki with this list - http://wiki.exim.org/
Re: normalized config format? [ In reply to ]
Hi,

Felipe Gasper via Exim-users <exim-users@exim.org> (Mo 05 Apr 2021 19:55:39 CEST):
> exim -bP config
> -----
> ^^ Is this meant to output a normalized parse of the config file?

Almost. But it doesn't parse/de-parse the configuration, it simply
normalizes .includes, normalizes leading whitespace, probably removes
trailing whitespaces, I'm not sure anymore about continuation lines.

It was meant as a helper to understand complex configurations that are
built from a multitude of includes and conditionals.

> It seems to leave certain (inconsequential?) whitespace changes in place that make it hard to compare a changeset in an automated way, e.g.:
>
> -----
> - local_parts = ${if eq{$domain}{$primary_hostname}{+path_safe_localparts}{*}}
> + local_parts = ${if eq {$domain} {$primary_hostname} {+path_safe_localparts} {*} }
> -----

I understand this, but we can't do that yet and there are no plans yet to
implement it.

Best regards from Dresden/Germany
Viele Grüße aus Dresden
Heiko Schlittermann
--
SCHLITTERMANN.de ---------------------------- internet & unix support -
Heiko Schlittermann, Dipl.-Ing. (TU) - {fon,fax}: +49.351.802998{1,3} -
gnupg encrypted messages are welcome --------------- key ID: F69376CE -
Re: normalized config format? [ In reply to ]
> On Apr 5, 2021, at 4:35 PM, Heiko Schlittermann via Exim-users <exim-users@exim.org> wrote:
>
> Hi,
>
> Felipe Gasper via Exim-users <exim-users@exim.org> (Mo 05 Apr 2021 19:55:39 CEST):
>>
>> It seems to leave certain (inconsequential?) whitespace changes in place that make it hard to compare a changeset in an automated way, e.g.:
>>
>> -----
>> - local_parts = ${if eq{$domain}{$primary_hostname}{+path_safe_localparts}{*}}
>> + local_parts = ${if eq {$domain} {$primary_hostname} {+path_safe_localparts} {*} }
>> -----
>
> I understand this, but we can't do that yet and there are no plans yet to
> implement it.

Understandable.

On another note, I’ve noted via the same parse that this in exim.conf:

-----
router_home_directory = ${extract{5}{::}{${lookup{${lookup{$domain_data}lsearch{/etc/userdomains}{$value}}}lsearch{/etc/passwd}{$value}}}}
-----

… gets parsed to this:

-------
router_home_directory = ${extract{5}{::}{${lookup passwd{${lookup{$domain_data}lsearch{/etc/userdomains}{$value}}}{$value}}}}
-------

^^ Note the conversion of the first “lookup” to a “lookup passwd”.

But, if I reflow the exim.conf a bit to:

-----
router_home_directory = ${extract \
{5} \
{::} \
{${lookup \
{${lookup \
{$domain_data} \
lsearch \
{/etc/userdomains} \
{$value} \
}} \
lsearch {/etc/passwd} \
{$value} \
} } \
}
-----

… then the conversion to “lookup passwd” doesn’t happen:

-----
router_home_directory = ${extract {5} {::} {${lookup {${lookup {$domain_data} lsearch {/etc/userdomains} {$value} }} lsearch{/etc/passwd} {$value} } } }
-----

Is this an optimization of some kind in Exim, which the breaking up into multiple lines is losing?

Thank you!

-F
--
## List details at https://lists.exim.org/mailman/listinfo/exim-users
## Exim details at http://www.exim.org/
## Please use the Wiki with this list - http://wiki.exim.org/
Re: normalized config format? [ In reply to ]
>> Felipe Gasper via Exim-users <exim-users@exim.org> (Mo 05 Apr 2021 19:55:39 CEST):
>>>
>>> It seems to leave certain (inconsequential?) whitespace changes in place that make it hard to compare a changeset in an automated way, e.g.:
>>>
>>> -----
>>> - local_parts = ${if eq{$domain}{$primary_hostname}{+path_safe_localparts}{*}}
>>> + local_parts = ${if eq {$domain} {$primary_hostname} {+path_safe_localparts} {*} }
>>> -----

If it were just that I would suggest "diff -w" or one of the other
whitespace options, but I see from your next observation that that
would not be sufficient.

On Mon, 5 Apr 2021, Felipe Gasper via Exim-users wrote:
> On another note, I’ve noted via the same parse that this in exim.conf:
>
> -----
> router_home_directory = ${extract{5}{::}{${lookup{${lookup{$domain_data}lsearch{/etc/userdomains}{$value}}}lsearch{/etc/passwd}{$value}}}}
> -----
>
> … gets parsed to this:
>
> -------
> router_home_directory = ${extract{5}{::}{${lookup passwd{${lookup{$domain_data}lsearch{/etc/userdomains}{$value}}}{$value}}}}
> -------
>
> ^^ Note the conversion of the first “lookup” to a “lookup passwd”.
>
> But, if I reflow the exim.conf a bit to:
>
> -----
> router_home_directory = ${extract \
> {5} \
> {::} \
> {${lookup \
> {${lookup \
> {$domain_data} \
> lsearch \
> {/etc/userdomains} \
> {$value} \
> }} \
> lsearch {/etc/passwd} \
> {$value} \
> } } \
> }
> -----
>
> … then the conversion to “lookup passwd” doesn’t happen:
>
> -----
> router_home_directory = ${extract {5} {::} {${lookup {${lookup {$domain_data} lsearch {/etc/userdomains} {$value} }} lsearch{/etc/passwd} {$value} } } }
> -----
>
> Is this an optimization of some kind in Exim, which the breaking up into multiple lines is losing?
>
> Thank you!
>
> -F
> --
> ## List details at https://lists.exim.org/mailman/listinfo/exim-users
> ## Exim details at http://www.exim.org/
> ## Please use the Wiki with this list - http://wiki.exim.org/
>

--
Andrew C. Aitchison Kendal, UK
andrew@aitchison.me.uk
--
## List details at https://lists.exim.org/mailman/listinfo/exim-users
## Exim details at http://www.exim.org/
## Please use the Wiki with this list - http://wiki.exim.org/
Re: normalized config format? [ In reply to ]
Felipe Gasper <felipe@felipegasper.com> (Mo 05 Apr 2021 22:46:31 CEST):
>
>
> On another note, I’ve noted via the same parse that this in exim.conf:
>
> -----
> router_home_directory = ${extract{5}{::}{${lookup{${lookup{$domain_data}lsearch{/etc/userdomains}{$value}}}lsearch{/etc/passwd}{$value}}}}
> -----
>
> … gets parsed to this:
>
> -------
> router_home_directory = ${extract{5}{::}{${lookup passwd{${lookup{$domain_data}lsearch{/etc/userdomains}{$value}}}{$value}}}}
> -------
>
> ^^ Note the conversion of the first “lookup” to a “lookup passwd”.

Sure that you didn't confuse something.

Input /tmp/exim4.conf

begin routers
test:
driver = redirect
file = .forward
router_home_directory = ${extract{5}{::}{${lookup{${lookup{$domain_data}lsearch{/etc/userdomains}{$value}}}lsearch{/etc/passwd}{$value}}}}


Output of `exim -C /tmp/exim4.conf -bP config`:

# Exim Configuration (4.94-37-g062b77ca8)
# 1 "/tmp/exim4.conf"

begin routers

test:
driver = redirect
file = .forward
router_home_directory = ${extract{5}{::}{${lookup{${lookup{$domain_data}lsearch{/etc/userdomains}{$value}}}lsearch{/etc/passwd}{$value}}}}

--
Heiko
Re: normalized config format? [ In reply to ]
> On Apr 5, 2021, at 5:43 PM, Heiko Schlittermann via Exim-users <exim-users@exim.org> wrote:
>
> Felipe Gasper <felipe@felipegasper.com> (Mo 05 Apr 2021 22:46:31 CEST):
>>
>>
>> On another note, I’ve noted via the same parse that this in exim.conf:
>>
>> -----
>> router_home_directory = ${extract{5}{::}{${lookup{${lookup{$domain_data}lsearch{/etc/userdomains}{$value}}}lsearch{/etc/passwd}{$value}}}}
>> -----
>>
>> … gets parsed to this:
>>
>> -------
>> router_home_directory = ${extract{5}{::}{${lookup passwd{${lookup{$domain_data}lsearch{/etc/userdomains}{$value}}}{$value}}}}
>> -------
>>
>> ^^ Note the conversion of the first “lookup” to a “lookup passwd”.
>
> Sure that you didn't confuse something.
>
> Input /tmp/exim4.conf
>
> begin routers
> test:
> driver = redirect
> file = .forward
> router_home_directory = ${extract{5}{::}{${lookup{${lookup{$domain_data}lsearch{/etc/userdomains}{$value}}}lsearch{/etc/passwd}{$value}}}}
>
>
> Output of `exim -C /tmp/exim4.conf -bP config`:
>
> # Exim Configuration (4.94-37-g062b77ca8)
> # 1 "/tmp/exim4.conf"
>
> begin routers
>
> test:
> driver = redirect
> file = .forward
> router_home_directory = ${extract{5}{::}{${lookup{${lookup{$domain_data}lsearch{/etc/userdomains}{$value}}}lsearch{/etc/passwd}{$value}}}}

Right you are … we have an internal magic-rewriter thingie that I only just discovered.

Yay.

Thank you!

cheers,
-Felipe


--
## List details at https://lists.exim.org/mailman/listinfo/exim-users
## Exim details at http://www.exim.org/
## Please use the Wiki with this list - http://wiki.exim.org/