<div dir="ltr">Hi Gambit community,<div><br></div><div>If I understood Gambit's current behavior right, then there's no way to <span style="font-family:monospace,monospace">(compile-file "irrelevant.scm" cc-options: "$(SYSTEM EXPLOIT CODE HERE)")</span> .<div class="gmail_extra"><br></div><div class="gmail_extra">So Gambit's approach for this argument is similar to a SQL injection attack safety.</div><div class="gmail_extra"><br></div><div class="gmail_extra">This is not a big deal as compile-file probably never is exported to any untrusted user.</div><div class="gmail_extra"><br></div><div class="gmail_extra">However, for symmetry, it makes sense - so spontaneously, while it was a small surprise to me that the conveniency feature of <font face="monospace, monospace">cc-options: \"$(pkg-config --libs libjpeg\")"</font> wouldn't work, on second thought I think the fact that it does not work is rather a feature than a bug, so I'm positive about the current behavior.</div><div class="gmail_extra"><br></div><div class="gmail_extra"><br></div><div class="gmail_extra">Does anyone have an opinion?</div><div class="gmail_extra"><br></div><div class="gmail_extra"><br></div><div class="gmail_extra">Thanks.</div><div class="gmail_extra"><br></div><div class="gmail_extra"><br><div class="gmail_quote">2016-07-13 13:56 GMT+08:00 Adam <span dir="ltr"><<a href="mailto:adam.mlmb@gmail.com" target="_blank">adam.mlmb@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>Dear Marc,</div><div><br></div><div>I'm in a nasty environment where I not can know what exact "-I" and "-l" arguments the C compiler and linker need.</div><div><br></div><div>For this reason, I need the pkg-config shell tool to figure it out for me!</div><div><br></div><div>It would have seemed logical to me that |compile-file|'s |cc-options:| and |ld-options:| would be evaluated by the system shell by the gambc-cc script, so that this would work:</div><div><br></div><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div><font face="monospace, monospace">echo '(print "Hello world\n")' > test.scm</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">GAMBC_CC_VERBOSE=yes gsc</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">(compile-file "test.scm"</font></div><div><font face="monospace, monospace">              cc-options: "$(pkg-config --cflags \"libjpeg\")"</font></div><div><font face="monospace, monospace">              ld-options: "$(pkg-config --libs \"libjpeg\")"</font></div><div><font face="monospace, monospace">              )</font></div></blockquote><div><br></div><div>However, it does not - but instead, the "$(p... strings are passed on verbatim to the C compiler, leading to this output:</div><div><br></div><div><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div><div><font face="monospace, monospace">gcc [...] -o "test.o1" $(pkg-config --cflags "libjpeg")  test.c $(pkg-config --libs "libjpeg")</font></div><div><font face="monospace, monospace">gcc: error: $(pkg-config: No such file or directory</font></div><div><font face="monospace, monospace">gcc: error: "libjpeg"): No such file or directory</font></div><div><font face="monospace, monospace">gcc: error: $(pkg-config: No such file or directory</font></div><div><font face="monospace, monospace">gcc: error: "libjpeg"): No such file or directory</font></div><div><font face="monospace, monospace">gcc: error: unrecognized command line option ‘--cflags’</font></div><div><font face="monospace, monospace">gcc: error: unrecognized command line option ‘--libs’</font></div><div><font face="monospace, monospace">*** ERROR IN (console)@2.1 -- C compilation or link failed while compiling "test.scm"</font></div></div><div><br></div></blockquote></div><div><br></div><div>I.e. GCC actually gets a "$(pkg-config" argument, a "--cflags" argument and a "\"libjpeg\"" argument, etc. .</div><div><br></div><div>So this test is a total catastrophe.</div><div><br></div><div>The question then comes, is this a bug or a feature?</div><div><br></div><div><br></div><div>I can totally see that it is your intended design of gsc+gambc-cc that those arguments should be passed exactly verbatim all the way to the C compiler, it makes sense, for instance as a correctness and a security measure.</div><div><br></div><div>So what I am asking here is if you have any thoughts about the convenience factor, or if you have any design thought here or this just design choice just was arbitrary.</div><div><br></div><div><br></div><div>Anyhow in the absence of shell-evaluation of pkg-config anywhere else, I need to add it explicitly, meaning then that the compile-file command should be:<br><br></div><div><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div><div><font face="monospace, monospace">(compile-file "test.scm"</font></div><div><font face="monospace, monospace">              cc-options: (myshellrun "pkg-config --cflags \"libjpeg\"")</font></div><div><font face="monospace, monospace">              ld-options: (myshellrun "pkg-config --libs \"libjpeg\"")</font></div><div><font face="monospace, monospace">              )</font></div></div></blockquote></div><div><br></div><div>where myshellrun is a procedure that involves open-process and reads its output to a string.</div><div><br></div><div>Please confirm that this indeed is the intended best practice for solving this problem.</div><div><br></div><div>Thanks!</div><div><br></div></div>
</blockquote></div><br></div></div></div>