Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-29543

"if: Expression Syntax" Error During Build Step w/ C Shell Script

    • Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Icon: Major Major
    • core
    • x86_64/RHEL5.9

      A syntax error started appearing out of the blue during a regularly scheduled run:

      Started by user xyz
      [EnvInject] - Loading node environment variables.
      Building in workspace /location/of/workspace
      No emails were triggered.
      [workspace] $ /bin/sh -xe /tmp/hudson43340.sh
      + /location/of/script
      if: Expression Syntax.
      Build step 'Execute shell' marked build as failure
      Started calculate disk usage of build
      Finished Calculation of disk usage of build in 0 seconds
      Started calculate disk usage of workspace
      Finished Calculation of disk usage of workspace in 0 seconds
      Finished: FAILURE

      This is a very simple project where a script is executed in a shell without any additional code or options. There isn't an if-statement anywhere in the script. The script is written for C shell, and in my test, this would produce the error:

      #!/bin/csh

      echo "Test"

      However, if I swap to the Bourne shell, the script works fine:

      #!/bin/sh

      echo "Test"

      Started by user xyz
      [EnvInject] - Loading node environment variables.
      Building in workspace /location/of/workspace
      [workspace] $ /bin/sh -xe /tmp/hudson43526.sh
      + /location/of/script
      Test
      Started calculate disk usage of build
      Finished Calculation of disk usage of build in 0 seconds
      Started calculate disk usage of workspace
      Finished Calculation of disk usage of workspace in 0 seconds
      Finished: SUCCESS

      I updated to the latest version of Jenkins, but the issue persists. If I could view the temp. file in which the build step is written into (i.e. hudsonXXXXX.sh), I think I would be able to see the problem, but I am not sure how I can copy the temp. script before it is removed.

          [JENKINS-29543] "if: Expression Syntax" Error During Build Step w/ C Shell Script

          Michael Chan created issue -
          Michael Chan made changes -
          Status Original: Open [ 1 ] New: In Progress [ 3 ]
          Michael Chan made changes -
          Status Original: In Progress [ 3 ] New: Open [ 1 ]
          Daniel Beck made changes -
          Resolution New: Cannot Reproduce [ 5 ]
          Status Original: Open [ 1 ] New: Resolved [ 5 ]
          R. Tyler Croy made changes -
          Workflow Original: JNJira [ 164421 ] New: JNJira + In-Review [ 197500 ]

            Unassigned Unassigned
            bleakbutbold Michael Chan
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: