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

No longer works #1

Closed
gingerbeardman opened this issue Apr 27, 2018 · 10 comments
Closed

No longer works #1

gingerbeardman opened this issue Apr 27, 2018 · 10 comments

Comments

@gingerbeardman
Copy link
Contributor

Doesn't work with latest iCloud location and CFPropertyList install using composer

@briansea
Copy link
Owner

@gingerbeardman Can you try now? I've pushed some changes.

Thanks for letting me know!

@gingerbeardman
Copy link
Contributor Author

gingerbeardman commented Apr 28, 2018

No such luck.

I had got to a similar point myself hacking a composer.json and making the require change.

so

$ composer install rodneyrehm/plist
Invalid argument rodneyrehm/plist. Use "composer require rodneyrehm/plist" instead to add packages to your composer.json.

this works better

$ composer install 
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 1 install, 0 updates, 0 removals
  - Installing rodneyrehm/plist (v2.0.1): Downloading (100%)         
Writing lock file
Generating autoload files

but

$ ./ulyssesToFiles.php 

Fatal error: Uncaught CFPropertyList\IOException: /Users/matt/Library/Mobile Documents/X5AZV975AG~com~soulmen~ulysses3/Documents/Library/Info.ulgroup in /Users/matt/Downloads/2018-04-28/ulysses3-export-master/vendor/rodneyrehm/plist/classes/CFPropertyList/IOException.php:68
Stack trace:
#0 /Users/matt/Downloads/2018-04-28/ulysses3-export-master/vendor/rodneyrehm/plist/classes/CFPropertyList/CFPropertyList.php(199): CFPropertyList\IOException::notReadable('/Users/matt/Lib...')
#1 /Users/matt/Downloads/2018-04-28/ulysses3-export-master/vendor/rodneyrehm/plist/classes/CFPropertyList/CFPropertyList.php(129): CFPropertyList\CFPropertyList->load()
#2 /Users/matt/Downloads/2018-04-28/ulysses3-export-master/ulyssesToFiles.php(26): CFPropertyList\CFPropertyList->__construct('/Users/matt/Lib...', 2)
#3 /Users/matt/Downloads/2018-04-28/ulysses3-export-master/ulyssesToFiles.php(20): CFPropertyList\parseFolder('/Users/matt/Lib...')
#4 {main}
  thrown in /Users/matt/Downloads/2018-04-28/ulysses3-export-master/vendor/rodneyrehm/plist/classes/CFPropertyList/IOException.php on line 68

@gingerbeardman
Copy link
Contributor Author

I think it is a permissions issue? But I have no luck with using sudo either?

@gingerbeardman
Copy link
Contributor Author

gingerbeardman commented Apr 28, 2018

I'm happy to share my notes if that would help? I don't think there's anything too private in there.

@briansea
Copy link
Owner

briansea commented Apr 28, 2018 via email

@gingerbeardman
Copy link
Contributor Author

gingerbeardman commented Apr 28, 2018

No need to go to email just yet.

I get

$ ls "/Users/matt/Library/Mobile Documents/X5AZV975AG~com~soulmen~ulysses3"
Documents/ Settings/

and

$ ls "/Users/matt/Library/Mobile Documents/X5AZV975AG~com~soulmen~ulysses3/Documents/Library"
Groups-ulgroup/           Unfiled-ulgroup/          legacyConflictsTimestamp*
Trash-ultrash/            favorites*

macOS 10.13.4
Ulysses 2.8.3 (the last one before they went subscription)

@gingerbeardman
Copy link
Contributor Author

Maybe a version of the script with copious debugging information might help? I'll try to take a look later.

@briansea
Copy link
Owner

briansea commented Apr 30, 2018 via email

@gingerbeardman
Copy link
Contributor Author

gingerbeardman commented Apr 30, 2018

This is a long one...

