Bug 203301

Summary: java/jakarta-commons-httpclient: error: unmappable character for encoding UTF8
Product: Ports & Packages Reporter: O. Hartmann <ohartmann>
Component: Individual Port(s)Assignee: Alex Dupre <ale>
Status: Closed FIXED    
Severity: Affects Many People CC: cmt, lantw44, mg, owen94012, w.schwarzenfeld
Priority: --- Flags: bugzilla: maintainer-feedback? (ale)
Version: Latest   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
fix REINPLACE operation to use the right CTYPE
none
make sure to really override any LC_* variables
cmt: maintainer-approval?
poudriere testport log (10.2/amd64) none

Description O. Hartmann 2015-09-24 04:42:52 UTC
While updateing LibreOffice towards 5.0.2, the process dies on this jakarta bug:

[...]
    [javac] /usr/ports/java/jakarta-commons-httpclient/work/commons-httpclient-3.1/build.xml:184: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds
    [javac] Compiling 139 source files to /usr/ports/java/jakarta-commons-httpclient/work/commons-httpclient-3.1/target/classes
    [javac] /usr/ports/java/jakarta-commons-httpclient/work/commons-httpclient-3.1/src/java/org/apache/commons/httpclient/HttpContentTooLargeException.java:6: error: unmappable character for encoding UTF8
    [javac]  * @author Ortwin Gl�ck
    [javac]                     ^
    [javac] 1 error

BUILD FAILED
/usr/ports/java/jakarta-commons-httpclient/work/commons-httpclient-3.1/build.xml:184: Compile failed; see the compiler error output for details.

Total time: 0 seconds
*** Error code 1
Comment 1 Christoph Moench-Tegeder freebsd_committer freebsd_triage 2015-09-24 09:37:43 UTC
Created attachment 161324 [details]
fix REINPLACE operation to use the right CTYPE

According to environ(7), LANG "...configures all programs which use setlocale(3) to use the specified locale unless the LC_* variables are set.". If LC_CTYPE leaks in from the user's shell, setting LANG in the Makefile will not have it's desired effect. Fix this by setting LC_CTYPE explicitly.
Comment 2 O. Hartmann 2015-09-24 15:17:18 UTC
In my case, LC_CTYPE is explicitely set to en_US.utf-8. I had to unset it, before starting the compilation process again. After unsetting LC_CTYPE, I found the compilation and installation of the port working. But this is a dirty workaround.
Comment 3 Ting-Wei Lan 2016-01-23 09:57:36 UTC
Attachment 161324 [details] doesn't work when LC_ALL is set. LC_CTYPE cannot override LC_ALL.
Comment 4 Christoph Moench-Tegeder freebsd_committer freebsd_triage 2016-01-23 14:58:13 UTC
Created attachment 166002 [details]
make sure to really override any LC_* variables

You're right (I'm using a mixed locale, so I always forget about LC_ALL).
So I guess we should be safe by setting LC_ALL for the replacement operation, see updated patch.
Comment 5 Christoph Moench-Tegeder freebsd_committer freebsd_triage 2016-01-23 14:59:04 UTC
Created attachment 166004 [details]
poudriere testport log (10.2/amd64)

and here's the QA for that.
Comment 6 Ting-Wei Lan 2016-01-23 17:59:14 UTC
Attachment 166002 [details] is identical to my local patch, so I think it will work.
Comment 7 Marcin Gryszkalis 2016-12-27 18:30:39 UTC
patch tested successfully on 10.3/amd64
Comment 8 bye 2016-12-29 21:55:33 UTC
My .cshrc

setenv  LANG        "en_US.UTF-8"
setenv  LC_COLLATE  "en_US.UTF-8"
setenv  LC_CTYPE    "en_US.UTF-8"
setenv  LC_MESSAGES "en_US.UTF-8"
setenv  LC_MONETARY "en_US.UTF-8"
setenv  LC_NUMERIC  "en_US.UTF-8"
setenv  LC_TIME     "en_US.UTF-8"
setenv  LC_ALL      "en_US.UTF-8"


I am on FreeBSD 12-CURRENT and can confirm that this does fix this issue.
Comment 9 Walter Schwarzenfeld 2018-01-16 09:10:02 UTC
Fix confirmed, close here.