Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
C
capnproto
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
capnproto
Commits
af899ceb
Commit
af899ceb
authored
Aug 08, 2016
by
Kenton Varda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don't fail evolution-test when it triggers issue #344.
parent
8ba8d95b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
2 deletions
+22
-2
evolution-test.c++
c++/src/capnp/compiler/evolution-test.c++
+12
-0
node-translator.c++
c++/src/capnp/compiler/node-translator.c++
+10
-2
No files found.
c++/src/capnp/compiler/evolution-test.c++
View file @
af899ceb
...
...
@@ -868,6 +868,18 @@ public:
}
kj
::
MainBuilder
::
Validity
run
()
{
// https://github.com/sandstorm-io/capnproto/issues/344 describes an obscure bug in the layout
// algorithm, the fix for which breaks backwards-compatibility for any schema triggering the
// bug. In order to avoid silently breaking protocols, we are temporarily throwing an exception
// in cases where this bug would have occurred, so that people can decide what to do.
// However, the evolution test can occasionally trigger the bug (depending on the random path
// it takes). Rather than try to avoid it, we disable the exception-throwing, because the bug
// is actually fixed, and the exception is only there to raise awareness of the compatibility
// concerns.
//
// On Linux, seed 1467142714 (for example) will trigger the exception (without this env var).
setenv
(
"CAPNP_IGNORE_ISSUE_344"
,
"1"
,
true
);
srand
(
seed
);
{
...
...
c++/src/capnp/compiler/node-translator.c++
View file @
af899ceb
...
...
@@ -30,6 +30,10 @@
namespace
capnp
{
namespace
compiler
{
bool
shouldDetectIssue344
()
{
return
getenv
(
"CAPNP_IGNORE_ISSUE_344"
)
==
nullptr
;
}
class
NodeTranslator
::
StructLayout
{
// Massive, disgusting class which implements the layout algorithm, which decides the offset
// for each field.
...
...
@@ -411,7 +415,7 @@ public:
// Underlying slot is big enough, so expand our size and update holes.
if
(
newHoles
)
{
holes
.
addHolesAtEnd
(
lgSizeUsed
,
1
,
desiredUsage
);
}
else
{
}
else
if
(
shouldDetectIssue344
())
{
// Unfortunately, Cap'n Proto 0.5.x and below would always call addHolesAtEnd(), which
// was the wrong thing to do when called from tryExpand(), which itself is only called
// in cases involving unions nested in other unions. The bug could lead to multiple
...
...
@@ -526,7 +530,11 @@ public:
// problem and throw an exception.
//
// TODO(cleanup): Once sufficient time has elapsed, switch to "return false;" here.
mustFail
=
true
;
if
(
shouldDetectIssue344
())
{
mustFail
=
true
;
}
else
{
return
false
;
}
}
for
(
uint
i
=
0
;
i
<
parentDataLocationUsage
.
size
();
i
++
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment