console mode not responding to user input [5.0.6]

123 views
Skip to first unread message

Steve Maring

unread,
Jan 20, 2016, 12:51:04 PM1/20/16
to izpack-user
Upgrading from 5.0.0-rc1 to 5.0.6 I find that my console installation no longer works.  If there is a lock file, the user gets:

The example-1.0.0-SNAPSHOT installer you are attempting to run seems to have a copy already running.

This could be from a previous failed installation attempt or you may have accidentally launched
the installer twice. The recommended action is to select 'No' and wait for the other copy of
the installer to start. If you are sure there is no other copy of the installer running, click
the 'Yes' button to allow this installer to run.

Are you sure you want to continue with this installation?
?
Enter Y for Yes, N for No:
y

nothing happens when you type "Y" and return ... its frozen

If I then go and blow out the lock file at c:\Users\smaring\AppData\Local\Temp\iz-example-1.0.0-SNAPSHOT.tmp I get the eula.txt, but cannot accept and continue on, it just freezes

< eula.txt contents >
Press 1 to accept, 2 to reject, 3 to redisplay
1


I have what amounts to this:

<resources>
<res id="LicencePanel.licence"
src="eula.txt" />
<res id="HTMLLicencePanel.licence"
src="eula.html" />
<res id="Installer.image"
src="image.png" />
</resources>
<jar src="mycustompanel.jar" stage="install" />

<panels>
<panel classname="com.example.MyHTMLLicencePanel" id="licensepanel"/>
<panel classname="TargetPanel" id="targetpanel"/>
<panel classname="InstallPanel" id="installpanel"/>
                <panel classname="SimpleFinishPanel" allowClose="true"/>
</panels>

with:

public class MyHTMLLicencePanel extends HTMLLicencePanel {

private static final long serialVersionUID = 1L;

public MyHTMLLicencePanel(
Panel panel, 
InstallerFrame installerFrame,
GUIInstallData guiInstallData, 
Resources resources,
Log log) {
super(panel, installerFrame, guiInstallData, resources, log);
}

}

public class MyHTMLLicenceConsolePanel extends HTMLLicenceConsolePanel {

public MyHTMLLicenceConsolePanel(PanelView<Console> panel, Resources resources) {
super(panel, resources);
}

@Override
protected String getText() {
StringBuffer stringBuffer = new StringBuffer();
stringBuffer.append(" \n\n \n\n");
try {
BufferedReader reader = new BufferedReader(
new InputStreamReader(
this.getClass().getClassLoader().getResourceAsStream("resources/LicencePanel.licence")
)
);
String line = "";
while ((line = reader.readLine()) != null) {
   stringBuffer.append(line + " \n\n");
}
} catch (Exception e) {
e.printStackTrace();
}

return stringBuffer.toString();
}
}

Thanks,
Steve

Steve Maring

unread,
Jan 22, 2016, 10:58:10 AM1/22/16
to izpack-user

 Well ... it seems that this works OK in Linux, which is really the only headless environment that we care about.   So, maybe this can be a backlog item to figure out why this isn't working in Windoze.

René Krell

unread,
Jan 22, 2016, 12:16:44 PM1/22/16
to izpack-user
Hi Steve,

I'd really try to reproduce this, but I'm busy in the moment with other issues towards the upcoming IzPack 5.0.7.
Just to let you know, I read this here. :-)
If you can, you might check also the 5.0.7-SNAPSHOT from the Sonatype OSS Snapshots repository. I deploy new snapshots almost every day for testing.

René


Dne středa 20. ledna 2016 18:51:04 UTC+1 Steve Maring napsal(a):

Steve Maring

unread,
Jan 22, 2016, 12:23:23 PM1/22/16
to izpack-user
Thanks Rene.

Yeah, I did my own local build out of github of 5.0.7-SNAPSHOT but got the same thing.  I'm not gonna get my panties in a wad about it ... hopefully QA doesn't either.

Kudos for the work. 
 

René Krell

unread,
Jan 24, 2016, 10:34:44 AM1/24/16
to izpack-user
On Windows, can you please launch the installer by adding the -DSTACKTRACE=true command line option?
Any interesting stacktrace here when hanging?


