Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add extension to Configuration Profiles #5777

Merged
merged 9 commits into from Sep 21, 2018

Conversation

Projects
None yet
2 participants
@rhwood
Copy link
Contributor

commented Sep 10, 2018

In iOS and macOS, application sandboxing (not currently applicable to JMRI) will require that developers use OS-provided mechanisms to request user approval access to each and every file in a Configuration Profile unless that profile is recognized by the iOS or macOS system as a package, or a directory with a specific extension. This PR causes JMRI applications to add the .jmri extension to new Configuration Profiles and allows users to manually (outside of JMRI) add that extension to existing Configuration Profiles without losing the renamed Configuration Profile in the list of available profiles at application start or in the Config Profiles preferences list.

This PR does not cause macOS to allow launching JMRI by double clicking on a .jmri package, nor does it include the Uniform Type Identifier definitions for a .jmri extension, since doing so would cause Configuration Profile directories to appear as files in macOS (the diff to the Info.plist files in attached as InfoTemplate-with-UTI.diff.txt).

The problem that led to this PR is that, although a user can grant a sandboxed application access to his home directory (and everything underneath it) in macOS, no such mechansism exists in iOS. I am working on a throttle that allows a user to keep a Configuration Profile containing a roster in Dropbox, Google Drive, iCloud, Azure Drive, or most any other cloud file system, and use that roster with LNWI. Under the current non-package directory structure, the iOS security and privacy restrictions would allow the app to read just the roster.xml (from a deliberately unique and non-traceable URL) and not show any associated images or full XML files unless I asked the user to navigate through a file picker for each image or XML file.

The use case for the iOS app for which this is done is supporting NTRAK or T-TRAK layouts where each participant in the layout is using JMRI at home to maintain his or her roster, using an iOS device as the throttle, but depending on a club-provided LNWI or JMRI instance as the WiThrottle server for the layout.

Absent this PR, JMRI users could add the .jmri extension to Configuration Profile directories manually and point JMRI to use the profiles in those directories without issue; this PR just makes that a little easier.

I don't know where the UTI in the attached diff should be documented in the technical documentation; if someone can point me to where that should be documented, I can update this PR with that documentation.

rhwood added some commits Sep 9, 2018

As changed by Xcode
Xcode changed the DTD and version of the Info.plist file. Since the DTD was published in 2007, it seems no macOS version supported by JMRI does not support it.
Prevent TemplateApp.app from being registered as an app
Rename Info.plist to InfoTemplate.plist in TemplateApp.app to prevent LaunchServices from registering TemplateApp.app as an application.
Add `.jmri` to profile directory names.
Add `.jmri` to profile directory names when creating new profiles in JMRI applications, but do not require that extension be used. Handle the case where a user has manually added `.jmri` to an existing profile directory name.
@rhwood

This comment has been minimized.

Copy link
Contributor Author

commented Sep 10, 2018

If you experimentally merge InfoTemplate-with-UTI.diff.txt into scripts/MacOSXapps/TemplateApp.app/Contents/InfoTemplate.plist and build the macOS distribution, you can recover from doing that by running ant clean against the JMRI sources, ensuring you've deleted all copies of JMRI apps containing the diff, and then run:

/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -kill

to remove the association. You may have to restart the Finder after doing that as well.

Update Profile tests
Since new Profile objects may append ".jmri" to the path when creating a folder, make sure that folder paths used in comparisons match the actual folder created.
@bobjacobsen

This comment has been minimized.

Copy link
Member

commented Sep 10, 2018

First, thanks for all this. Appreciate the detail.

I don't know where the UTI in the attached diff should be documented in the technical documentation; if someone can point me to where that should be documented, I can update this PR with that documentation.

I think documenting the macOS-specific detail on the Startup Scripts page page would make it easiest to find. Perhaps adding a mention of the .jmri suffix to the App Preferences page would help too.

@bobjacobsen

This comment has been minimized.

Copy link
Member

commented Sep 10, 2018

Restarting Travis graphical CI after:

[ERROR] Failures: 

[ERROR]   CheckForUpdateActionTest.tearDown:29 Unexpected ERROR or higher messages emitted

[ERROR] Errors: 

[ERROR]   DispatcherProTest.testLaunchEasyDcc:89->Object.wait:502->Object.wait:-2 » TestTimedOut

[ERROR]   DispatcherProTest.testLaunchGrapevine:119->Object.wait:502->Object.wait:-2 » TestTimedOut

[ERROR]   DispatcherProTest.testLaunchInitLoop:207->Object.wait:502->Object.wait:-2 » TestTimedOut

[ERROR]   DispatcherProTest.testLaunchLocoNet:57->Object.wait:502->Object.wait:-2 » TestTimedOut

The log is attached for additional information.

