On Thursday, August 03, 2017 15:30 CEST, Jeremie Courreges-Anglas 
<[email protected]> wrote:

> On Wed, Aug 02 2017, "Sebastian Reitenbach" <[email protected]> 
> wrote:
> > Hi,
> >
> > I have one amd64 machine now on post clang, now running sysutils/facter 
> > with:
> > facter -p
> >
> > to also evaluate the puppet facts, it bails out on me as like:
> >
> > 2017-08-01 23:56:58.825508 WARN  puppetlabs.facter - Could not initialize 
> > locale, even with LC_* variables cleared. Continuing without localization 
> > support
> > 2017-08-01 23:57:03.604949 FATAL puppetlabs.facter - unhandled exception: 
> > ctype_byname<char>::ctype_byname failed to construct for C
> >
> > With my minimal C++ knowledge, I found "catch throw" in gdb, and figured 
> > that the 'C' comes from the
> > name of the locale, so I set environment and ran it like with:
> >
> > 2017-08-01 23:56:58.825508 WARN  puppetlabs.facter - Could not initialize 
> > locale, even with LC_* variables cleared. Continuing without localization 
> > support
> > 2017-08-01 23:57:03.604949 FATAL puppetlabs.facter - unhandled exception: 
> > boost::too_many_args: format-string referred to less arguments than were 
> > passed
> >
> > However, 'catch throw' does seem to end up always at the same spot in the 
> > program, so I see where
> > the unhandled exception is not handled, but where is it actually caused?
> > With my little C++ knowledge, I don't seem to see it:
> >
> > LANG=C LC_ALL=C egdb /usr/local/bin/facter
> > GNU gdb (GDB) 7.12.1
> > Copyright (C) 2017 Free Software Foundation, Inc.
> > License GPLv3+: GNU GPL version 3 or later 
> > <http://gnu.org/licenses/gpl.html>
> > This is free software: you are free to change and redistribute it.
> > There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
> > and "show warranty" for details.
> > This GDB was configured as "x86_64-unknown-openbsd6.1".
> > Type "show configuration" for configuration details.
> > For bug reporting instructions, please see:
> > <http://www.gnu.org/software/gdb/bugs/>.
> > Find the GDB manual and other documentation resources online at:
> > <http://www.gnu.org/software/gdb/documentation/>.
> > For help, type "help".
> > Type "apropos word" to search for commands related to "word"...
> > Reading symbols from /usr/local/bin/facter...done.
> > (gdb) catch throw
> > Catchpoint 1 (throw)
> > (gdb) r -p
> > Starting program: /usr/local/bin/facter -p
> > Catchpoint 1 (exception thrown), __cxa_throw (thrown_object=0x17eb74b24a80, 
> > tinfo=0x17eba8d5cc80 <typeinfo for std::runtime_error>, dest=0x17eba8b0f790 
> > <std::runtime_error::~runtime_error()>)
> >     at /usr/src/lib/libcxxabi/src/cxa_exception.cpp:223
> > 223         __cxa_eh_globals *globals = __cxa_get_globals();
> > (gdb) bt
> > #0  __cxa_throw (thrown_object=0x17eb74b24a80, tinfo=0x17eba8d5cc80 
> > <typeinfo for std::runtime_error>, dest=0x17eba8b0f790 
> > <std::runtime_error::~runtime_error()>)
> >     at /usr/src/lib/libcxxabi/src/cxa_exception.cpp:223
> > #1  0x000017eb7705728c in std::__1::collate_byname<char>::collate_byname 
> > (this=0x17ebd07b1b60, name=..., refs=<optimized out>) at 
> > /usr/src/lib/libcxx/src/locale.cpp:662
> > #2  0x000017eb77053643 in std::__1::locale::__imp::__imp 
> > (this=0x17ec13f9b200, name=..., refs=<optimized out>) at 
> > /usr/src/lib/libcxx/src/locale.cpp:210
> > #3  0x000017eb77056844 in std::__1::locale::locale (this=0x7f7ffffd2900, 
> > name=0x7f7ffffd2a21 "C") at /usr/src/lib/libcxx/src/locale.cpp:509
> > #4  0x000017eb41e9d09a in 
> > boost::locale::impl_std::std_localization_backend::loadable 
> > (this=0x17eb58725500, name=...) at libs/locale/src/std/std_backend.cpp:152
> > #5  0x000017eb41e9c457 in 
> > boost::locale::impl_std::std_localization_backend::prepare_data 
> > (this=0x17eb58725500) at libs/locale/src/std/std_backend.cpp:98
> > #6  0x000017eb41e9ace8 in 
> > boost::locale::impl_std::std_localization_backend::install 
> > (this=0x17eb58725500, base=..., category=1, type=1) at 
> > libs/locale/src/std/std_backend.cpp:164
> > #7  0x000017eb41e0f2e1 in 
> > boost::locale::localization_backend_manager::impl::actual_backend::install 
> > (this=0x17eb311d2c00, l=..., category=1, type=1)
> >     at libs/locale/src/shared/localization_backend.cpp:145
> > #8  0x000017eb41dfdeec in boost::locale::generator::generate 
> > (this=0x7f7ffffd3bd8, base=..., id=...) at 
> > libs/locale/src/shared/generator.cpp:141
> > #9  0x000017eb41dfd5fb in boost::locale::generator::generate 
> > (this=0x7f7ffffd3bd8, id=...) at libs/locale/src/shared/generator.cpp:116
> > #10 0x000017eb93708624 in boost::locale::generator::operator() 
> > (this=0x7f7ffffd3bd8, id=...) at 
> > /usr/local/include/boost/locale/generator.hpp:202
> > #11 0x000017eb9370704c in leatherman::locale::get_locale (id=..., 
> > domain=..., paths=...) at 
> > /home/ports/pobj/amd64/leatherman-1.0.0/leatherman-1.0.0/locale/src/locale.cc:48
> > #12 0x000017ebc99ef748 in setup_logging_internal (os=..., use_locale=true) 
> > at 
> > /home/ports/pobj/amd64/facter-3.7.0/facter-3.7.0/lib/src/logging/logging.cc:20
> > #13 0x000017ebc99eea0e in facter::logging::setup_logging (os=...) at 
> > /home/ports/pobj/amd64/facter-3.7.0/facter-3.7.0/lib/src/logging/logging.cc:64
> > #14 0x000017e915502b98 in main (argc=2, argv=0x7f7ffffd93e8) at 
> > /home/ports/pobj/amd64/facter-3.7.0/facter-3.7.0/exe/facter.cc:136
> >
> > If someone has a cluebat or can point me into the right direction, I'm all 
> > ears.
> > The only thing I can see, that leatherman, as well as boost is involved, 
> > and that all circles around LOCALE settings.
>
> Well, /usr/src/lib/libcxx/src/locale.cpp:662 looks like the offending line.
>
> IIUC libcxx wants to use xlocale support, but we don't implement that in
> libc.  libcxx/include/support/xlocale/__nop_locale_mgmt.h contains empty
> stubs that do build, but fail at runtime.
>
> Even this simple program fails at runtime:
>
>   #include <locale>
>   int main() { std::locale s(""); }
>
> > So, when building facter, telling it that leatherman doesn't support 
> > locale, fixes the problem, but I don't think that this is a proper solution.
> > So if someone has a pointer to the above, let me know.
>
> I guess xlocale support should be fixed (implemented?), but this may not
> be trivial.  You may need a workaround for facter in the meantime.

So if I understand you right, there is not much I can do about it right away,
My approach in the patch below, telling facter that
leatherman doesn't use locales, in order to just not use locles in Facter,
should do the trick for the time being.
Additionally I should add a comment with your explanation to it, to remind
myself about it ;)

If there are no objections, then  I'll go on with that on Monday.

cheers,
Sebastian

>
> > Sebastian
> >
> > Index: Makefile
> > ===================================================================
> > RCS file: /cvs/ports/sysutils/facter/Makefile,v
> > retrieving revision 1.46
> > diff -u -p -u -r1.46 Makefile
> > --- Makefile        26 Jul 2017 22:45:30 -0000      1.46
> > +++ Makefile        1 Aug 2017 22:22:42 -0000
> > @@ -8,7 +8,7 @@ DISTNAME =          facter-${VERSION}
> >  SHARED_LIBS +=     facter                    3.1 # 3.2
> >  PKGSPEC =          facter->=3.0,<4.0
> >  CATEGORIES =               sysutils
> > -REVISION =         0
> > +REVISION =         1
> >
> >  MAINTAINER =               Sebastian Reitenbach <[email protected]>
> >
> > @@ -40,6 +40,7 @@ LIB_DEPENDS =             devel/boost>=1.58 \
> >  BUILD_DEPENDS =            devel/gettext-tools
> >
> >  CONFIGURE_ARGS+=   
> > -DFACTER_RUBY="${LOCALBASE}/lib/libruby${MODRUBY_BINREV}.so" \
> > +                   -DLEATHERMAN_USE_LOCALES:Bool=No \
> >                     
> > -DRUBY_LIB_INSTALL="${PREFIX}/lib/ruby/vendor_ruby/${MODRUBY_REV}" \
> >                     -DWITHOUT_JRUBY:Bool=Yes
> >
> >
>
>
> --
> jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF  DDCC 0DFA 74AE 1524 E7EE
>

Reply via email to