automake
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: whitespaces truncated [Automake 1.10b test release]


From: Ralf Wildenhues
Subject: Re: whitespaces truncated [Automake 1.10b test release]
Date: Tue, 28 Apr 2009 19:51:49 +0200
User-agent: Mutt/1.5.18 (2008-05-17)

Hi Jan,

* Jan Engelhardt wrote on Tue, Apr 28, 2009 at 10:21:08AM CEST:
> I also had a look at the automake source, and I rather find
> this the problem (in lib/Automake/Variable.pm):
> 
>       elsif ($def->pretty == VAR_PRETTY)
> [...]
>           my $wrap = makefile_wrap ("$str$name $equals", "$str\t",
>                                     split (' ', $val));
> 
> Is that actually valid to split on any whitespace? In shell that would 
> clearly be a violation (when there are quotes), but what about make?

Well, essentialy what make does is backslash newline removal and
$(variable) replacement, before interpreting prerequisite lists or
passing rule commands to the shell.  Using quotes in target or
prerequisites is not portable, so there is little point in preserving
them there anyway.  For everything else, i.e., variables that will be
expanded as part of rule commands passed to the shell, if you find any
that are expanded as VAR_PRETTY, please report an example so we can look
into fixing it.

However, note that automake will treat lines longer than some maximum
length as VAR_PRETTY, in order to wrap them; cf. this comment in
automake.in:read_am_file:

            # Normally we try to output variable definitions in the
            # same format they were input.  However, POSIX compliant
            # systems are not required to support lines longer than
            # 2048 bytes (most notably, some sed implementation are
            # limited to 4000 bytes, and sed is used by config.status
            # to rewrite Makefile.in into Makefile).  Moreover nobody
            # would really write such long lines by hand since it is
            # hardly maintainable.  So if a line is longer that 1000
            # bytes (an arbitrary limit), assume it has been
            # automatically generated by some tools, and flatten the
            # variable definition.  Otherwise, keep the variable as it
            # as been input.
            $var_look = VAR_PRETTY if length ($last_var_value) >= 1000;


You cannot expect automake to interpret shell quoting, that is virtually
impossible to do correctly; imagine ugly constructs like this one which
are nonetheless valid makefiles:

  v = "
  w = $(v) quoted or not?"

  all:
          echo $(w)

or @substituted@ values.

Cheers,
Ralf




reply via email to

[Prev in Thread] Current Thread [Next in Thread]