Makefile: Space Character in Assignments

2009-04-01 Thread Hamed Janzadeh
Hi,

Last night I found a very cruel bug in GNU make that led to a costly
experience for me. Hence, I decided to report it and to help others not to
repeat my experiment.

In a Makefile, and in assignment operations, the space character after the
value is included to the value by `make'. Therefore, if I have an assignment
like this:

   VAR=value

where, there is a space character after the `value', then the GNU make would
translate a command like this:

   rm -rf /mydir/${VAR}/*

into:

   rm -rf /mydir/value /*

that is equal to:

   rm -rf /mydir/value  rm -rf /*

This problem is so cruel because you can not see the space character after
the `value' and it will lead to hard damages to your root partition, in case
if you are a super user. So I would be grateful if you consider that in your
next releases and inform me as well.

Thanks,
Hamed Janzadeh
Computer Engineering Department,
University of Texas, Dallas
___
Bug-make mailing list
Bug-make@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-make


Re: Makefile: Space Character in Assignments

2009-04-01 Thread Paul Smith
On Tue, 2009-03-31 at 23:59 -0500, Hamed Janzadeh wrote:
 Last night I found a very cruel bug in GNU make that led to a costly
 experience for me. Hence, I decided to report it and to help others
 not to repeat my experiment.
 
 In a Makefile, and in assignment operations, the space character after
 the value is included to the value by `make'. Therefore, if I have an
 assignment like this:

This is not a bug; it's documented behavior which is required by the
POSIX standard for make.  In fact there was just a thread about this on
the help mailing list over the weekend.

PS.  ObCaution: In general, it's not a good idea to run make as root.
Especially when you're not sure the makefile is correct.

-- 
---
 Paul D. Smith psm...@gnu.org  Find some GNU make tips at:
 http://www.gnu.org  http://make.mad-scientist.us
 Please remain calm...I may be mad, but I am a professional. --Mad Scientist


___
Bug-make mailing list
Bug-make@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-make


Re: Makefile: Space Character in Assignments

2009-04-01 Thread agentzh
2009/4/1 Hamed Janzadeh janza...@gmail.com

 This problem is so cruel because you can not see the space character after
 the `value' and


A workaround we're using is letting vim to highlight line-trailing spaces.
It should be trivial for other mature text editor as well ;)

Hope this helps,
-agentzh
___
Bug-make mailing list
Bug-make@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-make