Opened 9 years ago

Closed 3 years ago

#51287 closed defect (fixed)

Inkscape crashes on startup if enchant is installed with +applespell

Reported by: Blokkendoos (Johan) Owned by: jeremyhu (Jeremy Huddleston Sequoia)
Priority: Normal Milestone:
Component: ports Version:
Keywords: lion Cc: raimue (Rainer Müller)
Port: inkscape enchant

Description (last modified by dbevans (David B. Evans))

Inkscape 0.91_14 crashes on startup. OS X 10.8.5 XCode 5.1.1

From the log (attached) this seems to be related to enchant_applespell.

Workaround: Uninstall of enchant +applespell Install enchant +aspell -applespell

Attachments (2)

inkscape Log.txt (54.2 KB) - added by Blokkendoos (Johan) 9 years ago.
Inkscape crash log
Screen Shot 2016-05-23 at 00.07.28.png (153.2 KB) - added by jeremyhu (Jeremy Huddleston Sequoia) 8 years ago.
works fine for me on ElCap with +applespell+ispell

Download all attachments as: .zip

Change History (25)

Changed 9 years ago by Blokkendoos (Johan)

Attachment: inkscape Log.txt added

Inkscape crash log

comment:1 Changed 9 years ago by Blokkendoos (Johan)

Of course, the workaround is:

sudo port -f uninstall enchant +applespell
sudo port install enchant -applespell
Last edited 8 years ago by ryandesign (Ryan Carsten Schmidt) (previous) (diff)

comment:2 Changed 9 years ago by dbevans (David B. Evans)

Owner: changed from macports-tickets@… to devans@…
Status: newassigned

To help reproduce the problem, can you indicate which variants are enabled in your build (+quartz vs +x11, possibly +gtk3). Does the crash occur immediately on startup or after some other action. Thanks.

comment:3 Changed 9 years ago by Blokkendoos (Johan)

The installed port is: inkscape @0.91_14+strict+x11
The installed libenchant: enchant @1.6.0_4
IS crashes immediately after startup, showing a modal dialog that only accepts close.

Regards, Jo

comment:4 Changed 9 years ago by dbevans (David B. Evans)

Cc: raimue@… added
Port: enchant added
Summary: Inkscape crash on startup (OS X 10.8)Inkscape crashes on startup if enchant is installed with +applespell
Version: 2.3.4

Thanks, Jo.

After a lot of fooling around I was able to reproduce your problem on 10.8. As you suggest, there is a problem using the AppleSpell backend with enchant. The crash occurs when gtkspell attempts to initialize enchant when enchant has been built with this backend. The error that occurs is symptomatic of the situation where an object has been allocated but prematurely freed before being used. By this time, the original pointer has been reallocated to something else (NSCFType in this case) which doesn't accept the selector from the original object call. So the crash is an enchant/AppleSpell problem.

From the inkscape point of view, this is all moot because the inkscape code assumes that enchant has been installed with the aspell backend. If aspell is not installed at build time inkscape will disable the spell check functionality, partially at least, by not including the SpellCheck menu item in the Text menu. Unfortunately the text window code will still try and initialize gtkspell (and thereby enchant) if gtkspell is installed regardless of whether aspell is installed. These two need to be coordinated in inkscape to avoid problems. I note that this is a new error because enchant was recently modified to install the AppleSpell backend by default rather than aspell as it did previously. Need to review this too.

At any rate, in order for spell checking to work in inkscape, you need to do the following:

  • Make sure that aspell is installed with at least one language dictionary. This dictionary should correspond to whatever language your machine is configured to use.
  • Make sure that enchant is installed with the aspell backend AND that the AppleSpell backend is NOT installed. Currently this means enchant +aspell -applespell. Note that, as currently configured, enchant will install aspell and the aspell English dictionary, aspell-dict-en, if they are not already installed.
  • Once aspell and enchant are properly installed, you need to rebuild inkscape so it will properly configure spell checking.

Command sequence for this would be:

sudo port install aspell aspell-dict-xx
sudo port install enchant +aspell -applespell
sudo port -n upgrade --force inkscape

This allows inkscape to start up without errors for me and spell checking works. You should see SpellChecking at the bottom of the text menu and selecting it will open a spell checking dialog in the dialog pane on the right side of your screen. If you then create a text object and type in some text you should see the text echoed in the spell checking dialog and clicking the start button will cause it to start spell checking.

Please give this a try and let me know if it works for you as well. If so, I will massage the relevant ports as necessary to ensure that inkscape installs this way by default.

Copying raimue as he made the change in enchant (r145039) that precipitated this issue. Due to this issue, I would prefer to see enchant +aspell as the default variant, at least until the AppleSpell crash issue is resolved.

comment:5 Changed 9 years ago by Blokkendoos (Johan)

Confirmed. The suggested command sequence results in Inkscape not crashing _and_ supporting spellchecking functionality.
Thanks for the swift response.

Regards,
Jo.

PS On laptop with OS X 10.10.5, Inkscape is allright with these ports installed:

 enchant @1.6.0_4+applespell (active)
 inkscape @0.91_13+strict+x11 (active)
Last edited 8 years ago by ryandesign (Ryan Carsten Schmidt) (previous) (diff)

comment:6 Changed 9 years ago by raimue (Rainer Müller)

Thank you for the analysis, David.

The idea of switching to enchant +applespell as default was meant to reduce the setup overhead for new users. As spell checking in the system is already configured for local language, users do not need to install extra dictionaries. Also, suggestions and custom additions would be adopted automatically.

It is interesting to see it actually crashes inside the call for [NSSpellChecker sharedSpellChecker], which is provided by AppKit.framework. I don't think we have any more influence on the underlying libraries. This crash might even be specific to OS X 10.8.

To add some data point, I cannot reproduce this crash on OS X 10.10.5 Yosemite:

$ port -q installed enchant inkscape
  enchant @1.6.0_4+applespell (active)
  inkscape @0.91_14+strict+x11 (active)

For the inkscape issue, it looks like inkscape picks up aspell on build time opportunistically without declaring a dependency. This functionality should be disabled or the explicit dependency must be added.

comment:7 in reply to:  6 ; Changed 9 years ago by dbevans (David B. Evans)

Replying to raimue@…:

Thank you for the analysis, David.

The idea of switching to enchant +applespell as default was meant to reduce the setup overhead for new users. As spell checking in the system is already configured for local language, users do not need to install extra dictionaries. Also, suggestions and custom additions would be adopted automatically.

It is interesting to see it actually crashes inside the call for [NSSpellChecker sharedSpellChecker], which is provided by AppKit.framework. I don't think we have any more influence on the underlying libraries. This crash might even be specific to OS X 10.8.

To add some data point, I cannot reproduce this crash on OS X 10.10.5 Yosemite:

$ port -q installed enchant inkscape
  enchant @1.6.0_4+applespell (active)
  inkscape @0.91_14+strict+x11 (active)

Same here so it appears to be OS X version dependent. I can check 10.8+ but not earlier.

For the inkscape issue, it looks like inkscape picks up aspell on build time opportunistically without declaring a dependency. This functionality should be disabled or the explicit dependency must be added.

Agreed. The current dependencies were based on the expectation that enchant would configure with aspell by default (as it used to). The problem is that inkscape does the spellchecking in two pieces. It uses gtkspell -> enchant to transparently check spelling and underline spelling errors on the contents the text widget used to display a text object but then accesses aspell directly (not via enchant) to find suggested spellings, add to the dictionary, etc. Basically everything that is done in the spell checking dialog in the side pane. So for things to work consistently, enchant needs to be configured with aspell. Not great.

In addition, during configuration they use the presence of aspell to indicate that the spell checking item should be enabled in the text menu but use an independent check for gtkspell to enable its use in the text widget. So it will try to use gtkspell even if aspell isn't available. A few things to think about upstream.

I can use require_active_variants to mandate enchant +aspell but that will break the default build on the buildbots if enchant isn't configured with aspell by default. As the port description says, enchant was originally designed to use an aspell-like API. I believe this is generally the default on most Linux platforms.

If applespell didn't break on 10.8, I'd suggest enchant +applespell +aspell by default.

comment:8 in reply to:  7 Changed 9 years ago by raimue (Rainer Müller)

Replying to devans@…:

Same here so it appears to be OS X version dependent. I can check 10.8+ but not earlier.

We could make the default variant OS-dependent, as OS X <= 10.8 should be considered legacy anyway.

I can use require_active_variants to mandate enchant +aspell but that will break the default build on the buildbots if enchant isn't configured with aspell by default. As the port description says, enchant was originally designed to use an aspell-like API. I believe this is generally the default on most Linux platforms.

If applespell didn't break on 10.8, I'd suggest enchant +applespell +aspell by default.

Enabling both +aspell +applespell by default will effectively use aspell for everything. The default configuration in enchant.ordering prefers any other backend over AppleSpell for most languages.

This upstream report seems relevant: https://bugs.launchpad.net/inkscape/+bug/1049548

Looking only at inkscape, going back to enchant +aspell would be the easy solution. The list of dependents of enchant includes gimp2 and webkit*-gtk*. However, I am in doubt whether they are actually used more often for spell checking than inkscape. Going back to enchant +aspell as default would only loose the tighter system integration.

comment:9 Changed 9 years ago by dbevans (David B. Evans)

Description: modified (diff)
Resolution: fixed
Status: assignedclosed

I've updated the dependencies in inkscape in r148331, requiring enchant +aspell -applespell. This fixes the spell checking issue reported here although enchant has to be manually installed with these variants for the build to succeed. Will do the same for inkscape-devel shortly.

Leaving enchant variants as they are for now although I may resurrect the issue in another ticket after I do some more research into how it's used in other ports. Thanks to raimue for his input.

comment:10 in reply to:  9 Changed 9 years ago by raimue (Rainer Müller)

Replying to devans@…:

I've updated the dependencies in inkscape in r148331, requiring enchant +aspell -applespell. This fixes the spell checking issue reported here although enchant has to be manually installed with these variants for the build to succeed. Will do the same for inkscape-devel shortly.

This forces everyone with inkscape installed to manually switch the enchant variants before their upgrade can continue, as the default installation is still enchant +applespell. I got multiple reports (personally and on IRC) from people that were unsure what to do. The error message is a bit confusing and does not tell users how they are supposed to proceed:

--->  Fetching archive for inkscape
Error: Failed to archivefetch inkscape: enchant must be installed with +aspell and without +applespell.

To document it somewhere, the command to switch variants before attempting an upgrade of inkscape would be:

$ sudo port upgrade --enforce-variants enchant +aspell -applespell

comment:11 Changed 8 years ago by dbevans (David B. Evans)

Keywords: lion added

In recent testing, I was able to confirm this problem on 10.8 when enchant is built with +applespell whether or not +aspell is asserted. 10.9+ appear uneffected by this issue although, as explained above, inkscape spell checking requires enchant +aspell to work.

comment:12 Changed 8 years ago by jeremyhu (Jeremy Huddleston Sequoia)

Resolution: fixed
Status: closedreopened

r148902 reverted this hack.

The workaround should be in enchant, not inkscape.

comment:13 Changed 8 years ago by jeremyhu (Jeremy Huddleston Sequoia)

Owner: changed from devans@… to jeremyhu@…
Status: reopenednew

comment:14 Changed 8 years ago by jeremyhu (Jeremy Huddleston Sequoia)

r148903 set this as default. Keeping open to also err-out if +applespell is selected on older versions.

comment:15 Changed 8 years ago by dbevans (David B. Evans)

inkscape needs +aspell on ALL platforms. It's only that enchant crashes on 10.8 with +applespell selected whether +aspell is asserted or not. Even if the default for enchant were restored to +aspell only, inkscape would still need to check variants to make sure someone didn't install it with other variants.

comment:16 Changed 8 years ago by dbevans (David B. Evans)

Jeremy, I'm leaving this for you to resolve but, in any case, please make sure that whatever changes are made to inkscape in this respect are also made to inkscape-devel. Thanks.

Changed 8 years ago by jeremyhu (Jeremy Huddleston Sequoia)

works fine for me on ElCap with +applespell+ispell

comment:17 Changed 8 years ago by jeremyhu (Jeremy Huddleston Sequoia)

Seems to work file for me without +aspell.

Version 1, edited 8 years ago by jeremyhu (Jeremy Huddleston Sequoia) (previous) (next) (diff)

comment:18 Changed 8 years ago by dbevans (David B. Evans)

I guess I'm not being clear

inkscape will not enable the spellchecking item in the Text menu if aspell is not available at build time. See configure.ac. Thus aspell needs to be a dependency of inkscape.

inkscape uses gtkspell which uses enchant to spellcheck words in a text object. This part will work with any enchant backend. Mispelled words are highlighted (outlined) in red.

However, the code that allows you to add words to a dictionary bypasses enchant and uses aspell api directly. Thus, new words added are added to the aspell dictionary only and have no effect on the spellcheck highlighting via enchant unless enchant is using aspell as the backend.

This can be demonstrated as follows:

select spellchecking in the text box so that you have the inkscape workspace on the left and the spellcheck dialog on the right.

create a text box in the workspace and enter a mispelled word (e.g. libertee). When you hit the start button in the spellcheck dialog the word will be highlighted in red.

Then using the dialog try to add the word to the dictionary. If enchant +aspell is active, the highlighting of the word will immediately disappear since the word is now in the dictionary. Subsequent usages of this word will not be highlighted. This is the proper behavior.

However, if enchant does not have +aspell selected then this will have no effect, the word will still be highlighted because the word was added to an aspell dictionary not the one enchant is using. Only aspell will work here as the code is using the aspell api directly.

Thus there are two requirements for full functionality: inkscape must depend on aspell to enable the spellcheck item in the text menu and enchant +aspell must be installed so that the spellchecking code and the code for adding words to the dictionary are using the same dictionary (which has to be aspell).

I admit that this is a poor way to write the spellchecking code but this is the way it is.

There is other funny things as well. For instance, although the appearance of the spellcheck item in text menu is dependent upon having aspell available at build time, the spellcheck dialog is still enabled in the code. So if you use a properly configured version of inkscape to display the spellcheck dialog using the text menu item and then quit and run a version built without aspell, the spellcheck dialog will appear on startup because inkscape remembers the window configuration from the previous run but if you close the dialog there is no way to open it again because the text menu item is missing. This can make you think it's working without aspell but its really not (or only partially).

This all needs work upstream.

comment:19 Changed 8 years ago by dbevans (David B. Evans)

And then inkscape will crash on 10.8 if enchant is built with applespell support independently of all else. Enchant initializes each enabled backend in sequence regardless of backend priority. When the attempt is made to initialize a shared AppleSpell instance the crash occurs as reported in this ticket.

comment:20 Changed 8 years ago by jeremyhu (Jeremy Huddleston Sequoia)

Ok, that makes sense then. Thanks for the explanation. I'll try to figure out an elegant way to deal with all that.

comment:21 Changed 8 years ago by dbevans (David B. Evans)

Looking forward to it! My solution was anything but.

comment:22 Changed 3 years ago by Christopher Nielsen <mascguy@…>

In 0af172de7ab880c9fc83905dfc50df1d0af2d0f7/macports-ports (master):

inkscape-devel: update to 1.1.2

  • Credit to: @evanmiller

See: #50210
See: #51287
See: #51407
See: #54944
See: #60927
See: #61404
See: #64660

comment:23 Changed 3 years ago by evanmiller (Evan Miller)

Resolution: fixed
Status: newclosed

In d5bc993e56a90910b79609231a5b39a92ab59095/macports-ports (master):

inkscape: update to 1.1.2

Closes: #50210
Closes: #51287
Closes: #51407
Closes: #54944
Closes: #60927
Closes: #61404
Closes: #64660

Note: See TracTickets for help on using tickets.