Dne pátek 22. ledna 2016 16:58:10 UTC+1 Steve Maring napsal(a):

Steve Maring

unread,
Jan 25, 2016, 3:43:16 PM1/25/16
to izpack-user
There are no errors, warnings, or stacktraces when I run with 5.0.6

When I build izpack locally (lastest d0815050a7b592d1a8140a0ec7c40024d2273859)

I get the same behavior when the lockfile is present.  When I blow away the lockfile and run

java -DDEBUG=true -DSTACKTRACE=true -jar installer.jar -console &> console.txt

console.txt then contains ...

FINE: Checking if OS constraints OsModel{arch='null', family='mac', jre='null', name='null', version='null'} match platform=windows,version=6.1,arch=x64,symbolicName=WINDOWS_7,javaVersion=1.7.0_80
Jan 25, 2016 3:37:24 PM com.izforge.izpack.util.PlatformModelMatcher matches
FINE: OS constraints do not match platform=windows,version=6.1,arch=x64,symbolicName=WINDOWS_7,javaVersion=1.7.0_80
Jan 25, 2016 3:37:24 PM com.izforge.izpack.core.rules.RulesEngineImpl initStandardConditions
FINE: Initializing built-in conditions
Jan 25, 2016 3:37:24 PM com.izforge.izpack.core.rules.RulesEngineImpl initStandardConditions
FINE: Initializing built-in conditions for packs
Jan 25, 2016 3:37:24 PM com.izforge.izpack.core.data.DefaultVariables set
FINE: Dynamic variable 'MEDIA_PATH' unset
Jan 25, 2016 3:37:24 PM com.izforge.izpack.core.data.DefaultVariables refresh
FINE: Refreshing dynamic variables
Jan 25, 2016 3:37:24 PM com.izforge.izpack.core.data.DefaultVariables set
FINE: Dynamic variable 'TargetPanel.dir.unix' set to 'C:\Users\smaring/pentaho/pentaho-operations-mart-6.1-SNAPSHOT'
Jan 25, 2016 3:37:24 PM com.izforge.izpack.core.data.DefaultVariables set
FINE: Dynamic variable 'TargetPanel.dir.windows' set to 'C:\Users\smaring\pentaho\pentaho-operations-mart-6.1-SNAPSHOT'
Jan 25, 2016 3:37:24 PM com.izforge.izpack.installer.requirement.LockFileChecker check
FINE: Created lock file:C:\Users\smaring\AppData\Local\Temp\iz-pentaho-operations-mart-6.1-SNAPSHOT.tmp
Jan 25, 2016 3:37:24 PM com.izforge.izpack.core.data.DefaultVariables refresh
FINE: Refreshing dynamic variables
Jan 25, 2016 3:37:24 PM com.izforge.izpack.core.rules.RulesEngineImpl canShowPanel
FINE: Panel licensepanel unconditionally activated
Jan 25, 2016 3:37:24 PM com.izforge.izpack.installer.panel.AbstractPanelView canShow
FINE: Panel 'licensepanel' can be shown
Jan 25, 2016 3:37:24 PM com.izforge.izpack.core.data.DefaultVariables refresh
FINE: Refreshing dynamic variables
Jan 25, 2016 3:37:24 PM com.izforge.izpack.core.rules.RulesEngineImpl canShowPanel
FINE: Panel licensepanel unconditionally activated
Jan 25, 2016 3:37:24 PM com.izforge.izpack.installer.panel.AbstractPanelView canShow
FINE: Panel 'licensepanel' can be shown
Jan 25, 2016 3:37:24 PM com.izforge.izpack.core.data.DefaultVariables refresh
FINE: Refreshing dynamic variables
Jan 25, 2016 3:37:24 PM com.izforge.izpack.core.rules.RulesEngineImpl canShowPanel
FINE: Panel licensepanel unconditionally activated
Jan 25, 2016 3:37:24 PM com.izforge.izpack.installer.panel.AbstractPanelView canShow
FINE: Panel 'licensepanel' can be shown
Jan 25, 2016 3:37:24 PM com.izforge.izpack.core.data.DefaultVariables refresh
FINE: Refreshing dynamic variables
Jan 25, 2016 3:37:24 PM com.izforge.izpack.installer.console.ConsoleInstaller run
SEVERE: null
java.lang.StackOverflowError
        at java.lang.String.indexOf(String.java:1678)
        at java.lang.String.contains(String.java:2076)
        at com.izforge.izpack.util.StringTool.wordWrap(StringTool.java:332)
        at com.izforge.izpack.util.StringTool.wordWrap(StringTool.java:343)
        at com.izforge.izpack.util.StringTool.wordWrap(StringTool.java:343)
        at com.izforge.izpack.util.StringTool.wordWrap(StringTool.java:343)
        *** this is repeated thousands of times ***
