Bug 36234

Summary: Reports can not be created
Product: UCS Reporter: Florian Best <best>
Component: UMC - ReportsAssignee: Johannes Keiser <keiser>
Status: CLOSED FIXED QA Contact: Florian Best <best>
Severity: normal    
Priority: P5 CC: gohmann, klaeser, walkenhorst
Version: UCS 4.0   
Target Milestone: UCS 4.0-0-errata   
Hardware: Other   
OS: Linux   
See Also: https://forge.univention.org/bugzilla/show_bug.cgi?id=37227
What kind of report is it?: --- What type of bug is this?: ---
Who will be affected by this bug?: --- How will those affected feel about the bug?: ---
User Pain: Enterprise Customer affected?:
School Customer affected?: ISV affected?:
Waiting Support: Flags outvoted (downgraded) after PO Review:
Ticket number: Bug group (optional):
Max CVSS v3 score:
Attachments: log
patch

Description Florian Best univentionstaff 2014-10-20 13:23:31 CEST
The PDF (Standard report) can not be created anymore. CSV report works. UMC shows the following error but the logfiles doesn't contain anything (both directory-reports*.log are empty).

Report creation has failed
The report could not be created. Details for the problems can be found in the log files.
Comment 1 Florian Best univentionstaff 2014-11-03 23:22:01 CET
Reference `LastPage' on page 2 undefined on input line 147.

only happens for groups/group cn=Administrators german session.
Comment 2 Florian Best univentionstaff 2014-11-24 18:50:19 CET
Created attachment 6463 [details]
log

The UMC-Server clears all environment variables which is causing this issue.
Attached is the logfile from pdflatex.
Comment 3 Florian Best univentionstaff 2014-11-24 18:51:30 CET
!pdfTeX error: /usr/bin/pdflatex (file ecbx0700): Font ecbx0700 at 600 not foun
d
Comment 4 Johannes Keiser univentionstaff 2015-01-08 13:35:40 CET
It seems that latex was missing a directory to save and load fonts from.

Fix:

Index: debian/python-univention-directory-reports.dirs
===================================================================
--- debian/python-univention-directory-reports.dirs     (Revision 0)
+++ debian/python-univention-directory-reports.dirs     (Revision 0)
@@ -0,0 +1 @@
+var/cache/univention-directory-reports
Index: modules/univention/directory/reports/document.py
===================================================================
--- modules/univention/directory/reports/document.py    (Revision 57133)
+++ modules/univention/directory/reports/document.py    (Arbeitskopie)
@@ -125,8 +125,9 @@
                cmd = ['pdflatex', '-interaction=nonstopmode', '-halt-on-error', '-output-directory=%s' % os.path.dirname(latex_file), latex_file]
                devnull = open(os.path.devnull, 'w')
                try:
-                       if not subprocess.call(cmd, stdout=devnull, stderr=devnull):
-                               if not subprocess.call(cmd, stdout=devnull, stderr=devnull):
+                       envVars = {'HOME': '/var/cache/univention-directory-reports'}
+                       if not subprocess.call(cmd, stdout=devnull, stderr=devnull, env=envVars):
+                               if not subprocess.call(cmd, stdout=devnull, stderr=devnull, env=envVars):
                                        return '%s.pdf' % latex_file.rsplit('.', 1)[0]
                        print >>sys.stderr, "error: failed to create PDF file"
                        return None
Comment 5 Johannes Keiser univentionstaff 2015-01-09 11:44:08 CET
Created attachment 6584 [details]
patch
Comment 6 Alexander Kläser univentionstaff 2015-01-29 12:32:41 CET
FYI, I needed to apply the following changes in order to make it work in my VM:

> cmd = ['/usr/bin/pdflatex', '-interaction=nonstopmode', '-halt-on-error', '-output-directory=%s' % os.path.dirname(latex_file), latex_file]

and

> env_vars = {'PATH': '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', 'HOME': '/var/cache/univention-directory-reports'}

... then it worked.
Comment 7 Johannes Keiser univentionstaff 2015-01-29 13:51:35 CET
In reply to Johannes Keiser from comment #5)
> Created attachment 6584 [details]
> patch

(In reply to Alexander Kläser from comment #6)
> FYI, I needed to apply the following changes in order to make it work in my
> VM:
> 
> > cmd = ['/usr/bin/pdflatex', '-interaction=nonstopmode', '-halt-on-error', '-output-directory=%s' % os.path.dirname(latex_file), latex_file]
> 
> and
> 
> > env_vars = {'PATH': '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', 'HOME': '/var/cache/univention-directory-reports'}
> 
> ... then it worked.

implemented the patch
   patch: r57567
   univention-directory-reports (7.0.0-2)

and added the above changes(comment #6), should work now
   r57668
   univention-directory-reports (7.0.0-3)

YAML: r57669
Comment 8 Florian Best univentionstaff 2015-01-29 14:15:25 CET
OK: reports can be created via UMC and CLI in DE+EN.
YAML: OK
Comment 9 Janek Walkenhorst univentionstaff 2015-02-04 15:56:31 CET
<http://errata.univention.de/ucs/4.0/77.html>