This is the mail archive of the cygwin@sourceware.cygnus.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

B19.1: make $(shell) output crlf problem with perl


I believe I have found a bug in GNU make in cygwin32 b19.1.  I'm running
under NT 4.0 service pack 3.

Bug summary: $(shell) constructs that run perl scripts return strings that
end in \r, which they shouldn't.

Consider this Makefile:

    VARIABLE1=$(shell script1)
    VARIABLE2=$(shell script2)
    VARIABLE2=$(shell script3)

    test1:
    	echo $(VARIABLE1)/bar

    test2:
    	echo $(VARIABLE2)/bar

    test3:
    	echo $(VARIABLE3)/bar

And this shell script called script1:

    #! /bin/sh
    echo foo

And this perl script called script2:

    #! /usr/local/bin/perl
    print "/foo\n";

And this c program called script3.c:

    main () { printf("/foo\n"); }

Script1 has this output:

    bash-2.01$ script1 | od -c
    0000000   /   f   o   o  \r  \n
    0000006

and script2 has this output:

    bash-2.01$ script2 | od -c
    0000000   /   f   o   o  \r  \n
    0000006

and script3 has this output:

    bash-2.01$ script3 | od -c
    0000000   /   f   o   o  \r  \n
    0000006

Then consider what happens when you type "make test1", "make test2", and  "make test3":

    bash-2.01$ make test1
    echo /foo/bar
    /foo/bar
    bash-2.01$ make test2   
    /bar /foo
    /bar
    bash-2.01$ make test3
    echo /foo/bar
    /foo/bar
    bash-2.01$

If you look a little closer:

    bash-2.01$ make test2 | od -c
    0000000   e   c   h   o       /   f   o   o  \r   /   b   a   r  \r  \n
    0000020   /   f   o   o  \r   /   b   a   r  \r  \n
    0000033
    bash-2.01$

Something different happens when make grabs the output of script2 than when
it calls script1 or script3.  It appears that in one case, it removes the
\r\n and in the other only removes the \n leaving the \r at the end of the
variable.

The fact that only "test2" failed implies this is a problem with perl, but I
don't think it is, since it is clear that the perl in this case is returning
something with a \r both inside and outside the make environment.

The perl for Win32 we're using is Perl 5.004 from Hip Communications and was downloaded
from http:/www.perl.com/CPAN-local/ports/winNT/Standard/x86/perl5.00402-bindist04-bc.tar.gz.

I am not on the gnu-win32 mailing list.

                       --Jim Dempsey--
                         jjd@jjd.com
                       http://jjd.com/
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]