No such luck using ~/Library/Mobile Documents/X5AZV975AG~com~soulmen~ulysses3/Documents/Library/Unfiled-ulgroup as CFPropertyList\IOException::notReadable is still thrown. And the CFPropertyList folks are, somewhat understandably, saying it's not their problem. It does appear to be a permissions problem but I'm not sure why my system would be different to yours and not allow scripts to access the Mobile Documents folder?

Anyway, progress was made by taking a copy of the ulysses3 folder and working on that by making it readable by everybody.

ditto "/Users/matt/Library/Mobile Documents/X5AZV975AG~com~soulmen~ulysses3/Documents/Library/" copy/

I then have to use the absolute path /Users/matt/Downloads/2018-04-28/ulysses3-export-master/copy/Unfiled-ulgroup... but something odd is happening:

Here's the first error thrown.

./ulyssesToFiles.php 

Warning: file_get_contents(/Users/matt/Downloads/2018-04-28/ulysses3-export-master/copy/Unfiled-ulgroup/24185be571dc49dbaa365e9943dd1d5e.ulysses/Content.xml): failed to open stream: No such file or directory in /Users/matt/Downloads/2018-04-30/ulysses3-export-master/ulyssesToFiles.php on line 55

it's looking inside Unfiled-ulgroup for file 24185be571dc49dbaa365e9943dd1d5e.ulysses but that file is actually located in Trash-ultrash. However, it is referenced in Unfiled-ulgroup/Info.ulgroup with the parameter explicitUnassignment=true, as follows:

<key>24185be571dc49dbaa365e9943dd1d5e.ulysses</key>
<dict>
	<key>explicitUnassignment</key>
	<true/>
	<key>firstUnassignment</key>
	<real>546528077.55417597</real>
	<key>lastModification</key>
	<real>546528077.55417597</real>
	<key>version</key>
	<dict>
		<key>2D11DD1F-A064-4304-9095-915561141FCC</key>
		<integer>8</integer>
		<key>95c9cd067cc9ab84f129a60eb5b01ba7d1701c18886cd4da7201c1a6bf9389ce</key>
		<integer>42</integer>
		<key>BD7BA51D-1ABC-4396-ADB3-2251A0C72A48</key>
		<integer>7</integer>
		<key>D6CC5D97-A512-4745-ADA6-58530F7AA215</key>
		<integer>7</integer>
		<key>f7a03d2fa58e49f3a278d9b2793608a3d4e046e4be830fb790bba76256f0dcec</key>
		<integer>14</integer>
	</dict>
</dict>

Contrast that with a file that is present in the Unfiled-ulgroup folder:

<key>cc110a87c1c548dca4842c46d5379dc5.ulysses</key>
<dict>
	<key>lastModification</key>
	<real>536518971.46804601</real>
	<key>version</key>
	<dict>
		<key>2D11DD1F-A064-4304-9095-915561141FCC</key>
		<integer>8</integer>
		<key>95c9cd067cc9ab84f129a60eb5b01ba7d1701c18886cd4da7201c1a6bf9389ce</key>
		<integer>39</integer>
		<key>BD7BA51D-1ABC-4396-ADB3-2251A0C72A48</key>
		<integer>7</integer>
		<key>D6CC5D97-A512-4745-ADA6-58530F7AA215</key>
		<integer>2</integer>
		<key>f7a03d2fa58e49f3a278d9b2793608a3d4e046e4be830fb790bba76256f0dcec</key>
		<integer>14</integer>
	</dict>
			</dict>

...but why are they listed like that anyway? No idea. I can appreciate that you may not have had any files where this has happened which is why you never encountered this problem.

I decided to clean my ulysses3 folder by using the sidebar in Ulysses.app to move all folders to "On My Mac" and then move them back to "iCloud". This means that now my Trash and Unfiled folders now have no entries which is as it should be. But the Groups-ulgroup still has those entries with explicitUnassignment.

SO! The fixes are to put in logic in various places to check a file exists before accessing it.

There were also some issues with illegal characters in my group names not being allowed in filenames.

Will make a PR soon!

@gingerbeardman
Copy link
Contributor Author

Fixed in #3

Thanks for the script and assistance!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants