//As a Wikisource user, I want the bug (as described below) that results in export errors to be fixed, so that I can continue to read and access books on Wikisource without issue.
//
==== What is the problem?
Exporting some ebooks fails with the error below.
This is currently only happening on https://ws-export-test.wmcloud.org. I notice prod and test have different a list of fonts, if that matters.
```
Message: Uncaught PHP Exception Symfony\Component\Process\Exception\ProcessFailedException: "The command "'ebook-convert' '/var/www/tool/var/www-data/ws-c0_Pan_iang-139751013184292.epub' '/var/www/tool/var/www-data/ws-c0_Pan_iang-139751265352313.pdf' '--page-breaks-before' '/' '--paper-size' 'a4' '--pdf-page-margin-bottom' '48' '--pdf-page-margin-top' '60' '--pdf-page-margin-left' '36' '--pdf-page-margin-right' '36' '--pdf-page-numbers' '--preserve-cover-aspect-ratio'" failed.
Exit Code: 1(General error)
Working directory: /var/www/tool/public
Output:
================
Conversion options changed from defaults:
pdf_page_margin_top: 60.0
pdf_page_margin_right: 36.0
pdf_page_margin_left: 36.0
pdf_page_numbers: True
pdf_page_margin_bottom: 48.0
preserve_cover_aspect_ratio: True
paper_size: 'a4'
1% Converting input to HTML...
InputFormatPlugin: EPUB Input running
on /var/www/tool/var/www-data/ws-c0_Pan_iang-139751013184292.epub
Parsing all content...
34% Running transforms on e-book...
Merging user specified metadata...
Detecting structure...
Flattening CSS and remapping font sizes...
Source base font size is 12.00000pt
Removing fake margins...
Cleaning up manifest...
Trimming unused files from manifest...
Trimming 'OPS/toc.ncx' from manifest
Trimming 'OPS/nav.xhtml' from manifest
Creating PDF Output...
67% Running PDF Output plugin
68% Parsed all content for markup transformation
70% Completed markup transformation
90% Rendered all HTML as PDF
91% Added links to PDF content
93% Adding headers and footers
96% Headers and footers added
Removed 1 unused fonts
Merged 4 instances of FreeSerifBold reducing size from 17.1 KB to 11.6 KB
Error Output:
================
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-www-data'
Traceback (most recent call last):
File "runpy.py", line 194, in _run_module_as_main
File "runpy.py", line 87, in _run_code
File "site.py", line 45, in <module>
File "site.py", line 41, in main
File "calibre/ebooks/conversion/cli.py", line 401, in main
File "calibre/ebooks/conversion/plumber.py", line 1274, in run
File "calibre/ebooks/conversion/plugins/pdf_output.py", line 188, in convert
File "calibre/ebooks/conversion/plugins/pdf_output.py", line 254, in convert_text
File "calibre/ebooks/pdf/html_writer.py", line 1087, in convert
File "calibre/ebooks/pdf/html_writer.py", line 778, in merge_fonts
File "calibre/ebooks/pdf/html_writer.py", line 745, in merge_font_files
File "calibre/utils/fonts/sfnt/subset.py", line 102, in pdf_subset
File "calibre/utils/fonts/sfnt/subset.py", line 54, in subset_truetype
calibre.utils.fonts.sfnt.errors.NoGlyphs: This font has no glyphs for the specified character set, subsetting it is pointless
" at /var/www/tool/vendor/symfony/process/Process.php line 262
Time: 2021-02-12T15:04:15.903332+00:00
Channel: request
Context: exception: {
"class": "Symfony\\Component\\Process\\Exception\\ProcessFailedException",
"message": "The command \"'ebook-convert' '/var/www/tool/var/www-data/ws-c0_Pan_iang-139751013184292.epub' '/var/www/tool/var/www-data/ws-c0_Pan_iang-139751265352313.pdf' '--page-breaks-before' '/' '--paper-size' 'a4' '--pdf-page-margin-bottom' '48' '--pdf-page-margin-top' '60' '--pdf-page-margin-left' '36' '--pdf-page-margin-right' '36' '--pdf-page-numbers' '--preserve-cover-aspect-ratio'\" failed.\n\nExit Code: 1(General error)\n\nWorking directory: /var/www/tool/public\n\nOutput:\n================\nConversion options changed from defaults:\n pdf_page_margin_top: 60.0\n pdf_page_margin_right: 36.0\n pdf_page_margin_left: 36.0\n pdf_page_numbers: True\n pdf_page_margin_bottom: 48.0\n preserve_cover_aspect_ratio: True\n paper_size: 'a4'\n1% Converting input to HTML...\nInputFormatPlugin: EPUB Input running\non /var/www/tool/var/www-data/ws-c0_Pan_iang-139751013184292.epub\nParsing all content...\n34% Running transforms on e-book...\nMerging user specified metadata...\nDetecting structure...\nFlattening CSS and remapping font sizes...\nSource base font size is 12.00000pt\nRemoving fake margins...\nCleaning up manifest...\nTrimming unused files from manifest...\nTrimming 'OPS/toc.ncx' from manifest\nTrimming 'OPS/nav.xhtml' from manifest\nCreating PDF Output...\n67% Running PDF Output plugin\n68% Parsed all content for markup transformation\n70% Completed markup transformation\n90% Rendered all HTML as PDF\n91% Added links to PDF content\n93% Adding headers and footers\n96% Headers and footers added\nRemoved 1 unused fonts\nMerged 4 instances of FreeSerifBold reducing size from 17.1 KB to 11.6 KB\n\n\nError Output:\n================\nQStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-www-data'\nTraceback (most recent call last):\n File \"runpy.py\", line 194, in _run_module_as_main\n File \"runpy.py\", line 87, in _run_code\n File \"site.py\", line 45, in <module>\n File \"site.py\", line 41, in main\n File \"calibre/ebooks/conversion/cli.py\", line 401, in main\n File \"calibre/ebooks/conversion/plumber.py\", line 1274, in run\n File \"calibre/ebooks/conversion/plugins/pdf_output.py\", line 188, in convert\n File \"calibre/ebooks/conversion/plugins/pdf_output.py\", line 254, in convert_text\n File \"calibre/ebooks/pdf/html_writer.py\", line 1087, in convert\n File \"calibre/ebooks/pdf/html_writer.py\", line 778, in merge_fonts\n File \"calibre/ebooks/pdf/html_writer.py\", line 745, in merge_font_files\n File \"calibre/utils/fonts/sfnt/subset.py\", line 102, in pdf_subset\n File \"calibre/utils/fonts/sfnt/subset.py\", line 54, in subset_truetype\ncalibre.utils.fonts.sfnt.errors.NoGlyphs: This font has no glyphs for the specified character set, subsetting it is pointless\n",
"code": 0,
"file": "/var/www/tool/vendor/symfony/process/Process.php:262",
"trace": [
"/var/www/tool/src/Generator/ConvertGenerator.php:153",
"/var/www/tool/src/Generator/ConvertGenerator.php:129",
"/var/www/tool/src/BookCreator.php:43",
"/var/www/tool/src/Controller/ExportController.php:135",
"/var/www/tool/src/Controller/ExportController.php:96",
"/var/www/tool/vendor/symfony/http-kernel/HttpKernel.php:157",
"/var/www/tool/vendor/symfony/http-kernel/HttpKernel.php:79",
"/var/www/tool/vendor/symfony/http-kernel/Kernel.php:196",
"/var/www/tool/public/index.php:35"
]
}
Extra: host: ws-export-test.wmcloud.org
uri: http://ws-export-test.wmcloud.org/?format=pdf-a4&lang=nan&page=Pan-i%C3%A2ng
```
==== Ebooks to reproduce problem
- https://ws-export-test.wmcloud.org/?lang=zh&page=%E5%91%A8%E6%9B%B8&format=pdf-a4&fonts=
- https://ws-export-test.wmcloud.org/?format=pdf-a4&lang=nan&page=Ch%C3%BA_%C3%AA_K%C3%AE-t%C3%B3-b%C3%BBn
- https://ws-export-test.wmcloud.org/?format=pdf-a4&lang=nan&page=H%C3%B4ng-hun_%C3%AA_K%C3%B2%CD%98-hiong
- https://ws-export-test.wmcloud.org/?format=pdf-a4&lang=nan&page=Pan-i%C3%A2ng
==== Environment
**WS Export:** https://ws-export-test.wmcloud.org/ version 2.3.0-2-g6a9f9d8.
==== Acceptance Criteria
* Investigate bug that results in errors and:
** Try to determine the cause of the issue
** Share findings in comment in this ticket
** If possible, issue fix or suggest next steps based on findings