git/list[1] front-page[2] threads[3] people[4] search[5] about
 

syntax error in git-rebase while running t34* tests

From
Armin Kunaschik <megabreit@googlemail.com>
Date
May 10, 2016, 17:29 UTC
Message-ID
<CALR6jEiF9Ooi1f0O3KG0wYmN0KRWBQTNarXx79-wBD2E-8q2jA@mail.gmail.com>
Hello,

I noticed in my environment (AIX, ksh) that all rebase tests don't work. git-rebase terminates with git-rebase[6]: Syntax error at line 3 : `newline or ;' is not expected. Digging deeper I found the problem in git-rebase--interactive line 85

<snip>
strategy_args=${strategy:+--strategy=$strategy}
eval '
        for strategy_opt in '"$strategy_opts"'
        do
                strategy_args="$strategy_args -X$(git rev-parse
--sq-quote "${strategy_opt#--}")"
        done
'
<snip>

This snippet fails when $strategy_opts is empty or undefined... and my eval seems not to like this. The for loop runs fine, even with empty strategy_opts, but not inside eval. I fail to see why eval is really necessary here. Things can probably be done without eval, but I don't feel to see the big picture around this code.

My quick and dirty hotfix is to place a test -n "$strategy_opts" && in front of the eval. The tests run fine after this change.

What do you think?
Armin
Next: Junio C Hamano
Message 1 of 7 in “syntax error in git-rebase while running t34* tests”
  1. Armin KunaschikMay 10, 2016
  2. Junio C HamanoMay 10, 2016
  3. Jeff KingMay 10, 2016
  4. Junio C HamanoMay 10, 2016
  5. Jeff KingMay 10, 2016
  6. Johannes SchindelinMay 11, 2016
  7. Jeff KingMay 11, 2016

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.