Ralf Hildebrandt:
> * gabrielt...@gmail.com <gabrielt...@gmail.com>:
> > Hi all,
> > 
> > Im having a strange issue on a new postfix setup, when I run the command 
> > "postfix check" I receive the following error:
> > 
> > postfix: fatal: /etc/postfix/main.cf, line 30: missing '=' after attribute 
> > name: "This file lists only a subset"
> 
> Line 30 seems to contain "This file lists only a subset"

This is an easy-to-fix mis-feature in the way line numbers are
reported in error messages.

postconf reports the last line number of multi-line text, for
example:

    % cat -n /tmp/main.cf
         1  some random free text
         2    other free text
         3  name = value

    % postconf -c /tmp
    postconf: fatal: /tmp/main.cf, line 2: missing '=' after attribute
    name: "some random free text  other free text"

The fix is easy: report both the first and last line number.

    % postconf -c /tmp
    postconf: fatal: /tmp/main.cf, line 1:2: missing '=' after
    attribute name: "some random free text"

The error message is similar with commented text between bad and
good text:

    % cat -n /tmp/main.cf
         1  some random free text
         2  # some commented-out text
         3  name = value

    % postconf -c /tmp
    postconf: fatal: /tmp/main.cf, line 2: missing '=' after attribute
    name: "some random free text"

To reproduce the original problem (postconf reports a line number for
an apparently "good" parameter setting) I have to indent the "good"
setting.

    % cat -n /tmp/main.cf
         1  some random text
         2  # some comment text
         3      name = value

    % postconf -c /tmp
    postconf: fatal: /tmp/main.cf, line 3: missing '=' after attribute

With the fix to show the first AND last line number in the error
message, this would be:

    % bin/postconf -c /tmp
    bin/postconf: fatal: /tmp/main.cf, line 1:3: missing '=' after
    attribute name: "some random text    name = value"

This points out where the problem begins (line 1) and also helps
the user figure out that line 3 is not what they intended.

        Wietse

Reply via email to