Author Topic: Spaces in library paths lead to not starting console apps  (Read 5034 times)

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7252
Spaces in library paths lead to not starting console apps
« on: June 15, 2008, 01:16:41 pm »
Bug described here.

Here is the text of my bug-report:
Quote
If "GetDynamicLinkerPathForTarget(target)" returns a path with spaces, console apps on linux can not be started.

The returned string has to be quoted if it includes spaces (escaping the spaces does not work).

Her is the patch I posted:
Code
--- codeblocks-1.0svn.orig/src/plugins/compilergcc/compilergcc.cpp      2008-04-29 18:27:30.000000000 +0200
+++ codeblocks-1.0svn.work/src/plugins/compilergcc/compilergcc.cpp      2008-06-15 11:59:16.000000000 +0200
@@ -1784,7 +1784,10 @@
                                {
                                        // set LD_LIBRARY_PATH
                                        command << LIBRARY_ENVVAR << _T("=$") << LIBRARY_ENVVAR << _T(':');
-                                       command << GetDynamicLinkerPathForTarget(target) << strSPACE;
+                                       // we have to quote the string, just escape the spaces does not work
+                                       wxString strLinkerPath=GetDynamicLinkerPathForTarget(target);
+                                       QuoteStringIfNeeded(strLinkerPath);
+                                       command << strLinkerPath << strSPACE;
                                }
             }
         }


Offline libfab

  • Multiple posting newcomer
  • *
  • Posts: 45
Re: Spaces in library paths lead to not starting console apps
« Reply #1 on: June 15, 2008, 02:49:29 pm »
Thanks Jens, works like a charm!
Actually the patch posted on this site did not  apply OK with patch -N(u)p(x) < diff_file, so I corrected by hand and made a slightly bigger patch that works fine (attached). Its seems I had to take off a redundant line of coding?
Best, Fab

[attachment deleted by admin]

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7252
Re: Spaces in library paths lead to not starting console apps
« Reply #2 on: June 15, 2008, 03:01:53 pm »
Try "patch -p1 < diff_file" from the root directory of C::B's source, that should work.