# Possible corruption of gnu sort



## jdn06 (Jan 20, 2012)

When I try to compile any build from ports, I have this error:

```
Assertion failed: (mblength != (size_t)-1 && mblength != (size_t)-2), function inittables_mb,
 file /usr/src/gnu/usr.bin/sort/../../../contrib/gnu-sort/src/sort.c, line 706.
Assertion failed: (mblength != (size_t)-1 && mblength != (size_t)-2), function inittables_mb,
 file /usr/src/gnu/usr.bin/sort/../../../contrib/gnu-sort/src/sort.c, line 706.
Assertion failed: (mblength != (size_t)-1 && mblength != (size_t)-2), function inittables_mb,
 file /usr/src/gnu/usr.bin/sort/../../../contrib/gnu-sort/src/sort.c, line 706.
```

I tried to move /usr/src/gnu/usr.bin/sort/ and did a *csup* but nothing changed.
I don't know what I can do...
Any help welcome.
I am on 8.2-RELEASE-p6, with a i386 processor.


----------



## SirDice (Jan 20, 2012)

What exactly are you trying to build?


----------



## jdn06 (Jan 20, 2012)

For example the last build of openssl...


----------



## SirDice (Jan 20, 2012)

Did you use an alternative compiler to build world or the port?


----------



## jdn06 (Jan 20, 2012)

No, I don't think so. Here are my installed packages:

```
# pkg_info
adns-1.4_1          Easy to use, asynchronous-capable DNS client library and ut
ap22-mod_security-2.5.13_1 An intrusion detection and prevention engine
apache-2.2.21       Version 2.2.x of Apache web server with prefork MPM.
apachetop-0.12.6_2  Apache RealTime log stats
apr-ipv6-devrandom-gdbm-db42-mysql55-1.4.5.1.3.12_1 Apache Portability Library
arc-5.21p           Create & extract files from DOS .ARC files
arj-3.10.22_4       Open-source ARJ
autoconf-2.68       Automatically configure source code on many Un*x platforms 
autoconf-wrapper-20101119 Wrapper script for GNU autoconf
automake-1.11.1     GNU Standards-compliant Makefile generator (1.11)
automake-wrapper-20101119 Wrapper script for GNU automake
bigreqsproto-1.1.1  BigReqs extension headers
ca_root_nss-3.13.1  The root certificate bundle from the Mozilla Project
chkrootkit-0.49     A tool to locally check for signs of a rootkit
clamav-0.97.3_1     Command line virus scanner written entirely in C
cmake-2.8.7         A cross-platform Makefile generator
curl-7.21.3_2       Non-interactive tool to get files from FTP, GOPHER, HTTP(S)
db42-4.2.52_5       The Berkeley DB package, revision 4.2
dovecot-1.2.17      Secure and compact IMAP and POP3 servers
expat-2.0.1_2       XML 1.0 parser written in C
ezjail-3.2          A framework to easily create, manipulate and run FreeBSD ja
fam-2.6.10_4        A file alteration monitor
freetype2-2.4.7     A free and portable TrueType font rendering engine
ftpd-tls-20031008_2 Ftp server supporting FTP AUTH TLS
gdbm-1.9.1          The GNU database manager
gettext-0.18.1.1    GNU gettext package
gio-fam-backend-2.28.8 FAM backend for GLib\'s GIO library
glib-2.28.8_3       Some useful routines of C programming (current stable versi
gmake-3.82          GNU version of 'make' utility
help2man-1.40.5     Automatically generating simple manual pages from program o
iftop-0.17          Display bandwidth usage on an interface by host
inputproto-2.0.2    Input extension headers
jpeg-8_3            IJG's jpeg compression utilities
jtop-1.0            Wrapper to top(1) that maps pids to jails
kbproto-1.0.5       KB extension headers
lha-1.14i_6         Archive files using LZSS and Huffman compression (.lzh file
libICE-1.0.7,1      Inter Client Exchange library for X11
libSM-1.2.0,1       Session Management library for X11
libX11-1.4.4,1      X11 library
libXau-1.0.6        Authentication Protocol library for X11
libXaw-1.0.8,1      X Athena Widgets library
libXdmcp-1.1.0      X Display Manager Control Protocol library
libXext-1.3.0_1,1   X11 Extension library
libXmu-1.1.0,1      X Miscellaneous Utilities libraries
libXp-1.0.1,1       X print library
libXpm-3.5.9        X Pixmap library
libXt-1.0.9         X Toolkit library
libcheck-0.9.8      A unit test framework for C
libgcrypt-1.5.0     General purpose crypto library based on code used in GnuPG
libgpg-error-1.10   Common error values for all GnuPG components
libiconv-1.13.1_1   A character set conversion library
libidn-1.22         Internationalized Domain Names command line tool
libltdl-2.2.6b      System independent dlopen wrapper
libltdl-2.4_1       System independent dlopen wrapper
libmcrypt-2.5.8     Multi-cipher cryptographic library (used in PHP)
libpci-3.1.9        PCI configuration space I/O made easy
libpthread-stubs-0.3_3 This library provides weak aliases for pthread functions
libsigsegv-2.10     Handling page faults in user mode
libslang2-2.2.4     Routines for rapid alpha-numeric terminal applications deve
libssh2-1.3.0,2     A library implementing the SSH2 protocol
libtool-2.4_1       Generic shared library support script
libx86-1.1          A hardware-independent library for executing real-mode x86 
libxcb-1.7          The X protocol C-language Binding (XCB) library
libxml2-2.7.8_1     XML parser library for GNOME
libxslt-1.1.26_3    The XSLT C library for GNOME
links-2.5,1         Lynx-like text WWW browser
logwatch-7.4.0      A log file analysis program
lsof-4.86A,6        Lists information about open files (similar to fstat(1))
m4-1.4.16,1         GNU m4
makedepend-1.0.3,1  A dependency generator for makefiles
mc-4.7.5.5_1        Midnight Commander, a free Norton Commander Clone
mtop-0.6.6_2        MySQL Monitoring Tool
multitail-5.2.9     Tail multiple files on console with ncurses
mysql-client-5.5.20 Multithreaded SQL database (client)
mysql-server-5.5.20 Multithreaded SQL database (server)
ncdu-1.8            Ncurses du(1)
oniguruma-4.7.1     A BSDL Regular Expressions library compatible with POSIX/GN
openssl-1.0.0_8     SSL and crypto library
p5-Authen-SASL-2.15 Perl5 module for SASL authentication
p5-Crypt-SSLeay-0.58_1 Perl5 interface to allow p5-libwww LWP to make https connec
p5-Curses-1.28      Perl5 module for terminal screen handling and optimization
p5-DBI-1.616_1      The perl5 Database Interface.  Required for DBD::* modules
p5-Digest-HMAC-1.03 Perl5 interface to HMAC Message-Digest Algorithms
p5-Digest-SHA1-2.13 Perl interface to the SHA-1 Algorithm
p5-GSSAPI-0.28      Perl extension providing access to the GSSAPIv2 library
p5-Locale-gettext-1.05_3 Message handling functions
p5-MIME-Base64-3.13 Perl5 module for Base64 and Quoted-Printable encodings
p5-Net-1.22_1,1     Perl5 modules to access and use network protocols
p5-Storable-2.30_1  Persistency for perl data structures
p5-Term-ReadKey-2.30 A perl5 module for simple terminal control
p5-URI-1.59         Perl5 interface to Uniform Resource Identifier (URI) refere
p5-XML-Parser-2.41  Perl extension interface to James Clark's XML parser, expat
pciids-20120114     Database of all known ID's used in PCI devices
pcre-8.21_1         Perl Compatible Regular Expressions library
perl-5.14.2         Practical Extraction and Report Language
pftop-0.7_1         Utility for real-time display of statistics for pf
php5-5.3.9          PHP Scripting Language
php5-bz2-5.3.9      The bz2 shared extension for php
php5-ctype-5.3.9    The ctype shared extension for php
php5-curl-5.3.9     The curl shared extension for php
php5-dom-5.3.9      The dom shared extension for php
php5-filter-5.3.9   The filter shared extension for php
php5-ftp-5.3.9      The ftp shared extension for php
php5-gd-5.3.9       The gd shared extension for php
php5-hash-5.3.9     The hash shared extension for php
php5-iconv-5.3.9    The iconv shared extension for php
php5-json-5.3.9     The json shared extension for php
php5-mbstring-5.3.9 The mbstring shared extension for php
php5-mcrypt-5.3.9   The mcrypt shared extension for php
php5-mysql-5.3.9    The mysql shared extension for php
php5-mysqli-5.3.9   The mysqli shared extension for php
php5-openssl-5.3.9  The openssl shared extension for php
php5-pdo-5.3.9      The pdo shared extension for php
php5-pdo_mysql-5.3.9 The pdo_mysql shared extension for php
php5-pdo_sqlite-5.3.9 The pdo_sqlite shared extension for php
php5-posix-5.3.9    The posix shared extension for php
php5-session-5.3.9  The session shared extension for php
php5-simplexml-5.3.9 The simplexml shared extension for php
php5-sqlite-5.3.9   The sqlite shared extension for php
php5-tokenizer-5.3.9 The tokenizer shared extension for php
php5-xml-5.3.9      The xml shared extension for php
php5-xmlreader-5.3.9 The xmlreader shared extension for php
php5-xmlwriter-5.3.9 The xmlwriter shared extension for php
php5-xsl-5.3.9      The xsl shared extension for php
php5-zip-5.3.9      The zip shared extension for php
php5-zlib-5.3.9     The zlib shared extension for php
pkg-config-0.25_1   A utility to retrieve information about installed libraries
png-1.4.8           Library for manipulating PNG images
portaudit-0.5.17    Checks installed ports against a list of security vulnerabi
portcheck-1.13      Maintains the ports tree and checks up the installed packag
portmaster-3.11     Manage your ports without external databases or languages
portupdate-scan-0.3 Display pertinent parts of {PORTSDIR}/UPDATING
printproto-1.0.5    Print extension headers
pxz-0.20101123      Parallel LZMA compressor using liblzma
python27-2.7.2_3    An interpreted object-oriented programming language
rkhunter-1.3.8_1    Rootkit detection tool
rsync-3.0.9         A network file distribution/synchronization utility
rtmpdump-2.3_1      A tool to download RTMP streams
sendmail-8.14.5     Reliable, highly configurable mail transfer agent with util
sqlite3-3.7.9_1     An SQL database engine in a C library
t1lib-5.1.2_1,1     A Type 1 Rasterizer Library for UNIX/X11
tcl-8.5.11          Tool Command Language
tcl-modules-8.5.11  Tcl common modules
unzip-6.0_1         List, test and extract compressed files in a ZIP archive
unzoo-4.4_2         A zoo archive extractor
usbutils-0.86_1     Utility for listing USB devices
vbetool-1.1_1       An application for executing video card BIOS code
wget-1.13.4_1       Retrieve files from the Net via HTTP(S) and FTP
xcb-proto-1.6       The X protocol C-language Binding (XCB) protocol
xcmiscproto-1.2.1   XCMisc extension headers
xextproto-7.2.0     XExt extension headers
xf86bigfontproto-1.2.0 XFree86-Bigfont extension headers
xorg-macros-1.15.0  X.Org development aclocal macros
xproto-7.0.22       X11 protocol headers
xtrans-1.2.6        Abstract network code for X
zip-3.0             Create/update ZIP files compatible with pkzip
```


----------



## SirDice (Jan 20, 2012)

I had a quick look at the code that's mentioned in the error. It seems it fails to correctly convert a character to a wide-character code. Not sure why though.

Do you have any locale(1) settings that might be the cause?


----------



## jdn06 (Jan 20, 2012)

It could be the problem, as I changed it a few days ago.

```
# locale
LANG=fr_FR.ISO8859-15
LC_CTYPE=fr_FR.UTF-8
LC_COLLATE="fr_FR.ISO8859-15"
LC_TIME="fr_FR.ISO8859-15"
LC_NUMERIC="fr_FR.ISO8859-15"
LC_MONETARY="fr_FR.ISO8859-15"
LC_MESSAGES="fr_FR.ISO8859-15"
```

Do you see anything wrong? LC_CTYPE?


----------



## jdn06 (Jan 20, 2012)

That's it. Thank you very much. If I erase the *setenv LC_CTYPE* from .cshrc in /root, the problem disappears.


----------

