#26 2019-06-26 17:17:46

isombrinia
Member
Registered: 2019-06-25
Posts: 11

Re: line 490: syntax error: unexpected "&"

Same thing happens with official bash (not the busybox version).  This is the output from running it on Fedora 29:

$ ./xsibackup --help
./xsibackup: line 490: syntax error near unexpected token `;&'
./xsibackup: line 490: `DEBUGINFO="${DEBUGINFO}<br>&bull;&nbsp;KEY: $SSHOPTS"'

$ bash --version
GNU bash, version 4.4.23(1)-release (x86_64-redhat-linux-gnu)
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>

This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Offline

#27 2019-06-26 18:00:19

isombrinia
Member
Registered: 2019-06-25
Posts: 11

Re: line 490: syntax error: unexpected "&"

If you copy out and run the "DEBUGINFO=" line by itself in a shell, it works.  Yet, in the context of the script, it fails.  My guess is that with all the fancy stuff going on, newer versions of bash are getting confused somewhere prior to line 490, and incorrectly parsing once it gets to 490, causing the error.  Perhaps they *fixed* a bug awhile back, and that fix might have exposed a latent syntax issue in the script.

EDIT:  https://www.shellcheck.net/  Thinks the first double quote in that line is an end quote, not a start quote.

EDIT2:  Commenting out line 200, and uncommenting 201 at least allows the script to run without bash syntax errors.  Something about line 200 is suspect:

Line 200:
        VARVAL="${VARVAL//"/\"}"
               ^-- SC1078: Did you forget to close this double quoted string?

Last edited by isombrinia (2019-06-26 18:22:46)

Offline

#28 2019-06-27 04:30:31

cmgj
Member
Registered: 2018-01-13
Posts: 2

Re: line 490: syntax error: unexpected "&"

isombrinia wrote:

Line 200:
        VARVAL="${VARVAL//"/\"}"
               ^-- SC1078: Did you forget to close this double quoted string?

Good catch!

If I change the line ( in my version it is line 196 btw) to this:

VARVAL="${VARVAL//\"/\"}"

Then the script runs again!

Offline

#29 2019-07-01 09:11:12

admin
Administrator
Registered: 2017-04-21
Posts: 993

Re: line 490: syntax error: unexpected "&"

Running it in a regular Bash should not make much sense, in this case might have helped you to detect this, though. Busybox shell is not Bash, but Ash, which is a much more primitive shell language closer to the original Bourne Shell.

It would be rare that we had not detected any gross syntax error for years. It would make sense that the syntax parser thinks the second double quote is the end of the string though, but changing it to this:

VARVAL="${VARVAL//\"/\"}"

leaves the line without effect, so in any case that should be:

VARVAL="${VARVAL//\"/\\"}"

As the function of that type of code is to escape double quotes. Sed would have probably done it better here, we'll revise it soon, thank you for the feedback.

We'll take a look at this and eventually fix it. Nevertheless the new XSIBackup version has been released as a Beta and will be our main branch of development for the next years, XSIBackup as a script will probably be kept as the free version of our software.

Offline

#30 2019-07-01 11:29:49

admin
Administrator
Registered: 2017-04-21
Posts: 993

Re: line 490: syntax error: unexpected "&"

We have been taking a look at this issue again.

It's clear that the double quote inside the curly brace expansion was causing the bash parser to behave oddly. It's also obvious that all previous bash interpreters didn't care much about this fact. Double quotes are treated differently inside subprocess expansion in between parentheses too, and it has been doing the same with curly brace expansion so far.

We have solved this by just using the sed call above this line to escape double quotes inside variable values. This is not very likely to be found, but still we'll keep it just in case.

We will now check functioning thoroughly before considering this a definitive solution, but you may use it to workaround this issue.

The above mentioned line

VARVAL="${VARVAL//"/\"}"

Is at line 300 in version 11.2.3
Right above that line you can find this

VARVAL="$( echo $block | awk -F "=" '{print $2}' | sed -e 's/^ *//g' -e 's/ *$//g' )"

We just extended that line adding an additional sed code block to perform the same task that the old curly brace expansion. So just add the new block and delete or comment out the faulty line.

VARVAL="$( echo $block | awk -F "=" '{print $2}' | sed -e 's/^ *//g' -e 's/ *$//g' -e 's/"/\"/g' )"

Offline

#31 2019-07-01 12:32:43

isombrinia
Member
Registered: 2019-06-25
Posts: 11

Re: line 490: syntax error: unexpected "&"

Can 11.2.3 be used in trial mode indefinitely?  The only free version I've seen is 11.0.1.  Thanks!

Offline

#32 2019-07-01 14:47:53

admin
Administrator
Registered: 2017-04-21
Posts: 993

Re: line 490: syntax error: unexpected "&"

There isn't any such thing as version 11.2.3 in trial mode. Only trial version of XSIBACKUP-PRO is 11.0.1.
Any 11.2.3 version is a PRO version, which can only be downloaded after being licensed.

In any case, this is not the thread to pose such questions.

Offline

#33 2019-07-01 14:56:39

isombrinia
Member
Registered: 2019-06-25
Posts: 11

Re: line 490: syntax error: unexpected "&"

I asked only because you referenced 11.2.3, and this is the forum for the free version.  I was confused.

Offline

#34 2019-07-01 16:07:07

admin
Administrator
Registered: 2017-04-21
Posts: 993

Re: line 490: syntax error: unexpected "&"

We just released XSIBACKUP-FREE 11.2.4, it's available for download.
It is compatible with ESXi 6.7.0 Update 2

Offline

#35 2019-07-01 18:35:19

isombrinia
Member
Registered: 2019-06-25
Posts: 11

Re: line 490: syntax error: unexpected "&"

Thank you.  The new version 11.2.4 appears to be running OK on my 6.7.0 u2 system.

Offline

#36 2019-07-02 12:30:47

admin
Administrator
Registered: 2017-04-21
Posts: 993

Re: line 490: syntax error: unexpected "&"

O.K., thank you for the feedback

Offline

#37 2019-07-04 07:47:37

HigH_HawK
Member
Registered: 2018-10-12
Posts: 7

Re: line 490: syntax error: unexpected "&"

Just a quick question, I downloaded the new version of XSIBackup Free (11.2.5) and noticed that it contains a package called XSIBACKUP-PRO.zip (previous versions were called XSIBACKUP-FREE.zip), is this correct or may I encounter issues as a free user?

Rather asking in advance before encountering any issues smile

Thanks in advance

Last edited by HigH_HawK (2019-07-04 07:52:24)

Offline

#38 2019-07-04 10:53:28

admin
Administrator
Registered: 2017-04-21
Posts: 993

Re: line 490: syntax error: unexpected "&"

Just an error naming things, it's indeed Free version

Offline

#39 2019-07-04 12:09:50

HigH_HawK
Member
Registered: 2018-10-12
Posts: 7

Re: line 490: syntax error: unexpected "&"

Thank you for the clarification. Going to test it now smile

Offline

#40 2019-07-04 12:40:07

admin
Administrator
Registered: 2017-04-21
Posts: 993

Re: line 490: syntax error: unexpected "&"

We already fixed that name and republished as same version

Offline

Board footer