[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Happy new year and new bug found in m4.
From: |
aikido87 |
Subject: |
Happy new year and new bug found in m4. |
Date: |
Mon, 2 Jan 2006 11:50:39 +0100 |
First of all, thanks for all your work, good people at gnu project.
Second, Happy New Year, also for your families.
Third, I use the version " GNU m4 1.4o" of m4. Well, now the bug.
I found a "buggy" acting of builtin "undivert" when is used to read a file.
Let's assume that the file "file.txt" has just the word "baby":
> define ('xyz' , 'undivert( file.txt)')
> I want you xyz .
=> I want you, baby .
But, if I use "xyz" as a parameter ( of an user defined or a builtin macro), m4
expands "undivert" before the macro it self, leaving the parameter "void". An
example with "ifelse":
> define (' baby', ' woman')
> I want you xyz .
=> I want you, woman .
> ifelse (include (file.txt), undivert (file.txt), ' The results of "include"
> and "undivert" is the same', ' The
results is NOT the same').
Now, I expect that simply the string "The results is NOT the same" is expanded,
since the macro "baby" is now defined.
This is, nevertheless, the output:
=> woman The result is NOT the same.
If you debug/trace, you can see it acting like:
> undivert (file.txt) ''ifelse (include (file.txt), '', . , . )
that is, "undivert" seems to be "traslated" before the macro -in this case, the
macro ifelse-, AND the macro has the second parameter -that one related to
"undivert"- void.
I tried also with "ifdef" and an user defined macro, and I saw the same acting.
I would precise that it seems to be indifferent: either I use "undivert"
directly, or I use it through a macro that calls it -like "xyz"-, the result is
the same.
On the other hand, if I use "undivert" inside a pure string, no problem at all:
it acts like I expect.
Fortunately, the builtin "include" seems to have not this problem, either used
in a pure string or as parameter of other macro.
To finish this bug segnalation, it's my pleasure giving you a little script in
m4 in wich I did take a challenge: writing a bare "shell" in m4 language (that
is: emulating "read" for INPUT in a variable, "echo" for OUTPUT, and
"comm-subst" for the " shell command substitution" -that is the result of a
command in a variable-.
I give it to you for a reason: please, try to substitute "include(.)" by
"undivert" (.)" . you'll see the bug.
(That is the way I found it).
The script is in Italian, but I think is quite auto-explicative/easy-to-follow.
Nevertheless, if you want I can translate it in English (this is not mandatory
to see the bug).
Last but not least, I would like read your opinion on a question: why GNU did
not use BSD license and created GPL license ? What's wrong with BSD license ?
You could answer about the m4 bug and the last question at address of this
e-mail or at this other address:
"vaisarger[AT]yahoo[DOT]it.
Thank you!
Vittorio Cagnetta, Italy
script_in_m4
Description: Binary data
- Happy new year and new bug found in m4.,
aikido87 <=