[prev in list] [next in list] [prev in thread] [next in thread] 

List:       mingw-msys
Subject:    [Mingw-msys] Bug with backticks behaviour in mSYS?
From:       "Mark Cave-Ayland" <m.cave-ayland () webbased ! co ! uk>
Date:       2005-12-28 9:55:04
Message-ID: 200512280954.jBS9s6409549 () webbased16 ! localdomain
[Download RAW message or body]

Hi everyone,

I'm using MingW 4.1.0 with MSYS 1.0.11-2004-04-30-1.exe and
MSYSDTK-1.0.1.exe and I am experiencing strange behaviour when using
backticks to launch a program that returns the path of an executable to
stdout. What I am finding is that I am getting an extra hex character 0x01
introduced into the output stream, which causes the compile to fail when a
backticked xxx_config program is used to output a path which can be fed into
the command line for gcc.

Here is a self-contained example showing the problem. First compile the
included test.c program below using gcc:


#include <stdio.h>

main()
{
	printf("this is a test string\n");
}


$ gcc -o test test.c


The build scripts I am using as part of the package I am working with are
cross platform, and what they do is use backticks to capture the output from
various xxx_config executables and then append the link flags as required. A
simplified version of what is happening is given below:

$ echo "`./test` -lpq" &> pgconfig.out

If you try and view the resulting output using cat, then everything looks
fine on the surface, but then feeding the output into the compiler fails.
Looking closer using hexdump
(http://www.canb.auug.org.au/~millerp/hexdump.html), it appears that somehow
MingW/mSYS has inserted an extra 0x01 character at the end of the output
from the backticks, between the 0x67 and 0x20 bytes. It is this extra
character being fed to gcc which causes it not to find the path specified.

$ hexdump < pgconfig.out 
00000000: 74 68 69 73 20 69 73 20 61 20 74 65 73 74 20 73  this is a test s
00000010: 74 72 69 6E 67 01 20 2D 6C 70 71 0A              tring. -lpq.


This compares to a Linux box running FC4 which gives the following (and IMHO
correct) output:

$ hexdump < pgconfig.out
00000000  74 68 69 73 20 69 73 20  61 20 74 65 73 74 20 73  |this is a test
s|
00000010  74 72 69 6e 67 20 2d 6c  70 71 0a                 |tring -lpq.|
0000001b

Is there a way to remove the extra 0x01 character that mSYS is appending to
the backticked output, since it is causing several build scripts to fail? I
have tried searching the archives for backticks but couldn't find anything
related. Or is it that this is a known bug, and upgrading to one of the
later unstable releases will help solve this?


Many thanks,

Mark.

------------------------
WebBased Ltd
17 Research Way
Plymouth
PL6 8BT

T: +44 (0)1752 797131
F: +44 (0)1752 791023

http://www.webbased.co.uk   
http://www.infomapper.com
http://www.swtc.co.uk  

This email and any attachments are confidential to the intended recipient
and may also be privileged. If you are not the intended recipient please
delete it from your system and notify the sender. You should not copy it or
use it for any purpose nor disclose or distribute its contents to any other
person.




-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
Mingw-msys mailing list
Mingw-msys@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-msys
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic