bin/162670: [patch] libkiconv doesn't work with iconv() in libc

Jan Beich jbeich at tormail.net
Fri Nov 18 23:50:07 UTC 2011


>Number:         162670
>Category:       bin
>Synopsis:       [patch] libkiconv doesn't work with iconv() in libc
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Nov 18 23:50:06 UTC 2011
>Closed-Date:
>Last-Modified:
>Originator:     Jan Beich
>Release:        FreeBSD 10.0-CURRENT r227674M amd64
>Organization:
>Environment:
LANG=en_US.UTF-8
GNU libiconv is not installed, i.e. ports/161417
>Description:
>How-To-Repeat:
1. install world WITH_ICONV=
2. try to mount anything with unicode locale

   $ cdev=$(mdconfig -s 50m); newfs_msdos $cdev
   $ mount_msdosfs -L en_US.UTF-8 /dev/$cdev /media
   mount_msdosfs: Unable to load iconv library: Shared object "libiconv.so" not found, required by "mount_msdosfs"
   : No error: 0
   mount_msdosfs: msdosfs_iconv: No such file or directory
   Exit 71
   $ ln -s /lib/libc.so.7 /usr/lib/libiconv.so
   $ mount_msdosfs -L en_US.UTF-8 /dev/$cdev /media
   Exit 139

>Fix:
--- no_dlopen.diff begins here ---
Index: lib/libkiconv/Makefile
===================================================================
--- lib/libkiconv/Makefile	(revision 227674)
+++ lib/libkiconv/Makefile	(working copy)
@@ -17,4 +17,8 @@ CFLAGS+=	-I${.CURDIR}/../../sys
 
 WARNS?=		1
 
+.ifndef WITH_ICONV
+CFLAGS+=	-DICONV_DLOPEN
+.endif
+
 .include <bsd.lib.mk>
Index: lib/libkiconv/xlat16_iconv.c
===================================================================
--- lib/libkiconv/xlat16_iconv.c	(revision 227674)
+++ lib/libkiconv/xlat16_iconv.c	(working copy)
@@ -60,10 +60,18 @@ struct xlat16_table {
 static struct xlat16_table kiconv_xlat16_open(const char *, const char *, int);
 static int chklocale(int, const char *);
 
+#ifdef ICONV_DLOPEN
 static int my_iconv_init(void);
 static iconv_t (*my_iconv_open)(const char *, const char *);
 static size_t (*my_iconv)(iconv_t, const char **, size_t *, char **, size_t *);
 static int (*my_iconv_close)(iconv_t);
+#else
+#include <iconv.h>
+#define my_iconv_init() 0
+#define my_iconv_open iconv_open
+#define my_iconv iconv
+#define my_iconv_close iconv_close
+#endif
 static size_t my_iconv_char(iconv_t, const u_char **, size_t *, u_char **, size_t *);
 
 int
@@ -310,6 +318,7 @@ chklocale(int category, const char *code)
 	return (error);
 }
 
+#ifdef ICONV_DLOPEN
 static int
 my_iconv_init(void)
 {
@@ -327,6 +336,7 @@ my_iconv_init(void)
 
 	return (0);
 }
+#endif
 
 static size_t
 my_iconv_char(iconv_t cd, const u_char **ibuf, size_t * ilen, u_char **obuf,
--- no_dlopen.diff ends here ---
>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list