[ Console installation FAILED! ]


So ... it seems the problem is somehow wordwrap related now.

-Steve

René Krell

unread,
Jan 25, 2016, 6:32:35 PM1/25/16
to izpac...@googlegroups.com
StringTool.wordWrap() is some new method in 5.0.7-SNAPSHOT.
Can you send me the license text you tested this against, please? In
case this is no secret....
I had a couple of licenses this method worked with.
> --
> You received this message because you are subscribed to the Google Groups
> "izpack-user" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to izpack-user...@googlegroups.com.
> To post to this group, send email to izpac...@googlegroups.com.
> Visit this group at https://groups.google.com/group/izpack-user.
> For more options, visit https://groups.google.com/d/optout.

René Krell

unread,
Jan 26, 2016, 5:54:25 PM1/26/16
to izpack-user
I think there is something to new to try for you in the current izpack/master.
I fixed word-wrapping and in case of problems with local terminals word-wrapping and paging can be activated on demand now depending on the format of the license text. See https://izpack.atlassian.net/browse/IZPACK-1318.
For your license file I'd recommend this configuration in install.xml:

<panel classname="LicencePanel" id="panel.license">
    <configuration>
        <param name="console-text-paging" value="true" />
        <param name="console-text-wordwrap" value="false" />
    </configuration>
</panel>

You have it well-formatted with quite short lines which should fit each "normal" terminal width and with word-wrapping you would just loose leading explicit whitespace characters in some lines.
To be honest, I haven't still checked in Windows, just for Linux. For 5.0.7 I'd like to have this clean also for Windows.

