Bug 17053 - MSYS: smiley faces appear in pkg-config output
MSYS: smiley faces appear in pkg-config output
Status: RESOLVED FIXED
Product: pkg-config
Classification: Unclassified
Component: src
unspecified
x86 (IA32) Windows (All)
: medium major
Assigned To: Tollef Fog Heen
:
: 48663 50677 (view as bug list)
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2008-08-09 17:49 UTC by Sam Thursfield
Modified: 2012-11-01 02:07 UTC (History)
2 users (show)

See Also:
i915 platform:
i915 features:


Attachments
Patch reverting 25e8ca84acd7fc604fbc59213587887d5119d51a (524 bytes, patch)
2011-06-30 02:46 UTC, Dieter Verfaillie
Details | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Sam Thursfield 2008-08-09 17:49:15 UTC
This bug has been driving me mad for the day. It occurs under MSYS, with latest bzr head. Compare these two:

> echo "`pkg-config --libs gio-2.0`"
-Lc:/build/lib -lgio-2.0 -lgobject-2.0 -lgmodule-2.0 -lglib-2.0 -lintl

> echo "`pkg-config --libs gio-2.0` "
-Lc:/build/lib -lgio-2.0 -lgobject-2.0 -lgmodule-2.0 -lglib-2.0 -lintl  ☺

The only difference is the space between ` and ". Of course a smiley face (^A) breaks configure scripts because gcc won't run if it has an invalid character in its args, and this guy gets into lots of CFLAGS and LDFLAGS.

The problem is the
   if (need_newline)
     printf ("\n");
at the end of main(). I've tried disabling it on Win32 and it doesn't seem to break anything, so I would propose adding #ifndef G_OS_WIN32 .. #endif around the newline code.
Comment 1 Sam Thursfield 2008-08-09 17:51:09 UTC
Also, the control character isn't visible if you run the command under msys with rxvt; use msys --norxvt.
Comment 2 Sam Thursfield 2008-08-09 18:14:43 UTC
Okay. It would have been nice to find this two days ago but an alternate solution is here: http://lists-archives.org/gtk-devel/05434-gtk-configure-can-t-find-cairo-pdf.html
I guess this is a known issue
Comment 3 Tollef Fog Heen 2009-12-06 13:35:36 UTC
Fixed using:

commit 25e8ca84acd7fc604fbc59213587887d5119d51a
Author: Tollef Fog Heen <tfheen@err.no>
Date:   Sun Dec 6 22:34:35 2009 +0100

    Print out \r\n on windows, not just \n
    
    This should hopefully fix bug #17053

diff --git a/main.c b/main.c
index df25aaa..b9442fc 100644
--- a/main.c
+++ b/main.c
@@ -645,7 +645,11 @@ main (int argc, char **argv)
     }
 
   if (need_newline)
+#ifdef G_OS_WIN32
+    printf ("\r\n");
+#else
     printf ("\n");
+#endif
 
   return 0;
 }
Comment 4 Martin Schlemmer 2010-06-11 04:20:47 UTC
Ok, now this have driven me mad for a day since upgrading from 0.23 =)

---------------------------------------------------------------------------
NTLMS@NTLMS /opt/workdir/mingw-gtk2-build-2.20
$ echo "`/opt/mingw-gtk2/bin/pkg-config --libs gio-2.0` "
-Lc:/opt/mingw-gtk2/lib -lgio-2.0 -lgobject-2.0 -lgmodule-2.0 -lgthread-2.0 -lglib-2.0 -lintl  ☺


NTLMS@NTLMS /opt/workdir/mingw-gtk2-build-2.20
$ /opt/mingw-gtk2/bin/pkg-config --version
0.25
---------------------------------------------------------------------------

What version of MSYS/MinGW are you using?  I have MSYS 1.0.14 with latest bash, etc., and MinGW with mingwrt-3.18, w32api-3.14 and gcc-4.5.0 (latest everything basically).

I tested it both in Console, msys with rxvt and msys --norxvt.  If I revert it to just print a \n, it works fine, so it might be that it could be a bug in older MSYS/Bash.

Bash version is 3.1.17(1)-release btw.
Comment 5 Sam Thursfield 2010-06-11 06:36:35 UTC
yes, I can confirm that with newest MSYS bash, 0.23 now works and 0.25 does not  :( so I recommend reverting the patch.

at least the problem is solved :)
Comment 6 Dieter Verfaillie 2011-06-30 02:46:14 UTC
Created attachment 48585 [details] [review]
Patch reverting 25e8ca84acd7fc604fbc59213587887d5119d51a

This has been brought up a couple of times on
mingw-users@lists.sourceforge.net these last few weeks.

Here's the patch I've been using. It reverts
5e8ca84acd7fc604fbc59213587887d5119d51a.
Tested in cmd.exe and "sh -i" running in cmd.exe,
Console2 and mintty (on a Windows XP box in case it
matters).
Comment 7 Martin Schlemmer 2011-07-01 04:45:27 UTC
(In reply to comment #6)
> Tested in cmd.exe and "sh -i" running in cmd.exe,
> Console2 and mintty (on a Windows XP box in case it
> matters).

Ditto for previous test environments and mintty lately (XP/Vista/7), used a similar patch.

Sorry for not attaching a patch earlier and following up on it to get it into 0.26.
Comment 8 Martin Schlemmer 2011-11-30 03:25:13 UTC
Cannot seem to get git repo checked out here, so just wondering what the status on this is?
Comment 9 Dan Nicholson 2012-05-05 10:52:06 UTC
Reading these two threads:

http://mail.gnome.org/archives/gtk-devel-list/2007-June/msg00066.html
http://thread.gmane.org/gmane.comp.gnu.mingw.msys/3284

suggest this is a bug with an older mingw/msys shell. The second thread did report this bug that doesn't seem to be closed:

http://sourceforge.net/tracker/index.php?func=detail&aid=925450&group_id=2435&atid=102435

I had a winxp vm here so I went to the trouble of building pkg-config under mingw/msys. Sure enough the issue is there. Interestingly, if you send output from a program with just a \n straight to the terminal, the msys shell apparently converts it to \r\n. However, when the program is run under command substitution (backticks), it will keep just the \n.

Anyway, I've applied the patch in 79c768a since this seems to work with newer mingw/msys setups. Please reopen if this becomes an issue again.
Comment 10 Dan Nicholson 2012-05-10 05:45:35 UTC
*** Bug 48663 has been marked as a duplicate of this bug. ***
Comment 11 Andoni Morales Alastruey 2012-11-01 02:07:15 UTC
*** Bug 50677 has been marked as a duplicate of this bug. ***