[m-rev.] for review: shell script for C# grade uses absolute path

Peter Wang novalazy at gmail.com
Thu Mar 20 11:00:02 AEDT 2014


On Sat, 15 Mar 2014 15:38:57 +0100, Sebastian Godelet <sebastian.godelet+github at gmail.com> wrote:
> For review by anyone.
> 
> The generated shell script to launch C# executables does not use
> absolute pathes, this patch fixes that (now works the same as the Java
> grade).
> 
> compiler/compile_target_code.m:
>     Assigning script directory to DIR and use that to launch the CLI
> interpreter.
> 
> Sebastian.
> 
> ---
>  compiler/compile_target_code.m | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> diff --git a/compiler/compile_target_code.m b/compiler/compile_target_code.m
> index 1893393..cdf510e 100644
> --- a/compiler/compile_target_code.m
> +++ b/compiler/compile_target_code.m
> @@ -3014,10 +3014,11 @@ write_cli_shell_script(Globals, ExeFileName,
> Stream, !IO) :-
>          ":", LinkLibraryDirectories),
>      list.foldl(io.write_string(Stream), [
>          "#!/bin/sh\n",
> +        "DIR=${0%/*}\n",
>          "MONO_PATH=$MONO_PATH:", LinkLibraryDirectories, "\n",
>          "export MONO_PATH\n",
>          "CLI_INTERPRETER=${CLI_INTERPRETER:-", CLI, "}\n",
> -        "exec $CLI_INTERPRETER ", ExeFileName, " \"$@\"\n"
> +        "exec $CLI_INTERPRETER $DIR/", ExeFileName, " \"$@\"\n"
>      ], !IO).

Hi,

$CLI_INTERPRETER and $DIR should be quoted for spaces.
I think the reference to $MONO_PATH should be quoted as well.
but I'm not sure.

PEter



More information about the reviews mailing list