log.txt

@bobjacobsen

This comment has been minimized.

Copy link
Member

commented Sep 10, 2018

AppVeyor seems to have had similar issues to Travis graphical, but with cleaner output report:

3430    [junit] Testcase: testCTor(apps.InstallTest.InstallTestTest):SKIPPED: Causes Exception
3431    [junit] Testcase: testLaunchInitLoop(apps.DecoderPro.DecoderProTest):	Caused an ERROR
3432    [junit] test timed out after 20 seconds
3433    [junit] org.junit.runners.model.TestTimedOutException: test timed out after 20 seconds
3434    [junit] 	at java.lang.Object.wait(Native Method)
3435    [junit] 	at java.lang.Object.wait(Object.java:502)
3436    [junit] 	at java.awt.WaitDispatchSupport.enter(WaitDispatchSupport.java:264)
3437    [junit] 	at java.awt.Dialog.show(Dialog.java:1084)
3438    [junit] 	at javax.swing.JOptionPane.showOptionDialog(JOptionPane.java:869)
3439    [junit] 	at javax.swing.JOptionPane.showMessageDialog(JOptionPane.java:666)
3440    [junit] 	at javax.swing.JOptionPane.showMessageDialog(JOptionPane.java:637)
3441    [junit] 	at apps.Apps.<init>(Apps.java:170)
3442    [junit] 	at apps.DecoderPro.DecoderPro.<init>(DecoderPro.java:46)
3443    [junit] 	at apps.DecoderPro.DecoderPro.main(DecoderPro.java:150)
3444    [junit] 	at apps.DecoderPro.DecoderProTest.testLaunchInitLoop(DecoderProTest.java:181)
3445    [junit] 	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
3446    [junit] 	at java.lang.Thread.run(Thread.java:748)
3447    [junit] 
3448    [junit] 
3449    [junit] Testcase: testLaunchSprog(apps.DecoderPro.DecoderProTest):SKIPPED
3450    [junit] Testcase: testLaunchTmcc(apps.DecoderPro.DecoderProTest):	FAILED
3451    [junit] "first Info line seen" did not occur in time
3452    [junit] junit.framework.AssertionFailedError: "first Info line seen" did not occur in time
3453    [junit] 	at jmri.util.JUnitUtil.waitFor(JUnitUtil.java:334)
3454    [junit] 	at apps.DecoderPro.DecoderProTest.testLaunchTmcc(DecoderProTest.java:125)
3455    [junit] 	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
3456    [junit] 	at java.lang.Thread.run(Thread.java:748)

rhwood added some commits Sep 10, 2018

Ignore tmp.ser files
This appears to be an RMI-related file generated while running tests.
Verify path to active profile hasn't been renamed.
Also, when creating the default profile, only append `.jmri` to the path, not to the name or id.
@bobjacobsen

This comment has been minimized.

Copy link
Member

commented Sep 11, 2018

The tmp.ser file was being created by the organic tests for the com.dictiography.collections code that's now resident in jmri.org.com.dictiography.collections. That was cleaned up in PR #5772.

@bobjacobsen

This comment has been minimized.

Copy link
Member

commented Sep 11, 2018

Travis:


scanhelp:
     [exec] help/en/html/doc/Technical/StartUpScripts.shtml line 314 column 7 - Warning: missing </code> before <pre>
     [exec] help/en/html/doc/Technical/StartUpScripts.shtml line 348 column 13 - Warning: discarding unexpected </code>
     [exec] help/en/html/doc/Technical/StartUpScripts.shtml line 314 column 7 - Warning: trimming empty <code>
[INFO] ------------------------------------------------------------------------

rhwood added some commits Sep 12, 2018

@rhwood

This comment has been minimized.

Copy link
Contributor Author

commented Sep 16, 2018

Is there anything more you want me to do on this?

@bobjacobsen

This comment has been minimized.

Copy link
Member

commented Sep 21, 2018

@rhwood Thanks for all the detail on this. I'm merging the PR. I put this in the release note:

Starting with this release, JMRI will create new profile directories with the
suffix ".jmri". This allows them to be more properly accessed in macOS/iOS
eco-system (we do it on all platforms for people who share profiles between
different types of computers). It also allows people to rename their
profiles (outside of JMRI, i.e. through their computer's file browser)
with a .jmri ending.

Let me know if that needs more/less/different info.

@bobjacobsen bobjacobsen added this to the 4.13.4 milestone Sep 21, 2018

@bobjacobsen bobjacobsen merged commit 75e4e63 into JMRI:master Sep 21, 2018

4 checks passed

WIP ready for review
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
coverage/coveralls First build on master at 43.114%
Details
@rhwood

This comment has been minimized.

Copy link
Contributor Author

commented Sep 21, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.