Fix assertion failure in nix-env
$ nix-env -f ~/Dev/nixops/ -iA foo nix-env: src/libexpr/eval.hh:57: void nix::Bindings::push_back(const nix::Attr&): Assertion `size_ < capacity' failed. Aborted
This commit is contained in:
parent
a5e2c8e560
commit
c2a8b5c42d
|
@ -39,10 +39,10 @@ public:
|
||||||
typedef uint32_t size_t;
|
typedef uint32_t size_t;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
size_t size_, capacity;
|
size_t size_, capacity_;
|
||||||
Attr attrs[0];
|
Attr attrs[0];
|
||||||
|
|
||||||
Bindings(uint32_t capacity) : size_(0), capacity(capacity) { }
|
Bindings(size_t capacity) : size_(0), capacity_(capacity) { }
|
||||||
Bindings(const Bindings & bindings) = delete;
|
Bindings(const Bindings & bindings) = delete;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -54,7 +54,7 @@ public:
|
||||||
|
|
||||||
void push_back(const Attr & attr)
|
void push_back(const Attr & attr)
|
||||||
{
|
{
|
||||||
assert(size_ < capacity);
|
assert(size_ < capacity_);
|
||||||
attrs[size_++] = attr;
|
attrs[size_++] = attr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -76,6 +76,8 @@ public:
|
||||||
|
|
||||||
void sort();
|
void sort();
|
||||||
|
|
||||||
|
size_t capacity() { return capacity_; }
|
||||||
|
|
||||||
friend class EvalState;
|
friend class EvalState;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -132,6 +132,8 @@ static void getAllExprs(EvalState & state,
|
||||||
Value & vArg(*state.allocValue());
|
Value & vArg(*state.allocValue());
|
||||||
state.getBuiltin("import", vFun);
|
state.getBuiltin("import", vFun);
|
||||||
mkString(vArg, path2);
|
mkString(vArg, path2);
|
||||||
|
if (v.attrs->size() == v.attrs->capacity())
|
||||||
|
throw Error(format("too many Nix expressions in directory ‘%1%’") % path);
|
||||||
mkApp(*state.allocAttr(v, state.symbols.create(attrName)), vFun, vArg);
|
mkApp(*state.allocAttr(v, state.symbols.create(attrName)), vFun, vArg);
|
||||||
}
|
}
|
||||||
else if (S_ISDIR(st.st_mode))
|
else if (S_ISDIR(st.st_mode))
|
||||||
|
@ -160,7 +162,7 @@ static void loadSourceExpr(EvalState & state, const Path & path, Value & v)
|
||||||
~/.nix-defexpr directory that includes some system-wide
|
~/.nix-defexpr directory that includes some system-wide
|
||||||
directory). */
|
directory). */
|
||||||
if (S_ISDIR(st.st_mode)) {
|
if (S_ISDIR(st.st_mode)) {
|
||||||
state.mkAttrs(v, 16);
|
state.mkAttrs(v, 1024);
|
||||||
state.mkList(*state.allocAttr(v, state.symbols.create("_combineChannels")), 0);
|
state.mkList(*state.allocAttr(v, state.symbols.create("_combineChannels")), 0);
|
||||||
StringSet attrs;
|
StringSet attrs;
|
||||||
getAllExprs(state, path, attrs, v);
|
getAllExprs(state, path, attrs, v);
|
||||||
|
|
Loading…
Reference in a new issue