[Nix-dev] ‘boost::too_few_args’ in ‘getLineFromSubstituter’

Ludovic Courtès ludo at gnu.org
Fri Mar 28 15:52:20 CET 2014


Hi,

In some cases (substituter error), I’m getting this:

  unexpected Nix daemon error: boost::too_few_args: format-string refered to more arguments than were passed

After replacing the ‘throw’ with ‘abort’ in format_implementation.cc, I
was able to get a backtrace:

--8<---------------cut here---------------start------------->8---
(gdb) bt
#0  0x00007fe60908d409 in raise () from /gnu/store/hf5kklv837xbfcv6gc7gpsj36l69j3sj-glibc-2.19/lib/libc.so.6
#1  0x00007fe60908e808 in abort () from /gnu/store/hf5kklv837xbfcv6gc7gpsj36l69j3sj-glibc-2.19/lib/libc.so.6
#2  0x000000000047aac2 in boost::basic_format::str (this=this at entry=0x7ffffa463b40) at nix/boost/format/format_implementation.cc:164
#3  0x000000000047594c in nix::printMsg_ (level=level at entry=nix::lvlError, f=...) at nix/libutil/util.cc:455
#4  0x0000000000426ba4 in nix::LocalStore::getLineFromSubstituter (this=this at entry=0xc7f500, run=...) at nix/libstore/local-store.cc:1145
#5  0x000000000042ccf0 in nix::LocalStore::querySubstitutablePaths (this=0xc7f500, paths=...) at nix/libstore/local-store.cc:1193
#6  0x00000000004090c5 in performOp (from=..., to=..., op=32, clientVersion=<optimized out>, trusted=false) at nix/nix-daemon/nix-daemon.cc:332
#7  processConnection (trusted=trusted at entry=false) at nix/nix-daemon/nix-daemon.cc:730
#8  0x000000000040dc94 in daemonLoop () at nix/nix-daemon/nix-daemon.cc:904
#9  0x000000000040e5b1 in run (args=...) at nix/nix-daemon/nix-daemon.cc:929
#10 0x0000000000406dc1 in main (argc=<optimized out>, argv=<optimized out>) at nix/nix-daemon/guix-daemon.cc:325
(gdb) bt full
#0  0x00007fe60908d409 in raise () from /gnu/store/hf5kklv837xbfcv6gc7gpsj36l69j3sj-glibc-2.19/lib/libc.so.6
No symbol table info available.
#1  0x00007fe60908e808 in abort () from /gnu/store/hf5kklv837xbfcv6gc7gpsj36l69j3sj-glibc-2.19/lib/libc.so.6
No symbol table info available.
#2  0x000000000047aac2 in boost::basic_format::str (this=this at entry=0x7ffffa463b40) at nix/boost/format/format_implementation.cc:164
        sz = <optimized out>
        i = <optimized out>
        res = {static npos = <optimized out>, _M_dataplus = {<std::allocator<char>> = {<__gnu_cxx::new_allocator<char>> = {<No data fields>}, <No data fields>}, 
            _M_p = 0xcfd308 "1724: 13 [%start-stack load-stack #<procedure 9ee040 at ice-9/boot-9.scm:4041:10 ()>]\n"}}
        __PRETTY_FUNCTION__ = "std::string boost::basic_format::str() const"
#3  0x000000000047594c in nix::printMsg_ (level=level at entry=nix::lvlError, f=...) at nix/libutil/util.cc:455
        prefix = {static npos = <optimized out>, _M_dataplus = {<std::allocator<char>> = {<__gnu_cxx::new_allocator<char>> = {<No data fields>}, <No data fields>}, 
            _M_p = 0x6ad8d8 <std::string::_Rep::_S_empty_rep_storage@@GLIBCXX_3.4+24> ""}}
        s = {static npos = <optimized out>, _M_dataplus = {<std::allocator<char>> = {<__gnu_cxx::new_allocator<char>> = {<No data fields>}, <No data fields>}, _M_p = 0x49 <error: Cannot access memory at address 0x49>}}
#4  0x0000000000426ba4 in nix::LocalStore::getLineFromSubstituter (this=this at entry=0xc7f500, run=...) at nix/libstore/local-store.cc:1145
        buf = "1724: 13 [%start-stack load-stack #<procedure 9ee040 at ice-9/boot-9.scm:4041:10 ()>]\n\343ζ\270\066\231\307>\376\253*\373U\360\357ZG\335\300\301\350=\032ӱ\230\250)\241b\034\342lO\317H\345,\035\031O%j[\336uc\341\301\364%E6\242\024$@(\001D\021\304\342\033\270GD?\222Jw=҂`\243\000\213\206\353\035rs\331\377\353D\365߃m\031\252u\366\344\256\fhz\240ȺZz\313\017s\365!\257K)\021\t7\005c\267"...
        n = <optimized out>
        p = 85
        fds = {fds_bits = {16384, 0 <repeats 15 times>}}
        res = {static npos = <optimized out>, _M_dataplus = {<std::allocator<char>> = {<__gnu_cxx::new_allocator<char>> = {<No data fields>}, <No data fields>}, 
            _M_p = 0x6ad8d8 <std::string::_Rep::_S_empty_rep_storage@@GLIBCXX_3.4+24> ""}}
        err = {static npos = <optimized out>, _M_dataplus = {<std::allocator<char>> = {<__gnu_cxx::new_allocator<char>> = {<No data fields>}, <No data fields>}, 
            _M_p = 0xcfd308 "1724: 13 [%start-stack load-stack #<procedure 9ee040 at ice-9/boot-9.scm:4041:10 ()>]\n"}}
#5  0x000000000042ccf0 in nix::LocalStore::querySubstitutablePaths (this=0xc7f500, paths=...) at nix/libstore/local-store.cc:1193
        path = {static npos = <optimized out>, _M_dataplus = {<std::allocator<char>> = {<__gnu_cxx::new_allocator<char>> = {<No data fields>}, <No data fields>}, 
            _M_p = 0x6ad8d8 <std::string::_Rep::_S_empty_rep_storage@@GLIBCXX_3.4+24> ""}}
        run = @0xcead48: {program = {static npos = <optimized out>, _M_dataplus = {<std::allocator<char>> = {<__gnu_cxx::new_allocator<char>> = {<No data fields>}, <No data fields>}, _M_p = 0xcb8938 "substitute-binary"}}, 
          pid = {pid = 14286, separatePG = false, killSignal = 9}, to = {fd = 11}, from = {fd = 12}, error = {fd = 14}, fromBuf = {<nix::BufferedSource> = {<nix::Source> = {
                _vptr.Source = 0x492e70 <vtable for nix::FdSource+16>}, bufSize = 32768, bufPosIn = 0, bufPosOut = 0, buffer = 0xd2d620 "\n\266?\t\346\177"}, fd = 12}, disabled = false}
        s = {static npos = <optimized out>, _M_dataplus = {<std::allocator<char>> = {<__gnu_cxx::new_allocator<char>> = {<No data fields>}, <No data fields>}, 
            _M_p = 0xd37e68 "have /gnu/store/0d7xnp3nji2mi4cw4jmd3mzbpija9a5a-xz-5.0.4.tar.gz /gnu/store/0m6iv2lbkbjb3imjy29vqdrkv48wrjk0-linux-libre-headers-3.3.8 /gnu/store/0mnhmrnvmgvaiqkf78l8k51icbn6mzdn-module-import /gnu/st"...}}
        i = {_M_node = 0xc6efa0}
        res = {_M_t = {
            _M_impl = {<std::allocator<std::_Rb_tree_node<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >> = {<__gnu_cxx::new_allocator<std::_Rb_tree_node<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >> = {<No data fields>}, <No data fields>}, 
              _M_key_compare = {<std::binary_function<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool>> = {<No data fields>}, <No data fields>}, _M_header = {_M_color = std::_S_red, _M_parent = 0x0, _M_left = 0x7ffffa4653e8, _M_right = 0x7ffffa4653e8}, _M_node_count = 0}}}
#6  0x00000000004090c5 in performOp (from=..., to=..., op=32, clientVersion=<optimized out>, trusted=false) at nix/nix-daemon/nix-daemon.cc:332
        paths = {_M_t = {
            _M_impl = {<std::allocator<std::_Rb_tree_node<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >> = {<__gnu_cxx::new_allocator<std::_Rb_tree_node<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >> = {<No data fields>}, <No data fields>}, 
              _M_key_compare = {<std::binary_function<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool>> = {<No data fields>}, <No data fields>}, _M_header = {_M_color = std::_S_red, _M_parent = 0xcf6630, _M_left = 0xd1ddc0, _M_right = 0xc944f0}, _M_node_count = 146}}}
        res = {_M_t = {
            _M_impl = {<std::allocator<std::_Rb_tree_node<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >> = {<__gnu_cxx::new_allocator<std::_Rb_tree_node<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >> = {<No data fields>}, <No data fields>}, 
              _M_key_compare = {<std::binary_function<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool>> = {<No data fields>}, <No data fields>}, _M_header = {_M_color = std::_S_red, _M_parent = 0x0, _M_left = 0x7ffffa4653e8, _M_right = 0x7ffffa4653e8}, _M_node_count = 0}}}
#7  processConnection (trusted=trusted at entry=false) at nix/nix-daemon/nix-daemon.cc:730
        op = <optimized out>
        magic = <optimized out>
        clientVersion = <optimized out>
        reserveSpace = <optimized out>
        __PRETTY_FUNCTION__ = "void processConnection(bool)"
        opCount = 326
#8  0x000000000040dc94 in daemonLoop () at nix/nix-daemon/nix-daemon.cc:904
        remote = {fd = 4}
        clientUid = 1000
        trusted = false
        cred = {pid = 14272, uid = 1000, gid = 100}
        credLen = 12
        remoteAddr = {sun_family = 1, 
          sun_path = "./socket\000\000\000\000\000\000\000\000\000\000\001\000\000\000o\003\000\000\001", '\000' <repeats 11 times>, "\250\227<\n\346\177\000\000\300sF\372\377\177\000\000\340\024=\n\346\177\000\000\350sF\372\377\177\000\000\210\021=\n\346\177\000\000\001\000\000\000\000\000\000\000\215\224\033\n\346\177\000\000\000\000\000\000\000\000\000\000\250\227<\n\346\177"}
        remoteAddrLen = 2
        clientPid = 14272
        child = <optimized out>
        fdSocket = {fd = 3}
        __PRETTY_FUNCTION__ = "void daemonLoop()"
#9  0x000000000040e5b1 in run (args=...) at nix/nix-daemon/nix-daemon.cc:929
No locals.
#10 0x0000000000406dc1 in main (argc=<optimized out>, argv=<optimized out>) at nix/nix-daemon/guix-daemon.cc:325
        search_path = {static npos = <optimized out>, _M_dataplus = {<std::allocator<char>> = {<__gnu_cxx::new_allocator<char>> = {<No data fields>}, <No data fields>}, 
            _M_p = 0xc6f0a8 "/home/ludo/src/guix/nix/scripts:/home/ludo/src/guix/scripts:/home/ludo/src/guix:/home/ludo/soft/bin:/var/setuid-wrappers:/home/ludo/.guix-profile/bin:/home/ludo/.guix-profile/sbin:/home/ludo/bin:/var/"...}}
        nothing = {<std::_List_base<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >> = {
            _M_impl = {<std::allocator<std::_List_node<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >> = {<__gnu_cxx::new_allocator<std::_List_node<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >> = {<No data fields>}, <No data fields>}, _M_node = {_M_next = 0x7ffffa4675c0, _M_prev = 0x7ffffa4675c0}}}, <No data fields>}
--8<---------------cut here---------------end--------------->8---

(Unfortunately I don’t have the libstdc++ pretty-printers here.)

I’m under the impression that the 2nd arg to printMsg (in
‘getLineFromSubstituter’) is implicitly cast to ‘format’, which is
likely to cause problems if it contains the percent sign.

Ideas?

Thanks,
Ludo’.


More information about the nix-dev mailing list