Menu

#702 Formatter error since EPIC 0.7

v0.7.x
open
nobody
5
2018-11-14
2018-11-14
Codenascher
No

Hi there,

I updated my Eclipse (Windows 7) form Mars v2 to 2018-09 and EPIC 0.6 to 0.7.7. My Perl version is 5.6.0. Now if I want to use the build-in formatter I receive the following error message:
Failed to execute command line: "perl" "perltidy" "-q" "--indent-columns=4" "--maximum-line-length=80" "--entab-leading-whitespace=4" "--opening-brace-on-new-line" "--line-up-parentheses"
Sadly this happens on my workstation at work and I am unable to use the older versions. I played with the formatter configuration in Eclipse, but nothing worked so far. I have no clue want went wrong. Is this a known issue? Does anyone know how to fix this? Is this a PATH problem? Do I need to update Perl?

Thank you for your help in advanced.

Best reguards
Andreas

1 Attachments

Discussion

  • Jan Ploski

    Jan Ploski - 2018-11-14

    Try specifying an aboslute path to Perl executable in Window > Preferences > Perl.
    Check workspace/.metadata/.log if it contains more details about why the exectuion failed.

    What's supposed to happen when you invoke the Source > Format function is that the command line you quoted as failed is executed in working directory workspace/.metadata/.plugins/org.epic.perleditor/perlutils/perltidy - into which the perltidy version shipped with EPIC is extracted beforehand.

     
  • Codenascher

    Codenascher - 2018-11-14

    Thank you for your quick answer.

    Try specifying an aboslute path to Perl executable in Window > Preferences > Perl. Check workspace/.metadata/.log if it contains more details about why the exectuion failed.

    Sadly after setting an absolute path the error stays the same.

    Here is excerpt for my log file:

    !ENTRY org.epic.perleditor 4 0 2018-11-14 15:03:00.126
    !MESSAGE Failed to execute command line: "C:\Perl\bin\Perl.exe" "perltidy" "-q" "--indent-columns=4" "--maximum-line-length=200" "--opening-brace-on-new-line" "--line-up-parentheses"
    !STACK 0
    java.io.IOException: Die Pipe wurde beendet
        at java.io.FileOutputStream.writeBytes(Native Method)
        at java.io.FileOutputStream.write(Unknown Source)
        at java.io.BufferedOutputStream.write(Unknown Source)
        at sun.nio.cs.StreamEncoder.writeBytes(Unknown Source)
        at sun.nio.cs.StreamEncoder.implWrite(Unknown Source)
        at sun.nio.cs.StreamEncoder.write(Unknown Source)
        at sun.nio.cs.StreamEncoder.write(Unknown Source)
        at java.io.OutputStreamWriter.write(Unknown Source)
        at java.io.Writer.write(Unknown Source)
        at org.epic.core.util.ProcessExecutor.execute(ProcessExecutor.java:177)
        at org.epic.core.util.ProcessExecutor.execute(ProcessExecutor.java:71)
        at org.epic.core.util.PerlExecutor.execute(PerlExecutor.java:100)
        at org.epic.core.util.ScriptExecutor.run(ScriptExecutor.java:80)
        at org.epic.perleditor.editors.util.SourceFormatter.format(SourceFormatter.java:58)
        at org.epic.perleditor.editors.util.SourceFormatter.format(SourceFormatter.java:42)
        at org.epic.perleditor.actions.FormatSourceAction.runFormatter(FormatSourceAction.java:127)
        at org.epic.perleditor.actions.FormatSourceAction.doRun(FormatSourceAction.java:45)
        at org.epic.perleditor.actions.PerlEditorAction.run(PerlEditorAction.java:37)
        at org.eclipse.jface.action.Action.runWithEvent(Action.java:476)
        at org.eclipse.jface.commands.ActionHandler.execute(ActionHandler.java:121)
        at org.eclipse.ui.internal.handlers.E4HandlerProxy.execute(E4HandlerProxy.java:96)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:58)
        at org.eclipse.e4.core.internal.di.InjectorImpl.invokeUsingClass(InjectorImpl.java:320)
        at org.eclipse.e4.core.internal.di.InjectorImpl.invoke(InjectorImpl.java:254)
        at org.eclipse.e4.core.contexts.ContextInjectionFactory.invoke(ContextInjectionFactory.java:164)
        at org.eclipse.e4.core.commands.internal.HandlerServiceHandler.execute(HandlerServiceHandler.java:156)
        at org.eclipse.core.commands.Command.executeWithChecks(Command.java:497)
        at org.eclipse.core.commands.ParameterizedCommand.executeWithChecks(ParameterizedCommand.java:490)
        at org.eclipse.e4.core.commands.internal.HandlerServiceImpl.executeHandler(HandlerServiceImpl.java:207)
        at org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher.executeCommand(KeyBindingDispatcher.java:308)
        at org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher.press(KeyBindingDispatcher.java:582)
        at org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher.processKeyEvent(KeyBindingDispatcher.java:651)
        at org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher.filterKeySequenceBindings(KeyBindingDispatcher.java:441)
        at org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher.access$2(KeyBindingDispatcher.java:384)
        at org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher$KeyDownFilter.handleEvent(KeyBindingDispatcher.java:96)
        at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:89)
        at org.eclipse.swt.widgets.Display.filterEvent(Display.java:1193)
        at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1054)
        at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1079)
        at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1064)
        at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1106)
        at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1102)
        at org.eclipse.swt.widgets.Widget.wmChar(Widget.java:1489)
        at org.eclipse.swt.widgets.Control.WM_CHAR(Control.java:4888)
        at org.eclipse.swt.widgets.Canvas.WM_CHAR(Canvas.java:353)
        at org.eclipse.swt.widgets.Control.windowProc(Control.java:4768)
        at org.eclipse.swt.widgets.Canvas.windowProc(Canvas.java:348)
        at org.eclipse.swt.widgets.Display.windowProc(Display.java:4784)
        at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method)
        at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:2309)
        at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3559)
        at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$5.run(PartRenderingEngine.java:1173)
        at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:339)
        at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1062)
        at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:156)
        at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:628)
        at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:339)
        at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:563)
        at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:151)
        at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:155)
        at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:199)
        at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:137)
        at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:107)
        at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:391)
        at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:246)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:659)
        at org.eclipse.equinox.launcher.Main.basicRun(Main.java:595)
        at org.eclipse.equinox.launcher.Main.run(Main.java:1501)
    
     
    • Jan Ploski

      Jan Ploski - 2018-11-14

      Try running that comand line yourself from the cmd.exe prompt, after changing to the working directory mentioned in my first reply and piping the source file to be formatted as standard input. It may be that perltidy is aborting for some reason, perhaps because of the content of your source file. Does it work with other ("Hello world") files?

       
  • Codenascher

    Codenascher - 2018-11-14

    I also tried to get around this by setting the .perltidyrc into my project root folder but this neither helped.

     
  • Codenascher

    Codenascher - 2018-11-14

    Hmm, ...

    It looks like perltidy can not find the Tidy.pm module in the Perl subfolder.

    "C:\Perl\bin\Perl.exe" "C:\Projects\Perl\.metadata\.plugins\org.epic.perleditor\perlutils\perltidy\perltidy" "-q" "--indent-columns=4" "--maximum-line-length=200" "--opening-brace-on-new-line" "--line-up-parentheses" "C:\Projects\Perl\PTests\ptest_FnkCall.pl"
    Can't locate Perl/Tidy.pm in @INC (@INC contains: C:/Perl/lib C:/Perl/site/lib .) at C:\Projects\Perl\.metadata\.plugins\org.epic.perleditor\perlutils\perltidy\perltidy line 4.
    BEGIN failed--compilation aborted at C:\Projects\Perl\.metadata\.plugins\org.epic.perleditor\perlutils\perltidy\perltidy line 4.
    

    Here is an dir output that proofs the folder and file exists:
    C:\Projects\Perl.metadata.plugins\org.epic.perleditor\perlutils\perltidy\perltidy
    C:\Projects\Perl.metadata.plugins\org.epic.perleditor\perlutils\perltidy\Perl\Tidy.pm

    It should check the subfolders of current caller path:

    @INC

    The array @INC contains the list of places that the do EXPR , require, or use constructs look for their library files. It initially consists of the arguments to any -I command-line switches, followed by the default Perl library, probably /usr/local/lib/perl, followed by ".", to represent the current directory. ("." will not be appended if taint checks are enabled, either by -T or by -t , or if configured not to do so by the -Ddefault_inc_excludes_dot compile time option.)

    BTW, the Taint mode is not checked in the EPIC settings.

     
    • Jan Ploski

      Jan Ploski - 2018-11-14

      You are probably in wrong directory. You're supposed to "cd \Projects\Perl.metadata.plugins\org.epic.perleditor\perlutils" first and then run the "C:\Perl\bin\Perl.exe" perltidy params < sourcefile.pl from there.

       
  • Codenascher

    Codenascher - 2018-11-14

    Ok, I got it!

    Can't locate Encode.pm in @INC (@INC contains: C:/Perl/lib C:/Perl/site/lib .) at Perl/Tidy.pm line79.
    

    It seems that my Perl installation is missing the Encode module. I've tried another Perl version (just an old test installation 5.14.x) in which the module exists and et voila it works!

    Now I need to convince my IT admins to release a newer version with the module, but this is not your problem.

    Please close this ticket.

    Many Thanks for your help
    Andreas

     

    Last edit: Codenascher 2018-11-14
    • Jan Ploski

      Jan Ploski - 2018-11-14

      Ouch, I now see that you mentioned Perl 5.6 - this is 18 years old by now... Yes, you should use a more recent Perl version.

       

Log in to post a comment.