Closed ribose-jeffreylau closed 3 years ago
I confirm that the same content generated with metanorma-cc for Word doesn't crash, but the one from metanorma-iso will crash. This behavior started with Word version 16.53.
I know that Word documents generated from metanorma-iso 1.8.3 do not crash the latest Word.
The issue is the use of mso-style-parent in Word CSS stylesheets.
In the IEC-influenced CSS refactoring I did a few months ago, I clearly introduced a value for mso-style-parent into the ISO Word CSS stylesheet that does not correspond to an actual style; and that makes Word crash. That will be a bug to fix.
In testing in my Greek-language Mac OS, I have found an additional issue. The value of mso-style-parent is the system language name of the style, not the CSS name of the style; for example, mso-style-parent: "Heading 1"
. Until the current version of Word, my Greek-language OS recognised such CSS without issue. But in the current version of Word, Word expects the mso-style-parent
value to be in the system language, i.e. Επικεφαλίδα 1
for Greek. It no longer accepts "Heading 1" as a valid style name, and it crashes. (This does NOT apply, however, to mso-style-link
and mso-style-next
.)
The fix for this is to insert an explicit mso-style-name
in all styles that are targets of parent, including Headings Footnotes, Titles, and TOC. If your OS is in English, you will not notice any difference. If your OS is in a different language, when you open that language, there will be two instances in the style menu of Heading 1: the system default (from Normal.dot), with the local language name, and the document-specific instance, with the English-language name. The document will render correctly as specified in the CSS.
The only change is that, if the user tries to modify the styles of the document, they will realise that the document is using distinct style names from his system default (e.g. Heading 1 not Επικεφαλίδα 1); and that conversely, if he applies the default styles with local names (e.g. Επικεφαλίδα 1), they will not have the correct document styling. We will need to document that, but it is a minor issue, and one that other-language system users will have seen before when editing documents. (I know that I see Heading 1 a lot more than Επικεφαλίδα 1 in Word, despite my OS being in Greek: DOCX I think preserves the systems names in the language of the document, it's MHT, creating style names dynamically on import, that seems to have this issue.)
Symptoms
The
.doc
file generated by runningbundle exec metanorma site generate
would make Microsoft Word for Mac crash on open.Click to expand trace **(WARNING: LONG TRACE)**
``` Microsoft Error Reporting log version: 2.0 Error Signature: Exception: EXC_BAD_ACCESS ExceptionEnumString: 1 Exception Code: KERN_INVALID_ADDRESS (0x0000000000000000) Date/Time: 2021-10-08 08:41:00 +0000 Application Name: Microsoft Word Application Bundle ID: com.microsoft.Word Application Signature: MSWD Application Bitness: x64 Application Version: 16.53.0.21091200 Crashed Module Name: Microsoft Word Crashed Module Version: 16.53.21091200 Crashed Module Offset: 0x00000000017b4ed8 Blame Module Name: Microsoft Word Blame Module Version: 16.53.21091200 UnsymbolicatedChecksum: 36123724A52F76BC11A05EA8B7B0EC5D Blame Module Offset: 0x00000000017b4ed8 StackHash: 10e58ad8e8a6805b-dm_1_main_bt Application LCID: 2057 Extra app info: Reg=en Loc=0x0809 Build Type: Release Crashed thread Stack Pointer: 0x_00007ffee09db2f0 Crashed thread: 0 Thread 0 crashed (0xf86ff3): # 1 0x00000001109c1ed8 in (Microsoft Word + 0x00000000017b4ed8) 0x0000000000000000 # 2 0x00000001109c132f in (Microsoft Word + 0x00000000017b432f) 0x0000000000000000 # 3 0x00000001109befb8 in (Microsoft Word + 0x00000000017b1fb8) 0x00007ffee09e0a40 # 4 0x0000000110a57edb in (Microsoft Word + 0x000000000184aedb) 0x00007ffee09e0a70 # 5 0x0000000110a57997 in (Microsoft Word + 0x000000000184a997) 0x00007ffee09e35c0 # 6 0x0000000110a07fa5 in (Microsoft Word + 0x00000000017fafa5) 0x00007ffee09e3640 # 7 0x0000000110a0804e in (Microsoft Word + 0x00000000017fb04e) 0x00007ffee09e3680 # 8 0x0000000110a12fac in (Microsoft Word + 0x0000000001805fac) 0x00007ffee09e4be0 # 9 0x0000000117add88f in (mso99 + 0x0000000000f4a88f) 0x00007ffee09e4c20 # 10 0x0000000117adc56e in (mso99 + 0x0000000000f4956e) 0x00007ffee09e4dd0 # 11 0x0000000117ae8370 in (mso99 + 0x0000000000f55370) 0x00007ffee09e4de0 # 12 0x0000000110a03cc1 in (Microsoft Word + 0x00000000017f6cc1) 0x00007ffee09e4e30 # 13 0x0000000110a05892 in (Microsoft Word + 0x00000000017f8892) 0x00007ffee09e60e0 # 14 0x000000011095da50 in (Microsoft Word + 0x0000000001750a50) 0x00007ffee09e6210 # 15 0x000000011095b734 in (Microsoft Word + 0x000000000174e734) 0x00007ffee09e7800 # 16 0x00000001109575a5 in (Microsoft Word + 0x000000000174a5a5) 0x00007ffee09e7900 # 17 0x00000001109543ac in (Microsoft Word + 0x00000000017473ac) 0x00007ffee09eae40 # 18 0x000000010f8ea0b5 in (Microsoft Word + 0x00000000006dd0b5) 0x00007ffee09eaf90 # 19 0x0000000110927e3d in (Microsoft Word + 0x000000000171ae3d) 0x00007ffee09ed100 # 20 0x00000001108af8d9 in (Microsoft Word + 0x00000000016a28d9) 0x00007ffee09ee350 # 21 0x00000001108b0123 in (Microsoft Word + 0x00000000016a3123) 0x00007ffee09ef4a0 # 22 0x00007fff230a38c5 in -[NSDocument _initWithContentsOfURL:ofType:error:] + 0x000000A1 (AppKit + 0x00000000003528c5) 0x00007ffee09ef6c0 # 23 0x00007fff230a37bf in -[NSDocument initWithContentsOfURL:ofType:error:] + 0x000000E2 (AppKit + 0x00000000003527bf) 0x00007ffee09ef700 # 24 0x00007fff2310c514 in -[NSDocumentController makeDocumentWithContentsOfURL:ofType:error:] + 0x0000024A (AppKit + 0x00000000003bb514) 0x00007ffee09ef740 # 25 0x00007fff23316276 in ___97-[NSDocumentController makeDocumentWithContentsOfURL:alternateContents:ofType:completionHandler:]_block_invoke + 0x0000005B (AppKit + 0x00000000005c5276) 0x00007ffee09ef790 # 26 0x00007fff23316210 in -[NSDocumentController makeDocumentWithContentsOfURL:alternateContents:ofType:completionHandler:] + 0x000000A0 (AppKit + 0x00000000005c5210) 0x00007ffee09ef830 # 27 0x00007fff2310b7ab in ___80-[NSDocumentController openDocumentWithContentsOfURL:display:completionHandler:]_block_invoke + 0x00000343 (AppKit + 0x00000000003ba7ab) 0x00007ffee09ef8a0 # 28 0x00007fff23315414 in ___144-[NSDocumentController _coordinateReadingAndGetAlternateContentsForOpeningDocumentAtURL:resolvingSymlinks:thenContinueOnMainThreadWithAccessor:]_block_invoke_4 + 0x0000001F (AppKit + 0x00000000005c4414) 0x00007ffee09ef9f0 # 29 0x00007fff2331576a in ___144-[NSDocumentController _coordinateReadingAndGetAlternateContentsForOpeningDocumentAtURL:resolvingSymlinks:thenContinueOnMainThreadWithAccessor:]_block_invoke_2.748 + 0x000000B1 (AppKit + 0x00000000005c476a) 0x00007ffee09efa20 # 30 0x00007fff23315653 in ___144-[NSDocumentController _coordinateReadingAndGetAlternateContentsForOpeningDocumentAtURL:resolvingSymlinks:thenContinueOnMainThreadWithAccessor:]_block_invoke.747 + 0x00000099 (AppKit + 0x00000000005c4653) 0x00007ffee09efad0 # 31 0x00007fff23315567 in ___144-[NSDocumentController _coordinateReadingAndGetAlternateContentsForOpeningDocumentAtURL:resolvingSymlinks:thenContinueOnMainThreadWithAccessor:]_block_invoke.745 + 0x000000F3 (AppKit + 0x00000000005c4567) 0x00007ffee09efba0 # 32 0x00007fff2331eb3f in ____NSMainRunLoopPerformBlockInModes_block_invoke + 0x00000019 (AppKit + 0x00000000005cdb3f) 0x00007ffee09efc70 # 33 0x00007fff20588e52 in ___CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 0x0000000C (CoreFoundation + 0x000000000007fe52) 0x00007ffee09efc90 # 34 0x00007fff20588d03 in ___CFRunLoopDoBlocks + 0x000001B8 (CoreFoundation + 0x000000000007fd03) 0x00007ffee09efca0 # 35 0x00007fff205879be in ___CFRunLoopRun + 0x0000036F (CoreFoundation + 0x000000000007e9be) 0x00007ffee09efd20 # 36 0x00007fff20586f8c in _CFRunLoopRunSpecific + 0x00000233 (CoreFoundation + 0x000000000007df8c) 0x00007ffee09f0a60 # 37 0x00007fff287cf1f3 in _RunCurrentEventLoopInMode + 0x00000124 (HIToolbox + 0x00000000000311f3) 0x00007ffee09f0b00 # 38 0x00007fff287cee26 in _ReceiveNextEventCommon + 0x0000011C (HIToolbox + 0x0000000000030e26) 0x00007ffee09f0b50 # 39 0x00007fff287cecf3 in __BlockUntilNextEventMatchingListInModeWithFilter + 0x00000046 (HIToolbox + 0x0000000000030cf3) 0x00007ffee09f0bd0 # 40 0x00007fff22d90172 in __DPSNextEvent + 0x00000360 (AppKit + 0x000000000003f172) 0x00007ffee09f0bf0 # 41 0x00007fff22d8e945 in -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 0x00000554 (AppKit + 0x000000000003d945) 0x00007ffee09f0fd0 # 42 0x00007fff22d80c69 in -[NSApplication run] + 0x0000024A (AppKit + 0x000000000002fc69) 0x00007ffee09f1240 # 43 0x00007fff22d54e6c in _NSApplicationMain + 0x00000330 (AppKit + 0x0000000000003e6c) 0x00007ffee09f12d0 # 44 0x00007fff204acf3d in _start + 0x00000001 (libdyld.dylib + 0x0000000000015f3d) 0x00007ffee09f1320 x86_64 Thread State(64bit): __rax: 0x0000000000000fff __rbx: 0x0000000000000011 __rcx: 0x0000000000000000 __rdx:0x0000000000000000 __rdi: 0x0000000000000149 __rsi: 0x0000600000aa9058 __rbp: 0x00007ffee09db340 __rsp:0x00007ffee09db2f0 __r8: 0x0000000000000001 __r9: 0x00007ffee09dae32 __r10: 0x00007fff208c230b __r11:0x82b9eb8e539606e1 __r12: 0x0000600000aa9050 __r13: 0x00007fbfb913c400 __r14: 0x0000000000000000 __r15:0x00007fbfb913c400 __rip: 0x00000001109c1ed8 __rflags: 0x0000000000010246 __cs: 0x000000000000002b __fs:0x0000000000000000 __gs: 0x0000000000000000 Thread 1 (0xf87078): # 1 0x00007fff2045cb52 in ___open + 0x0000000A (libsystem_kernel.dylib + 0x0000000000001b52) 0x0000000000000000 # 2 0x00007fff2a641b26 in _copyfile + 0x000013A3 (libcopyfile.dylib + 0x0000000000002b26) 0x0000000000000000 # 3 0x00007fff22330392 in Security::DbModifier::commit() + 0x00000D78 (Security + 0x0000000000010392) 0x0000700008295cb0 # 4 0x00007fff2233c58c in cssm_PassThrough(cssm_dl_db_handle, unsigned int, void const*, void**) + 0x00000076 (Security + 0x000000000001c58c) 0x0000700008295df0 # 5 0x00007fff2233c46b in _CSSM_DL_PassThrough + 0x000000AA (Security + 0x000000000001c46b) 0x0000700008295e30 # 6 0x00007fff225d114d in DLTransaction::commit() + 0x00000025 (Security + 0x00000000002b114d) 0x0000700008295e90 # 7 0x00007fff2252c5ce in Security::KeychainCore::ItemImpl::updateSSGroup(Security::CssmClient::Db&, unsigned int, Security::CssmDataContainer*, Security::KeychainCore::Keychain, Security::SecPointerHonestly, I am not sure if it's also a problem of the latest versions of Microsoft Word for Mac (I suspect it is, since using the same set of gems from 3 months ago---where it did not crash Word---to generate the document would also crash it now).
Attachments
Minimal (sort of) example of generated
.doc
withmetanorma-iso
: iso-24229-20211008-crashy.gzCorresponding minimal example of generated
.doc
withmetanorma-cc
: cc-24229-20211008-not_crashy.gzRepository of the minimal examples: minimal-example.gz