Uploaded image for project: 'Pentaho Data Integration - Kettle'
  1. Pentaho Data Integration - Kettle
  2. PDI-19063

"Execute a shell script" job ran in Linux fails with "No such file or directory" when script was written on Windows

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Severity: Urgent
    • Resolution: Fixed
    • Affects Version/s: 8.3.0 GA, 9.1.0 GA
    • Fix Version/s: Backlog
    • Component/s: Step
    • Labels:
      None
    • Story Points:
      3
    • PDI Sub-component:
    • Notice:
      When an issue is open, the "Fix Version/s" field conveys a target, not necessarily a commitment. When an issue is closed, the "Fix Version/s" field conveys the version that the issue was fixed in.
    • Sprint Team:
      Mos Eisley
    • Steps to Reproduce:
      Hide
      1. Install PDI Client 8.3 on a Linux machine
      2. Download the sample KTR shellScriptTest.kjband Shell script shellScriptTest.shand place both files in the same directory.
      3. Run the job using Kitchen 8.3
      4. Note that the "Shell with Script" job entry will fail with "No such file or directory" while "Shell with Insert Script" runs fine.

      Actual Result:  The Shell job entry will fail with the error "No such file or directory"

      Expected Result:  The Shell job entry should run with no errors

      Show
      Install PDI Client 8.3 on a Linux machine Download the sample KTR shellScriptTest.kjb and Shell script shellScriptTest.sh and place both files in the same directory. Run the job using Kitchen 8.3 Note that the "Shell with Script" job entry will fail with "No such file or directory" while "Shell with Insert Script" runs fine. Actual Result:   The Shell job entry will fail with the error "No such file or directory" Expected Result:   The Shell job entry should run with no errors

      Description

      When running a job with a Shell job entry on Linux that calls a local script that has been developed in Windows, you can get a "No such file or directory" error due to the end of line being in Windows format.

      2021/01/25 16:06:32 -   - ERROR (version 6.0.1.0-386, build 1 from 2015-12-03 11.37.25 by buildguy) : Error running shell [file:///home/pentaho/sample_jobs/shellScriptTest.sh] : java.io.IOException: Cannot run program "/home/pentaho/sample_jobs/shellScriptTest.sh": error=2, No such file or directory
      2021/01/25 16:06:32 -   - ERROR (version 6.0.1.0-386, build 1 from 2015-12-03 11.37.25 by buildguy) : java.io.IOException: Cannot run program "/home/pentaho/sample_jobs/shellScriptTest.sh": error=2, No such file or directory
      2021/01/25 16:06:32 -   -       at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
      2021/01/25 16:06:32 -   -       at org.pentaho.di.job.entries.shell.JobEntryShell.executeShell(JobEntryShell.java:578)
      2021/01/25 16:06:32 -   -       at org.pentaho.di.job.entries.shell.JobEntryShell.execute(JobEntryShell.java:418)
      2021/01/25 16:06:32 -   -       at org.pentaho.di.job.Job.execute(Job.java:730)
      2021/01/25 16:06:32 -   -       at org.pentaho.di.job.Job.execute(Job.java:873)
      2021/01/25 16:06:32 -   -       at org.pentaho.di.job.Job.execute(Job.java:546)
      2021/01/25 16:06:32 -   -       at org.pentaho.di.job.Job.run(Job.java:435)
      2021/01/25 16:06:32 -   - Caused by: java.io.IOException: error=2, No such file or directory
      2021/01/25 16:06:32 -   -       at java.lang.UNIXProcess.forkAndExec(Native Method)
      2021/01/25 16:06:32 -   -       at java.lang.UNIXProcess.<init>(UNIXProcess.java:247)
      2021/01/25 16:06:32 -   -       at java.lang.ProcessImpl.start(ProcessImpl.java:134)
      2021/01/25 16:06:32 -   -       at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)
      2021/01/25 16:06:32 -   -       ... 6 more
      

      This issue was stated to be previously address in PDI-12176 for version 6.0 as a regression of 4.x.  However, I can recreate this on 6.0 as well.

      The EOL must be in the Unix format in the script for it to run successfully.

        Attachments

        1. ShellScriptError.txt
          8 kB
        2. shellScriptTest.kjb
          11 kB
        3. shellScriptTest.sh
          0.0 kB

          Issue Links

            Activity

              People

              Assignee:
              vshalkova Viktoryia Shalkova
              Reporter:
              bowens Brittany Owens
              Votes:
              0 Vote for this issue
              Watchers:
              8 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: