Erro de sintaxe (eu acho) [RESOLVIDO]

1. Erro de sintaxe (eu acho) [RESOLVIDO]

Fayos
faosfbi

(usa Ubuntu)

Enviado em 04/07/2011 - 11:42h

Olá pessoal.

Novamente venho pedir ajuda dos companheiros do VOL.

Estou tentando instalar alguns aplicativos de um sistema de jogos.
Porem, está dando pau na execução de um script.
Em um Debian 4 o script roda normalmente, porem numa versão mais recente, como o debian 6, ou ubuntu 11 a execução do mesmo da pau.

O erro é o seguinte:

/publico/src/make/bin/build: 53: Syntax error: Bad for loop variable


a linha do código que da pau é este "for" danado:

for (( x=0; ; x=x+2 ))

ele esta no seguinte código:

#!/bin/sh

if [ -z $BUILD_ROOT ]; then
echo Please set BUILD_ROOT first.
exit 1
fi

# Should we use BUILD_MOD or assume we're somewhere in the module directory?
if [ $BUILD_MOD ]; then
cd $BUILD_MOD
else
# Is there a description.txt file?
if [ ! -e description.txt ]; then
# Maybe we're in the im/ subdirectory, try the upper directory.
cd ..
if [ ! -e description.txt ]; then
echo Not in the module directory, and BUILD_MOD is not set.
exit 1
fi
fi
fi

# Now we should be in the desired module's directory.

# If the BUILD_DEFPROFILE is not set, initialize it so a sane value.

if [ -z $BUILD_DEFPROFILE ]; then
export BUILD_DEFPROFILE=linux
fi

# If the BUILD_PROFILE environment not set, we should either pick it from
# the profile.txt in the current directory, or use the default one.

if [ -z $BUILD_PROFILE ]; then
if [ -f profile.txt ]; then
export BUILD_PROFILE=`cat profile.txt`
else
export BUILD_PROFILE=$BUILD_DEFPROFILE
fi
fi

echo Profile is $BUILD_PROFILE

# If there is a commit rule active, calculate the deps and commit them
# along with the target.

if [ "$1" == ci ]; then
MODS_WITH_DIRS="$BUILD_ROOT/make/bin/calculate_deps -r --with-dirs ."
test $? == 0 || exit 1

DIRS=

for (( x=0; ; x=x+2 ))
do
if [ -z ${MODS_WITH_DIRS[$x]} ]; then break; fi
DIRS="${DIRS}${MODS_WITH_DIRS[$(($x+1))]} "
done

exec svn ci . $DIRS
fi

# Run a game if it is what we ordered
if [ "$1" == run ]; then
if [ -z $RES_ROOT ]; then
echo Please set RES_ROOT first.
exit 1
fi
if [ -f name.txt ]; then
exec $RES_ROOT/`cat name.txt`/start
else
echo Not in a program directory.
exit 1
fi
fi

# Run a gdb with the generated core if it was what was ordered
if [ "$1" == gdb ]; then
if [ -z $RES_ROOT ]; then
echo Please set RES_ROOT first.
exit 1
fi
if [ -f name.txt ]; then
exec gdb -c $RES_ROOT/`cat name.txt`/lib/core* $RES_ROOT/`cat name.txt`/slot
else
echo Not in a program directory.
exit 1
fi
fi


$BUILD_ROOT/make/bin/make_deps_mak || exit 1
trap "rm -f deps.mak" 0

# If the target is a clean target, we should turn off the .d generation
# since the desire for cleaning may well be driven by a need to get rid of
# the problem with .d. Besides, the .d files would not help cleaning,
# and furthermire, they are the very target of removal by the cleaning target,
# so there is no need to generate them just to remove afterwards.

if [ "$1" = clean -o "$1" = clean_all ]; then
export NO_D_FILES=1
fi

if [ -z $MAKE ]; then
export MAKE=make
which colormake >/dev/null && export MAKE=colormake
fi

$MAKE -r -f $BUILD_ROOT/make/main.mak "$@"

Por favor, me ajudem...



  


2. Re: Erro de sintaxe (eu acho) [RESOLVIDO]

Renato Carneiro Pacheco
renato_pacheco

(usa Debian)

Enviado em 04/07/2011 - 11:51h

Execute o script assim:

# bash -x script.sh

Ele vai debugar e t falar aonde q tá o erro.


3. Re: Erro de sintaxe (eu acho) [RESOLVIDO]

Fayos
faosfbi

(usa Ubuntu)

Enviado em 04/07/2011 - 12:00h

Então, no manual do software, eu tenho de executar o seguinte comando:

$ export BUILD_PROFILE=
$ for x in encode-ima psd2set ptool hli/programmer hli/tool protection/encrypt-bootsplash protection/encrypt-initrd protection/encrypt-kernel protection/wipe-unused-sectors; do cd $BUILD_ROOT/programs/$x; $BUILD_ROOT/make/bld || break; done

Na ultima execução de $BUILD_ROOT/make/bld que tem o conteudo:

#!/bin/sh

PARAMS=

if [ $CONCURRENCY_LEVEL ]; then
PARAMS=-j$CONCURRENCY_LEVEL
else
PARAMS=-j10
fi