Give it a try, please, and let us know how it works (or doesn't).


Dne pondělí 25. ledna 2016 21:43:16 UTC+1 Steve Maring napsal(a):

René Krell

unread,
Jan 26, 2016, 5:56:37 PM1/26/16
to izpack-user
Forgot to mention:
This matches for all console panel types which inherit from AbstractTextConsolePanel, thus also HTMLLicencePanel.


Dne úterý 26. ledna 2016 23:54:25 UTC+1 René Krell napsal(a):

Steve Maring

unread,
Jan 28, 2016, 9:52:52 AM1/28/16
to izpack-user
I get this and then it refuses to respond to input ...

$ java -jar installer.jar -console
Jan 28, 2016 9:43:15 AM INFO: Logging initialized at level 'INFO'
Jan 28, 2016 9:43:15 AM INFO: Commandline arguments: -console
Jan 28, 2016 9:43:15 AM INFO: Detected platform: windows,version=6.1,arch=x64,symbolicName=WINDOWS_7,javaVersion=1.7.0_80
paging: true
wordwrap: false

--More--


<panels>
  <panel classname="com.pentaho.engops.eula.izpack.PentahoHTMLLicencePanel" id="licensepanel">
     <configuration>
       <param name="console-text-paging" value="true" />
       <param name="console-text-wordwrap" value="false" />
     </configuration>
  </panel>
  <panel classname="TargetPanel" id="targetpanel"/>
  <panel classname="InstallPanel" id="installpanel"/>
  <panel classname="SimpleFinishPanel" allowClose="true"/>
</panels>
 
Is it possible my panel ids are an issue?  I noticed you had id="panel.license"

René Krell

unread,
Jan 28, 2016, 10:22:21 AM1/28/16
to izpac...@googlegroups.com
Hi Steve,

2016-01-28 15:52 GMT+01:00 Steve Maring <steve....@gmail.com>:
> I get this and then it refuses to respond to input ...
>
> $ java -jar installer.jar -console
> Jan 28, 2016 9:43:15 AM INFO: Logging initialized at level 'INFO'
> Jan 28, 2016 9:43:15 AM INFO: Commandline arguments: -console
> Jan 28, 2016 9:43:15 AM INFO: Detected platform:
> windows,version=6.1,arch=x64,symbolicName=WINDOWS_7,javaVersion=1.7.0_80
> paging: true
> wordwrap: false

The previous two lines are a forgotten debug output noise to the
standard error stream, I'll remove this.

>
> --More--

I will try to check this with your license text on Windows 7 as soon
as I can, be patient.

>
>
> <panels>
> <panel classname="com.pentaho.engops.eula.izpack.PentahoHTMLLicencePanel"
> id="licensepanel">
> <configuration>
> <param name="console-text-paging" value="true" />
> <param name="console-text-wordwrap" value="false" />
> </configuration>
> </panel>
> <panel classname="TargetPanel" id="targetpanel"/>
> <panel classname="InstallPanel" id="installpanel"/>
> <panel classname="SimpleFinishPanel" allowClose="true"/>
> </panels>
>
> Is it possible my panel ids are an issue? I noticed you had
> id="panel.license"

No. You can choose the panel id by your own, they just have to be unique.

René

René Krell

unread,
Jan 30, 2016, 2:59:19 AM1/30/16
to izpack-user
Can you please activate again stacktraces, please?
java -DSTACKTRACE=true -jar installer.jar -console
Any stacktrace when hanging?
Please retry with the activated stacktraces unless this will be fixed.


Dne čtvrtek 28. ledna 2016 15:52:52 UTC+1 Steve Maring napsal(a):

René Krell

unread,
Jan 31, 2016, 6:47:18 AM1/31/16
to izpack-user
Hi Steve,

I checked the HTMLLicencePanel (the built-in one, not your custom type) and found there has been some lack of implementation regarding the console mode (HTMLLicenceConsolePanel). I fixed this and with the current izpack/master branch I found no problems left regarding wrapping and paging for both OS, Linux and Windows 7, using the license text you sent me and also some unformatted one. I have no hardware for testing on Mac OS X.

See IZPACK-1324IZPACK-1318 and the couple of pull requests referred to from these issues.
Furthermore I fixed some small auto-wrapping problem on Windows terminals (which you haven't been used, though).

I'd recommend the following:
If your custom panel implementations are the same like you sent they make no longer sense, you can remove them and use HTMLLicencePanel directly.
In case you still need customization here refer to the built-in implementations of HTMLLicencePanel and HTMLLicenceConsolePanel.

This should normally solve your problems.

René


Dne středa 20. ledna 2016 18:51:04 UTC+1 Steve Maring napsal(a):
Upgrading from 5.0.0-rc1 to 5.0.6 I find that my console installation no longer works.  If there is a lock file, the user gets:

René Krell

unread,
Feb 1, 2016, 4:21:33 AM2/1/16
to izpack-user
I'd recommend the following:
If your custom panel implementations are the same like you sent they make no longer sense, you can remove them and use HTMLLicencePanel directly.
In case you still need customization here refer to the built-in implementations of HTMLLicencePanel and HTMLLicenceConsolePanel.

Just got to add, if you just have a plain text without HTML tags and you don't need a second instance of a license panel you should use just LicencePanel, which has the same behavior except it doesn't try to strip HTML tags from the license text.

Steve Maring

unread,
Feb 8, 2016, 2:15:43 PM2/8/16
to izpack-user
I've built the latest (as of today) and this still isn't working in Windows.

<panels>
   <panel classname="LicencePanel" id="licensepanel">
      <configuration>
        <param name="console-text-paging" value="true" />
        <param name="console-text-wordwrap" value="true" />
      </configuration>
   </panel>
   <panel classname="TargetPanel" id="targetpanel"/>
   <panel classname="InstallPanel" id="installpanel"/>
   <panel classname="SimpleFinishPanel" allowClose="true"/>
</panels>

I've removed all the line wrapping from the original license text file.  It displays perfectly in Linux, but Windows displays the text as though there was not a single line break in the entire file, does not paginate, and does not respond to user input.

nothing interesting to see in debug unfortunately

-Steve


René Krell

unread,
Feb 8, 2016, 3:32:57 PM2/8/16
to izpac...@googlegroups.com
I couldn't unfortunately reproduce this on Windows 7.
With the license file you sent me it worked perfectly on Linux and
Windows 7. I wonder what might be special about a Windows terminal
elsewhere.
Is it still the license file you sent me? Maybe there are changed line
separators during the mail transport, can you please try resending it
in a ZIP, please?

René Krell

unread,
Feb 8, 2016, 4:13:34 PM2/8/16
to izpac...@googlegroups.com
2016-02-08 20:15 GMT+01:00 Steve Maring <steve....@gmail.com>:
>
> nothing interesting to see in debug unfortunately
>

Did you use -DSTACKTRACE=true ? This is important because a hanging
installer is in most cases caused by some uncaught RuntimeException.

Steve Maring

unread,
Feb 8, 2016, 7:29:26 PM2/8/16
to izpack-user
well ... I just tried a few different things ...

I tried JDK 1.7 and 1.8.  Then I did something I usually don't do, I opened a Windows command console directly.  I navigated to the directory, and it WORKED!  proper word wrap, pagination, accepted user input ... everything.

What I've been using in Windows is the Git Bash console.  If I run into a bat file or something, I would just issue a cmd.exe and run from there.  If I type cmd.exe from Git Bash and then java -jar installer.jar -console, it will still be frozen like with Git Bash.  It only seems to work with cmd.exe directly.

There must be something strange happening with the tty or something.

I'm gonna say that this is probably out-of-scope for your efforts.  If somebody is trying to do console stuff on Windows, the expectation is that they are using cmd.exe directly.  I'm gonna at least log this behavior with our support center in case somebody out there ends up seeing this.  I know the usage of Git Bash in Windows is increasing in popularity.

Thanks for your efforts Rene.

-Steve 

René Krell

unread,
Feb 9, 2016, 3:38:32 AM2/9/16
to izpac...@googlegroups.com
Yeah, we use the JLine library internally for detecting terminal settings, like height and width, and whether the terminal inserts a newline automatically on writing a character in the last column..
This gets probably messed up by Git Bash. Best would be a report to JLine, but this should include a reproducable example.

What we could definitely do is deactivating JLine optionally (there is an internal fallback if terminal initialization fails). So we could force this fallback to happen. This would have some implications, mainly there would be assumed a terminal size of 80x24 statically, and if the terminal would have an actual different size word-wrapping and paging may not look nice.

If I will have some minutes I could try this Git bash thing, to get a clue what internally happens in the installer using it.

--

René Krell

unread,
Feb 14, 2016, 4:43:41 PM2/14/16
to izpack-user
You might try te latest snapshot 5.0.7-SNAPSHOT-*-14 and use the following section in install.xml:

<consoleprefs>
  <detectTerminal>false</detectTerminal>
</consoleprefs>


This should deactivate the JLine ConsoleReader and use the standard Java Console facility for console mode installations.
Give it a try, maybe there are still some pitfalls.
We can add this also as a command line option.
There might be more terminal types affected out in the wild.


René


Dne úterý 9. února 2016 1:29:26 UTC+1 Steve Maring napsal(a):

Steve Maring

unread,
Feb 15, 2016, 1:40:43 PM2/15/16
to izpack-user
pulled from origin and added

<consoleprefs>
    <detectTerminal>false</detectTerminal>
</consoleprefs>

<panels>
    <panel classname="LicencePanel" id="licensepanel">
      <configuration>
        <param name="console-text-paging" value="true" />
        <param name="console-text-wordwrap" value="true" />
      </configuration>
    </panel>
    <panel classname="TargetPanel" id="targetpanel"/>
    <panel classname="InstallPanel" id="installpanel"/>
    <panel classname="SimpleFinishPanel" allowClose="true"/>
</panels>

inside Git Bash that got me:

null
java.lang.NullPointerException
        at com.izforge.izpack.util.Console.flush(Console.java:167)
        at com.izforge.izpack.util.Console.paging(Console.java:232)
        at com.izforge.izpack.util.Console.printMultiLine(Console.java:201)
        at com.izforge.izpack.installer.console.AbstractTextConsolePanel.run(AbstractTextConsolePanel.java:90)
        at com.izforge.izpack.installer.console.ConsoleInstallAction.run(ConsoleInstallAction.java:64)
        at com.izforge.izpack.installer.console.ConsolePanels.switchPanel(ConsolePanels.java:105)
        at com.izforge.izpack.installer.console.ConsolePanels.switchPanel(ConsolePanels.java:37)
        at com.izforge.izpack.installer.panel.AbstractPanels.switchPanel(AbstractPanels.java:513)
        at com.izforge.izpack.installer.panel.AbstractPanels.next(AbstractPanels.java:255)
        at com.izforge.izpack.installer.panel.AbstractPanels.next(AbstractPanels.java:235)
        at com.izforge.izpack.installer.console.ConsoleInstaller.run(ConsoleInstaller.java:167)
        at com.izforge.izpack.installer.bootstrap.Installer.launchConsoleInstaller(Installer.java:263)
        at com.izforge.izpack.installer.bootstrap.Installer.launchInstall(Installer.java:226)
        at com.izforge.izpack.installer.bootstrap.Installer.start(Installer.java:194)
        at com.izforge.izpack.installer.bootstrap.Installer.main(Installer.java:73)

[ Console installation FAILED! ]

and in cmd.exe itself, the word wrapping is haphazard.  It wraps about 85% of the lines at 2/3 the width.

btw ... I can't seem to get the html license to show in the HTMLLicensePanel anymore, I just get the txt version there.  Every time I try to configure HTMLLicensePanel the console paging and wordwrap config seems to be lost.

-Steve

René Krell

unread,
Feb 15, 2016, 3:05:22 PM2/15/16
to izpac...@googlegroups.com
Hi Steve,

for your license file it is better to switch off the word-wrapping, as already mentioned, because you have a well pre-formatted one with explicit line breaks. I guess this is the reason why it probably seems word-wrapping not working nice to you. It is probably not word-wrapping, but your explicit linebreaks, which make it wrap at 2/3 of the line, please check this against your original text. I'd leave paging on and wrapping off, this should get you to the best results.

You have a HTML version of your license file? Can you send this again, please? I just got a text version to this time.

I'll check this again, also the NullPointer for the console fallback mode.

René


--

René Krell

unread,
Feb 17, 2016, 11:22:44 AM2/17/16
to izpack-user
Hi Steve,

please check it with the latest master from our "blessed" repository.
I fixed also several issues when using the fallback console mode with <detectTerminal>false</detectTerminal>.

I checked both, the LicencePanel as the HTMLLicencePanel with the files you sent.

There are some drawbacks:
- Your HTML license file is in Windows 1252 encoding, IzPack doesn't parse this from the HTML header, since the HTML stripping is very simple. It uses UTF-8 by default for reading the HTML file from the resource.
  At the moment this implies the explicit quote characters '"' to end up in some broken output in the stripped plain text.
  In future, we could use a 3rd-party HTML parser which does this job, but which would imply adding an additional set of <jar> tags to the installer. If one will have time for this.
  Meanwhile you could maybe convert the file to UTF-8 and use the escaped double quotation mark &quot; instead of ".
- I removed the -- More -- line from the footer during paging fro the console fallback mode, because this messes up the output if the terminal height is not known and does not match the physical height.

The fallback mode is really just legacy stuff and terminal initialization with JLine gives an overall better experience in console mode installations.

Please drop a note whether it works for you.

René


Dne pondělí 15. února 2016 19:40:43 UTC+1 Steve Maring napsal(a):
Reply all
Reply to author
Forward
0 new messages