[Ferm] $LINE variable expanded when declared
Gian Piero Carrubba
gpiero at rm-rf.it
Sat Nov 10 14:49:29 CET 2012
Hi all,
posting to the list because I didn't find an address for bug reporting.
I have a file containing definitions like the following:
15 @def &limit_by($mode, $limit) =
16 mod hashlimit
17 hashlimit-mode $mode
18 hashlimit $limit
19 hashlimit-burst $limit
20 hashlimit-name @cat(@substr($FILEBNAME, 0, 11), ':', $LINE)
21 ;
Whenever the function is invoked, $FILEBNAME is expanded to the basename
of the calling file, but $LINE is always resolved to '20', so the lineno
where it is declared instead of the lineno of the invoking script (as I
wished).
Calling the function from the same file it is defined into doesn't help
either:
$ cat test
1 @def &log($msg) =
2 LOG log-prefix @cat('calling line: ', $msg, ' - expanded line: ', $LINE);
3
4 chain OUTPUT &log($LINE);
$ /usr/sbin/ferm -n -l --slow test
/sbin/iptables -t filter -P OUTPUT ACCEPT
/sbin/iptables -t filter -F
/sbin/iptables -t filter -X
/sbin/iptables -t filter -A OUTPUT --jump LOG --log-prefix 'calling line: 4 - expanded line: 2'
This behaviour contradicts both what described in the manpage and what
reported by the patch author [0].
Ferm 2.1 (Debian sid) here, but haven't see anything related in the
commit logs I guess this also applies to trunk (maybe caused by commit
dbbab34 ?).
Ciao,
Gian Piero.
.. [0] http://foo-projects.org/pipermail/ferm/2011-March/000039.html
More information about the Ferm
mailing list