[Pkg-erlang-devel] Bug#840431: Bug#840431: rebar: Regression - causes FTBFS in erlang-p1-sqlite3 when built non-interactively

Sergei Golovan sgolovan at nes.ru
Tue Oct 11 18:06:20 UTC 2016


tags 840431 + patch
thanks

Hi, Philipp,

On Tue, Oct 11, 2016 at 5:45 PM, Philipp Huebner <debalance at debian.org> wrote:
> Package: rebar
> Version: 2.6.4-1
> Severity: important
>
> rebar 2.6.4-1 causes erlang-p1-sqlite3 to FTBFS during a non-interactive
> build (e.g. with git-buildpackage + pbuilder), see #839351.

Looks like rebar fails to build erlang-p1-sqlite3 because of the tilde
~ in its version (or more specifically, in the build directory path).
I've tried in pbuilder and get the directory name
/build/erlang-p1-sqlite3-1.1.5~dfsg0. Note the ~d. The issue is that
rebar takes some string with incorporated dirname as a format
specifier, so ~d means "decimal number", but there's no any number.

I'm attaching a small patch (untested) which makes the potentially
dangerous string an argument of io:format, and not a format string.

The bug is indeed introduced in rebar 2.6.4.

Cheers!
-- 
Sergei Golovan
-------------- next part --------------
--- rebar_port_compiler.erl.orig	2016-10-11 20:54:15.441030075 +0300
+++ rebar_port_compiler.erl	2016-10-11 20:59:11.518801425 +0300
@@ -230,7 +230,7 @@
         _ ->
             {ok, ClangDbFile} = file:open("compile_commands.json", [write]),
             ok = io:fwrite(ClangDbFile, "[~n", []),
-            lists:foreach(fun(E) -> ok = io:fwrite(ClangDbFile, E, []) end, Db),
+            lists:foreach(fun(E) -> ok = io:fwrite(ClangDbFile, "~s", [E]) end, Db),
             ok = io:fwrite(ClangDbFile, "]~n", []),
             ok = file:close(ClangDbFile)
     end,
@@ -272,14 +272,14 @@
     %% If there are more source files, make sure we end the CDB entry
     %% with a comma.
     Sep = case SrcRest of
-              [] -> "~n";
-              _  -> ",~n"
+              [] -> "";
+              _  -> ","
           end,
     %% CDB entry
     ?FMT("{ \"file\"      : ~p~n"
          ", \"directory\" : ~p~n"
          ", \"command\"   : ~p~n"
-         "}~s",
+         "}~s~n",
          [Src, Cwd, CDBCmd, Sep]).
 
 exec_compiler(Config, Source, Cmd, ShOpts) ->


More information about the Pkg-erlang-devel mailing list