[build2] [bug] Crash - Buffer Overrun when using different (unsupported?) directory layout

Klaim - Joël Lamotte mjklaim at gmail.com
Fri Feb 16 18:24:55 UTC 2018


Hi,

You will find in this email, below the "----", the error log and a link to
the zip
that contain all the repro case (it's pretty simple).
I only attempted it on Windows.

The following is how I got there (so that you get the mindset and maybe get
some
insight for future ux design issues).

I was trying to figure out why I have trouble converting the ChaiScript
library to build2
and in the process of isolating the noise I ended up discovering that:

1. build2 expect the following directory layout:
    /target-sources/buildfile
    /target-sources/manifest
    /target-sources/build/root.build
    /target-sources/build/bootstrap.build

  We learn that from the toolchain intro document, but I didn't find yet
where it is specified
  what is actually allowed or required. I didn't finish reading all the
available documentation,
  so could you point me to where it is specified, if it exists?


2. Because I was trying to add support for build2 to a library (ChaiScript)
that supports
   several different build systems and have different buildsystem files in
it's root directory,
   to avoid adding to the clutter I planned to add a directory named build2
to it's root directory
   and to all the build2-related stuffs in there.
   That is:

   /library-sources/build2/buildfile
   /library-sources/build2/manifest
   /library-sources/build2/root.build
   /library-sources/build2/bootstrap.build
   /library-sources/src/...

   Unfortunately it behaved in weird ways that I failed to understand (I
can explore more of this
   use case if you think you want to support it).
   I guessed that a "build/" directory was required to find the .build files
   so I moved the .build files in a new one below the directory containing
my
   buildfile and tried again:

   /library-sources/build2/buildfile
   /library-sources/build2/manifest
   /library-sources/build2/build/root.build
   /library-sources/build2/build/bootstrap.build
   /library-sources/src/...

   Which is the layout that trigger the error reported below.
   Note that in this situation I tried to use ".." in the buildfile to find
   files in the src directory.

3.   After Boris pointed me to the repos of build2 dependencies, I realized
that the only
   layout actually tested (which makes sense for packaging these libraries)
is one where
   the actual sources (or subrepo) is below the root dir.

     /my-build2-pkg/buildfile
     /my-build2-pkg/manifest
     /my-build2-pkg/build/root.build
     /my-build2-pkg/build/bootstrap.build
     /my-build2-pkg/library-sources/...

  This work as expected of course, so I will continue with it.
   I'm still surprised that the other layout are failing.

4. So basically, as soon as I try to use "$src_base/../src/" in the
buildfile, I get weird issues.
    Either that or there are problems with these layouts, or they are not
supported.
    The build system manual name pattern section do not mention any usage
of ".." so
    is it forbidden?

A. Joël Lamotte


------------------------------------------------------------------------

The repro case:
http://klaimsden.net/temp/jlamotte-build2-experiments_failextllib.zip

Output of running the repro case bat script:

G:\perso\experiments> .\setup_failing_extlib.bat

G:\perso\experiments>bpkg --version
bpkg 0.7.0-a.0.70bf3a57714b813e
libbpkg 0.7.0-a.0.18e40e91c99088ef
libbutl 0.7.0-a.0.3b1ce034f9bb01b6
Copyright (c) 2014-2017 Code Synthesis Ltd
This is free software released under the MIT license.

G:\perso\experiments>b --version
build2 0.7.0-a.0.ef12b3bf80e2eec3
libbutl 0.7.0-a.0.3b1ce034f9bb01b6
host x86_64-microsoft-win32-msvc14.1
Copyright (c) 2014-2017 Code Synthesis Ltd
This is free software released under the MIT license.

G:\perso\experiments>mkdir config-weird-dependencies

G:\perso\experiments>pushd config-weird-dependencies

G:\perso\experiments\config-weird-dependencies>bpkg create cxx config.cxx=cl
created new configuration in G:\perso\experiments\config-weird-dependencies\

G:\perso\experiments\config-weird-dependencies>popd

G:\perso\experiments>bpkg build ./extlib_fail/build2/ -d
./config-weird-dependencies/
unpacked failextlib/1.0.0
Assertion failed: s.sub (src_root), file
G:\perso\build2-build\build2-toolchain-0.7-a.0\build2-0.7.0-a.0.1518678414.ef12b3bf80e2eec3\build2\context.cxx,
line 743
error: b -q
configure('G:\perso\experiments\extlib_fail\build2\'@'./config-weird-dependencies/failextlib-1.0.0\')
terminated abnormally: stack buffer overrun
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.build2.org/archives/users/attachments/20180216/1019d7aa/attachment-0001.html>


More information about the users mailing list