# HG changeset patch # User raptorbot # Date 1266877460 0 # Node ID 64208ed747d4573920d092719b014047599bee50 # Parent bd7f12067a47ced46ba4dfe6d730a0ca28a1e77f SF Bug 2000 - Talon fails when installed in a path containing the string '-c' (windows only) diff -r bd7f12067a47 -r 64208ed747d4 sbsv2/raptor/RELEASE-NOTES.txt --- a/sbsv2/raptor/RELEASE-NOTES.txt Fri Feb 19 19:01:20 2010 +0000 +++ b/sbsv2/raptor/RELEASE-NOTES.txt Mon Feb 22 22:24:20 2010 +0000 @@ -1,6 +1,5 @@ Release Notes for Symbian Build System v2 -- SF Bug 1861 - [Raptor] More helpful console message in case of Error 128 (timeout) next version @@ -8,6 +7,8 @@ - DPDEF142718 Incremental rebuild fails if dependent files deleted --no-depend-generate added to suppress the generation and processing of dependency files .DEFAULT target introduced for all non --no-depend-generate and/or --no-depend-include builds +- SF Bug 1861 - [Raptor] More helpful console message in case of Error 128 (timeout) +- SF Bug 2000 - Talon fails when installed in a path containing the string '-c' (windows only) version 2.12.2 diff -r bd7f12067a47 -r 64208ed747d4 sbsv2/raptor/util/talon/talon.c --- a/sbsv2/raptor/util/talon/talon.c Fri Feb 19 19:01:20 2010 +0000 +++ b/sbsv2/raptor/util/talon/talon.c Mon Feb 22 22:24:20 2010 +0000 @@ -222,6 +222,166 @@ return recipe; } +#ifdef HAS_GETCOMMANDLINE +/* + Get rid of the path to talon from a commandline string on windows find the + -c (if it's there) and step past it to after the quote on the first command: + + "g:\program files\talon\talon.exe" -c "gcc -c . . ." + ^------ Returns a pointer to here + + Take care of the possibilty that there might be spaces in the command + if it is quoted. + + A state-machine is flexible but not all that easy to write. Should investigate + the possiblity of using the Ragel state machine generator perhaps. + +*/ +#define CH_START 0 +#define CH_PRE 1 +#define CH_EXQUOTE 2 +#define CH_INQUOTE 3 +#define CH_POST 4 +#define CH_MINUS 5 +#define CH_C 6 +#define CH_PRECOMMAND 7 +#define CH_COMMAND 8 +#define CH_ERR 9 + +char * chompCommand(char command[]) +{ + char *result = command; + int state = CH_START; + + while (state != CH_COMMAND && state != CH_ERR) + { + DEBUG(("startstate: %d, char %c ",state, *result)); + switch (*result) + { + case ' ': + switch (state) + { + case CH_START: + case CH_PRE: + state = CH_PRE; + break; + case CH_EXQUOTE: + state = CH_POST; + break; + case CH_INQUOTE: + break; + case CH_POST: + break; + case CH_MINUS: + state = CH_C; + break; + case CH_C: + state = CH_PRECOMMAND; + break; + case CH_PRECOMMAND: + break; + default: + state = CH_ERR; + break; + } + break; + case 'c': + switch (state) + { + case CH_START: + case CH_PRE: + state = CH_EXQUOTE; + break; + case CH_EXQUOTE: + case CH_INQUOTE: + break; + case CH_POST: + state = CH_ERR; + break; + case CH_MINUS: + state = CH_C; + break; + case CH_C: + case CH_PRECOMMAND: + default: + state = CH_ERR; + break; + } + break; + case '-': + switch (state) + { + case CH_START: + case CH_PRE: + state = CH_EXQUOTE; + break; + case CH_EXQUOTE: + case CH_INQUOTE: + break; + case CH_POST: + state = CH_MINUS; + break; + case CH_MINUS: + case CH_C: + case CH_PRECOMMAND: + default: + state = CH_ERR; + break; + } + break; + case '"': + switch (state) + { + case CH_START: + case CH_PRE: + case CH_EXQUOTE: + state = CH_INQUOTE; + break; + case CH_INQUOTE: + state = CH_EXQUOTE; + break; + case CH_POST: + case CH_MINUS: + case CH_C: + state = CH_ERR; + break; + case CH_PRECOMMAND: + state = CH_COMMAND; + break; + default: + state = CH_ERR; + break; + } + + break; + default: + switch (state) + { + case CH_START: + case CH_PRE: + state = CH_EXQUOTE; + break; + case CH_INQUOTE: + case CH_EXQUOTE: + break; + default: + state = CH_ERR; + break; + } + break; + } + DEBUG((stderr,"endstate: %d\n",state)); + result ++; + + } + + if (state == CH_ERR) + return NULL; + + return result; +} +#endif + int main(int argc, char *argv[]) { /* find the argument to -c then strip the talon related front section */ @@ -231,7 +391,6 @@ #ifdef HAS_GETCOMMANDLINE char *commandline= GetCommandLine(); - DEBUG(("talon: commandline: %s\n", commandline)); /* * The command line should be either, * talon -c "some shell commands" @@ -240,21 +399,18 @@ * * talon could be an absolute path and may have a .exe extension. */ - recipe = strstr(commandline, "-c"); + + + recipe = chompCommand(commandline); + if (recipe == NULL) + { + error("talon: error: unable to locate argument start in '%s'\n", commandline); + return 1; + } if (recipe) { /* there was a -c so extract the quoted commands */ - while (*recipe != '"' && *recipe != '\0') - recipe++; - - if (*recipe != '"') /* we found -c but no following quote */ - { - error("talon: error: unquoted recipe in shell call '%s'\n", commandline); - return 1; - } - recipe++; - int recipelen = strlen(recipe); if (recipelen > 0 && recipe[recipelen - 1] == '"') recipe[recipelen - 1] = '\0'; /* remove trailing quote */ diff -r bd7f12067a47 -r 64208ed747d4 sbsv2/raptor/util/talon/tests/config.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sbsv2/raptor/util/talon/tests/config.sh Mon Feb 22 22:24:20 2010 +0000 @@ -0,0 +1,25 @@ +#!/bin/bash +# +# Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of the License "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# +# set up the environment for some talon tests. + +cat >settings.mk <<-endofsettings + SHELL:=$(cygpath -w $SBS_HOME/win32/bin/talon.exe) + TALON_SHELL:=$(cygpath -w $SBS_CYGWIN/bin/bash.exe) + TALON_BUILDID:=100 + TALON_DEBUG:="" + export TALON_SHELL TALON_BUILDID TALON_DEBUG +endofsettings diff -r bd7f12067a47 -r 64208ed747d4 sbsv2/raptor/util/talon/tests/run.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sbsv2/raptor/util/talon/tests/run.sh Mon Feb 22 22:24:20 2010 +0000 @@ -0,0 +1,22 @@ +#!/bin/sh +# +# Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of the License "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# + +bash ./config.sh + +make -f t3.mk +make -f t4.mk +make -f t5.mk diff -r bd7f12067a47 -r 64208ed747d4 sbsv2/raptor/util/talon/tests/t.mk --- a/sbsv2/raptor/util/talon/tests/t.mk Fri Feb 19 19:01:20 2010 +0000 +++ b/sbsv2/raptor/util/talon/tests/t.mk Mon Feb 22 22:24:20 2010 +0000 @@ -14,6 +14,7 @@ # Description: # +include settings.mk HOSTNAME:=fred COMPONENT_LAYER:=base diff -r bd7f12067a47 -r 64208ed747d4 sbsv2/raptor/util/talon/tests/t3.mk --- a/sbsv2/raptor/util/talon/tests/t3.mk Fri Feb 19 19:01:20 2010 +0000 +++ b/sbsv2/raptor/util/talon/tests/t3.mk Mon Feb 22 22:24:20 2010 +0000 @@ -13,10 +13,10 @@ # # Description: # +include settings.mk -SHELL:=$(TALON) TALON_RECIPEATTRIBUTES:=name='$$RECIPENAME' host='$$HOSTNAME' -export TALON_RECIPEATTRIBUTES +export TALON_RECIPEATTRIBUTES $(info SHELL="$(SHELL)") diff -r bd7f12067a47 -r 64208ed747d4 sbsv2/raptor/util/talon/tests/t4.mk --- a/sbsv2/raptor/util/talon/tests/t4.mk Fri Feb 19 19:01:20 2010 +0000 +++ b/sbsv2/raptor/util/talon/tests/t4.mk Mon Feb 22 22:24:20 2010 +0000 @@ -1,5 +1,5 @@ # -# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). # All rights reserved. # This component and the accompanying materials are made available # under the terms of the License "Eclipse Public License v1.0" @@ -14,7 +14,7 @@ # Description: # -SHELL:=$(TALON) +include settings.mk TALON_TIMEOUT:=4000 TALON_RETRIES:=4 TALON_RECIPEATTRIBUTES:=platform='$$PLATFORM' mmp='$$MMP' bldinf='$$BLDINF' diff -r bd7f12067a47 -r 64208ed747d4 sbsv2/raptor/util/talon/tests/t5.mk --- a/sbsv2/raptor/util/talon/tests/t5.mk Fri Feb 19 19:01:20 2010 +0000 +++ b/sbsv2/raptor/util/talon/tests/t5.mk Mon Feb 22 22:24:20 2010 +0000 @@ -13,6 +13,7 @@ # # Description: # +include settings.mk all: ||"echo this command should cause a bash error which should be visible" diff -r bd7f12067a47 -r 64208ed747d4 sbsv2/raptor/util/talon/tests/xcopystdin.mk --- a/sbsv2/raptor/util/talon/tests/xcopystdin.mk Fri Feb 19 19:01:20 2010 +0000 +++ b/sbsv2/raptor/util/talon/tests/xcopystdin.mk Mon Feb 22 22:24:20 2010 +0000 @@ -1,5 +1,5 @@ # -# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). # All rights reserved. # This component and the accompanying materials are made available # under the terms of the License "Eclipse Public License v1.0" @@ -14,9 +14,7 @@ # Description: # -SHELL:=$(SBS_HOME)/win32/bin/talon.exe -TALON_SHELL:=$(SBS_HOME)/win32/cygwin/bin/bash.exe -TALON_BUILDID:=1 +include settings.mk TALON_RECIPEATTRIBUTES:=123 export diff -r bd7f12067a47 -r 64208ed747d4 sbsv2/raptor/win32/bin/talon.exe Binary file sbsv2/raptor/win32/bin/talon.exe has changed