$BUILD_ROOT/make/bin/build $@ $PARAMS

E neste chama do script que da pau...


4. Re: Erro de sintaxe (eu acho) [RESOLVIDO]

Fayos
faosfbi

(usa Ubuntu)

Enviado em 04/07/2011 - 14:40h

O estranho é o "for":

for (( x=0; ; x=x+2 ))

Percebo que a segunda variável que estipula o fim da contagem do for está vazia.
Existe, ou pode se executar um "for" sem o parâmetro de final da contagem em shell?
Percebi que diversos scripts do código está utilizando este mesmo "for".

O chato é que em debian 4 o script executa.


5. Re: Erro de sintaxe (eu acho) [RESOLVIDO]

Osama Jr.
/bin/laden

(usa Void Linux)

Enviado em 05/07/2011 - 08:43h

Nesse script substitua o hashbang '#!/bin/sh' por '#!/bin/bash'. Quanto a questão desse sintaxe do for, ela é perfeitamente válida (para o bash!), já que dentro do loop há uma condição de parada que o finaliza num momento adequado.


6. Re: Erro de sintaxe (eu acho) [RESOLVIDO]

Fayos
faosfbi

(usa Ubuntu)

Enviado em 05/07/2011 - 15:22h

Valew Bin Laden!!!!
Nossa cara, passei por alto este detalhe, que falha a minha.
Valew mesmo cara!!!

Poxa, porem logo a frente estou sendo reportado por outro erro que não estou entendendo.
Tipo tenho o compilador g++-4.4.5.2 instalado no meu ubuntu.
Porem, estou sendo reportado ao executar o script por:
line 23: g++-4.1: command not found

A linha 23 é esta:
$CPP $@ >/dev/null 2>$TMP

O arquivo é este:
#!/bin/bash

# This script will output the contents of the .d file for the given .cc file.
# In case any missing files are found in .cc, they are the only files that
# go to the .d. This would allow the make system to generate them, and to
# call this script again.
# When there are no missing files, the .d output is complete.

# Usage: make_d <.d file to append to> <cpp to use> <options to pass to cpp, including .cc file> ...
# Options must not include any of -M

TMP=`mktemp`
trap "rm -f $TMP" 0

# Make sure we get a 'No such file or directory' regardless of the current
# locale
export LC_MESSAGES=C

OUT=$1
shift
CPP=$1
shift
$CPP $@ >/dev/null 2>$TMP
RESULT=$?

#cat $TMP

if [ $RESULT != 0 ]; then
# Missing deps probably
if [ `grep -c '^/.*No such file or directory' $TMP` = 0 ]; then
# Nope, there was some other error
echo --- Error while creating the dependency file $OUT:
cat $TMP
exit 1
fi
grep '^/.*No such file or directory' $TMP | \
sed -r \
-e 's#^ *(([^/]*/)*)[^:]+:[^ ]+ (error: )?([^/]+): No such file or directory#\1\4\\#' \
-e 's#^ *(([^/]*/)*)[^:]+:[^ ]+ (error: )?(im/[^/]+): No such file or directory#\1\4\\#' \
-e 's#^ *(([^/]*/)*)[^/]+/[^/]+[^:]+:[^ ]+ (error: )?\.\./(glue\.hh): No such file or directory#\1\4\\#' \
-e "s#^ *(([^/]*/)*)[^/]+[^:]+:[^ ]+ (error: )?(base/[^:]+): No such file or directory#$BUILD_ROOT/modules/\4\\\\#" \
-e "s#^ *(([^/]*/)*)[^/]+[^:]+:[^ ]+ (error: )?([^:]+): No such file or directory#\4\\\\#" | \
sed -r 's#/[^/. ]+/\.\./#/#g' >> $OUT || exit 1
else
# Everything ok, removing the beginning will suffice
$CPP -M -MG -MP $@ | grep -v '^#' | sed '1 s#.*:##' | sed -r 's#/[^/. ]+/\.\./#/#g' >> $OUT
fi

O que acho estranho é que em outros scripts ou compilações são executadas no compilador instalado no linux, porem neste em especial não está reconhecendo o compilador instalado.

Agradeço de antemão pela paciência.



7. Re: Erro de sintaxe (eu acho) [RESOLVIDO]

Osama Jr.
/bin/laden

(usa Void Linux)

Enviado em 06/07/2011 - 09:51h

Cria um link simbólico para o 'g++-4.1' apontando para o 'g++-4.4.5.2' com o comando ln.


8. Re: Erro de sintaxe (eu acho) [RESOLVIDO]

Fayos
faosfbi

(usa Ubuntu)

Enviado em 21/07/2011 - 15:51h

Olá Pessoal.

Então, Binladen.
Eu criei o link simbolico com o comando:
ln -s /usr/bin/g++-4.5 /usr/bin/g++-4.1

Porem, agora o sistema esta reportando o seguinte erro:

'Too many levels of symbolic links'

O que acha que pode ser?

Obrigado a todos!



  



Patrocínio

Site hospedado pelo provedor RedeHost.
Linux banner

Destaques

Artigos

Dicas

Tópicos

Top 10 do mês

Scripts