Skip to content
This repository was archived by the owner on Dec 15, 2022. It is now read-only.

Fix some package detections - #100

Merged
winstliu merged 8 commits into
masterfrom
wl-fix-package-detections
Nov 18, 2015
Merged

winstliu merged 8 commits into
masterfrom
wl-fix-package-detections

Conversation

@winstliu

@winstliu winstliu commented Nov 3, 2015

Copy link
Copy Markdown
Contributor

⚠️ Sorta-kinda depends on atom/atom#9440, which has not been released yet ⚠️

This fixes the following scenarios:

  • A package fails to load and throws a "Failed to load the package" error
  • A package fails to activate and throws a "Failed to activate the package" error
  • A grammar fails to load and throws a "Failed to load a package grammar" error
  • A package that has been apm linked on a Windows machine throws an error

All of those would previously fail to find the correct package to report the issue to and so they were all dumped to atom/atom.

Refs #66
Fixes #98

@winstliu

winstliu commented Nov 3, 2015

Copy link
Copy Markdown
Contributor Author

Hmm. The linked package test was passing locally (also took me the longest to get working), but that was on Windows. I'll try to debug tomorrow on Linux unless someone figures out what I'm doing wrong before that ;).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh man. Cant believe this has been in there so long.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this still might be incorrect...@kevinsawicki if someone sets their ATOM_HOME to something like /Users/user/ATOM, then will this check fail? If so, how would I fix that? By reading process.env.ATOM_HOME and then regexing it to capture the last folder path?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gentle bump @kevinsawicki

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The goal of this line is to check if the package is bundled or not right?

There is atom.packages.isBundledPackage and atom.packages.isBundledPackagePath that might be useful to use instead.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's actually to check if a package is symlinked or not, and then to get its true path since that's where the error will have been thrown from.

Eg if I have notifications linked to .atom\packages\notifications from C:\Users\user\Documents\Github\notifications and notifications throws an error, then this piece of code will correctly match the two.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh yeah, I'd say maybe just call fs.realpath in all cases then if we want to ensure the stack paths match the package paths.

@izuzak

izuzak commented Nov 4, 2015

Copy link
Copy Markdown
Contributor

👏 @50Wliu

Going to cc @kevinsawicki for more 👀 since he worked on some improvement to this package and error detection, if I remember correctly.

Comment thread lib/notification-issue.coffee Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we should pass in the packageName as metadata to the notification instead of having to regex the message.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that would probably be better. Any pointers on how to do that?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@winstliu

winstliu commented Nov 4, 2015

Copy link
Copy Markdown
Contributor Author

Unfortunately I can't reproduce the failing spec, even on Ubuntu 😞.

@winstliu

winstliu commented Nov 4, 2015

Copy link
Copy Markdown
Contributor Author

Wow ok so I totally forgot that package specs run on Mac and not Linux. Can anyone repro the failing spec on Mac then?

@winstliu

winstliu commented Nov 4, 2015

Copy link
Copy Markdown
Contributor Author

Also, should we switch to actually building and then loading a package (similar to how spec/package-manager-spec.coffee does it) instead of manually creating the notification ourselves?

Comment thread lib/notification-issue.coffee Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like this could be returned at the top of this method? Like line 178?

winstliu and others added 2 commits November 6, 2015 11:36
Node stack traces seem to always contain real-paths, even if the
file was required via a symlink path
@maxbrunsfeld

Copy link
Copy Markdown
Contributor

🚢

@winstliu

Copy link
Copy Markdown
Contributor Author

🚢

Whoops, missed that...

winstliu pushed a commit that referenced this pull request Nov 18, 2015
@winstliu
winstliu merged commit d44638f into master Nov 18, 2015
@winstliu
winstliu deleted the wl-fix-package-detections branch November 18, 2015 20:43
@as-cii

as-cii commented Nov 18, 2015

Copy link
Copy Markdown
Contributor

Thanks, @50Wliu!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Failed to load/activate package bug should be filed on package not Atom?

6 participants