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 added a comment -

          This issue resolved itself without any changes made...but I would like to find out how to read the temp. file in case this happens again.

          Michael Chan added a comment - This issue resolved itself without any changes made...but I would like to find out how to read the temp. file in case this happens again.

          Daniel Beck added a comment -

          The issue tracker isn't the correct venue for getting that kind of help. Since it appears to have resolved itself, any further investigation is basically impossible.

          Daniel Beck added a comment - The issue tracker isn't the correct venue for getting that kind of help. Since it appears to have resolved itself, any further investigation is basically impossible.

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

              Created:
              Updated:
              Resolved: