[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Question about inline code / incompatibility between FreeBSD sh and
From: |
Garrett Cooper |
Subject: |
Re: Question about inline code / incompatibility between FreeBSD sh and bash |
Date: |
Thu, 19 Jun 2008 03:05:57 -0700 |
On Thu, Jun 19, 2008 at 2:29 AM, Garrett Cooper <yanegomi@gmail.com> wrote:
> On Thu, Jun 19, 2008 at 2:12 AM, Garrett Cooper <yanegomi@gmail.com> wrote:
>>
>> /usr/sbin/portsnap: portsnap: line 882: syntax error near unexpected
>> token `newline'
>> /usr/sbin/portsnap: portsnap: line 882: ` if !'
>>
>> The incompatible section of code (at least the one that bash
>> barfs on -- I say that because there are a few similar sections IIRC)
>> is:
>>
>> if !
>> if ! [ -z "${EXTRACTPATH}" ]; then
>> grep "^${EXTRACTPATH}" ${WORKDIR}/INDEX
>> elif ! [ -z "${REFUSE}" ]; then
>> grep -vE "${REFUSE}" ${WORKDIR}/INDEX
>> else
>> cat ${WORKDIR}/INDEX
>> fi | tr '|' ' ' | while read FILE HASH; do
>> echo ${PORTSDIR}/${FILE}
>> if ! [ -r "${WORKDIR}/files/${HASH}.gz" ]; then
>> echo "files/${HASH}.gz not found -- snapshot corrupt."
>> return 1
>> fi
>> case ${FILE} in
>> */)
>> rm -rf ${PORTSDIR}/${FILE%/}
>> mkdir -p ${PORTSDIR}/${FILE}
>> tar -xzf ${WORKDIR}/files/${HASH}.gz \
>> -C ${PORTSDIR}/${FILE}
>> ;;
>> *)
>> rm -f ${PORTSDIR}/${FILE}
>> tar -xzf ${WORKDIR}/files/${HASH}.gz \
>> -C ${PORTSDIR} ${FILE}
>> ;;
>> esac
>> done; then
>>
>
> When I take the above code, combine remove the newline and make it into ...
>
> if ! if ! [ -z "${EXTRACTPATH}" ]; then
>
> ... as well as line 951, the script is parsed properly.
>
> The "problem" is reported at parse.y:3071, but I'm unsure how to trace
> back the issue through the yacc code.
Correction: report_syntax_error in parse.y.
-Garrett