Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 314977

Summary: [terminal][local] Confusing error when trying to install Local Terminal on Windows from Helios
Product: [Tools] Target Management Reporter: Martin Oberhuber <mober.at+eclipse>
Component: TerminalAssignee: Mirko Raner <mirko>
Status: RESOLVED FIXED QA Contact: Martin Oberhuber <mober.at+eclipse>
Severity: major    
Priority: P2 CC: eclipse, mirko, uwe.st
Version: 3.2Flags: mober.at+eclipse: pmc_approved+
uwe.st: review+
Target Milestone: 3.2 RC4   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Bug Depends on: 302196, 314193    
Bug Blocks:    
Attachments:
Description Flags
Patch to disable the Local Terminal Connector if PTYs are not supported
mober.at+eclipse: iplog+
Patch slightly improved none

Description Martin Oberhuber CLA 2010-05-29 06:28:04 EDT
+++ This bug was initially created as a clone of Bug #314193 +++

Since the Eclipse-PlatformFilter for terminal.local is only implemented in the plugin MANIFEST.MF, p2 creates a confusing error message when trying to install it on Windows:

  Cannot complete the install because one or more required items could not be
  found.
    Software being installed: Local Terminal (Incubation)
  0.1.0.v201005271445-41A78y8DfD-IAL88B883222
  (org.eclipse.tm.terminal.local.feature.group
  0.1.0.v201005271445-41A78y8DfD-IAL88B883222)
    Missing requirement: Local Terminal (Incubation)
  0.1.0.v201005271445-41A78y8DfD-IAL88B883222
  (org.eclipse.tm.terminal.local.feature.group
  0.1.0.v201005271445-41A78y8DfD-IAL88B883222) requires
    'org.eclipse.tm.terminal.local [0.1.0.v201005271100]'
  but it could not be found

This is essentially the same problem as I've been seeing for WinCE on Linux
(documented in bug 236026). For WinCE, the issue was not that bad sine we don't
provide WinCE on the Helios aggregated site. The minimum requirement here is creating an error message like the Linuxtools project does -- by setting a platform filter in the feature.xml:

  Cannot complete the install because some dependencies are not satisfiable
    org.eclipse.linuxtools.lttng.feature.group [0.2.0.201005261305] cannot
  be installed in this environment because its filter is not applicable.

Experiments on bug 314193 have shown that this is not possible with our legacy builder, so we will need to switch to the Athena builder for making this happen as per bug 302196.

Eventually, we will want p2 to provide even better error messages, or completely hide a feature that's not installable - see bug 236026 comment 19.
Comment 1 Martin Oberhuber CLA 2010-06-03 02:28:08 EDT
I think we need to take a totally different approach on this.

My point is that the only reason why Local Terminal doesn't work on Windows is that the CDT's PTY doesn't work as expected on Windows. I expect the very same issue to happen on other architectures where CDT reports

   PTY.isSupported() == false

Therefore, I think that we should enable / disable Terminal support more dynamically. Rather than putting a hard-coded restriction on the MANIFEST.MF (and feature.xml), we should always allow installing the bundle but when it comes to creating a new "Local Terminal" connection, inspect whether PTY.isSupported() returns true and if not, issue an error message and disable the connector.

We have been using exactly the same strategy for the Serial Terminal Connector. Its RXTX dependency is optional, and when RXTX cannot be loaded, we issue the error message (by catching an Exception).

Mirko, can you contribute a patch which provides this? - Quite frankly, given the Build Problems we had (and have) with putting the bundle restriction in, I think that this is the one and only way how we can possibly get local.terminal into Helios.
Comment 2 Mirko Raner CLA 2010-06-03 14:33:25 EDT
Yes, I can put together a patch later today.
It might be a close call for RC4, though. When exactly will the RC4 build start?
Comment 3 Mirko Raner CLA 2010-06-04 03:39:00 EDT
Created attachment 171072 [details]
Patch to disable the Local Terminal Connector if PTYs are not supported

I followed the example that is set in SerialConnector, and the unavailability of the LocalTerminalConnector on certain platforms is now handled in the same fashion.
As a minor improvement, I also replaced Format.format(...) with NLS.bind(...) as mentioned in bug 314195 comment 11.
Comment 4 Martin Oberhuber CLA 2010-06-04 08:23:29 EDT
Created attachment 171095 [details]
Patch slightly improved

Great work Mirko! I have only slightly improved the patch:

- Shortened the error message to be brief and readable, yet informative.
- Using Platform.getOS() instead of System.getProperty()... because what's
  relevant in terms of interpreting the error is avaialability of the CDT
  fragment which uses the OSGi specs (org.eclipse.cdt.core.win32.x86).
- Capitalized the connector name ("Local Program")
- Fixed a spelling error in terminal.view ("Connector... is not available")
Comment 5 Martin Oberhuber CLA 2010-06-04 08:25:28 EDT
Oh, yes, and of course I removed the offending Eclipse-PlatformFilter in MANIFEST.MF. The important point here is that it's not the local terminal connector's fault if a connector is not available... that solely depends on availability of the native PTY library in the org.eclipse.cdt.core.os.arch fragment. I think that we cover this really nicely now.

I need one committer's "review+" before I can commit this.
Uwe? Michael?
Comment 6 Martin Oberhuber CLA 2010-06-04 08:41:27 EDT
Comment on attachment 171072 [details]
Patch to disable the Local Terminal Connector if PTYs are not supported

Thanks for the quick review, Uwe - I have released the fix.
Comment 7 Martin Oberhuber CLA 2010-06-04 08:41:53 EDT
Released, please verify with the next I-build.
Comment 8 Martin Oberhuber CLA 2010-06-04 12:10:38 EDT
*** Bug 315751 has been marked as a duplicate of this bug. ***
Comment 9 Mirko Raner CLA 2010-06-04 14:06:21 EDT
(In reply to comment #4)

> - Shortened the error message to be brief and readable, yet informative.

Thanks, Martin. Writing short, concise, and properly spelled error or warning messages doesn't seem to be one of my strong points ;-)

> - Using Platform.getOS() instead of System.getProperty()... because what's

I actually used that initially, but I didn't like that it returns a short "moniker" instead of the real OS name as humans would write it. For example, on my Mac, the error message would say "macosx (x86_64) does not provide..." when I used Platform.getOS(), but "Mac OS X (x86_64) does not provide..." when I used the os.name property. I liked the latter option better, but it obviously doesn't make a big difference.

Thanks for all the work! I'm glad we could finally resolve this.
Comment 10 Martin Oberhuber CLA 2010-06-04 15:47:02 EDT
I'm glad you are glad ... but remember, we are only done when it's tested and verified. I want each 3.2RC4 fix to be verified with an actual install off the Helios repository and/or our download site.

An interim TM site is ready for testing:
http://download.eclipse.org/dsdp/tm/updates/3.2interim

I'm right now preparing the download bits and contributing to Helios.