Skip to content

Commit 933df40

Browse files
authored
Merge pull request #261 from DeterminateSystems/sync-2.32.4
Sync with upstream 2.32.4
2 parents 04786b6 + 60dbcf5 commit 933df40

File tree

8 files changed

+71
-10
lines changed

8 files changed

+71
-10
lines changed

.version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.32.3
1+
2.32.4

nix-meson-build-support/common/meson.build

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,26 @@ if cxx.get_id() == 'clang'
4242
add_project_arguments('-fpch-instantiate-templates', language : 'cpp')
4343
endif
4444

45+
# Detect if we're using libstdc++ (GCC's standard library)
46+
# libstdc++ uses Intel TBB as backend for C++17 parallel algorithms when <execution> is included.
47+
# boost::concurrent_flat_map includes <execution>, which would require linking against TBB.
48+
# Since we don't actually use parallel algorithms, disable the TBB backend to avoid the dependency.
49+
# TBB is a dependency of blake3 and leaking into our build environment.
50+
is_using_libstdcxx = cxx.compiles(
51+
'''
52+
#include <ciso646>
53+
#ifndef __GLIBCXX__
54+
#error "not libstdc++"
55+
#endif
56+
int main() { return 0; }
57+
''',
58+
name : 'using libstdc++',
59+
)
60+
61+
if is_using_libstdcxx
62+
add_project_arguments('-D_GLIBCXX_USE_TBB_PAR_BACKEND=0', language : 'cpp')
63+
endif
64+
4565
# Darwin ld doesn't like "X.Y.ZpreABCD+W"
4666
nix_soversion = meson.project_version().split('+')[0].split('pre')[0]
4767

src/libexpr/primops.cc

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2005,8 +2005,13 @@ static void prim_dirOf(EvalState & state, const PosIdx pos, Value ** args, Value
20052005
NixStringContext context;
20062006
auto path = state.coerceToString(
20072007
pos, *args[0], context, "while evaluating the first argument passed to 'builtins.dirOf'", false, false);
2008-
auto dir = dirOf(*path);
2009-
v.mkString(dir, context);
2008+
auto pos = path->rfind('/');
2009+
if (pos == path->npos)
2010+
v.mkStringMove(".", context);
2011+
else if (pos == 0)
2012+
v.mkStringMove("/", context);
2013+
else
2014+
v.mkString(path->substr(0, pos), context);
20102015
}
20112016
}
20122017

src/libstore/include/nix/store/restricted-store.hh

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,21 @@ struct RestrictionContext
5252
* Add 'path' to the set of paths that may be referenced by the
5353
* outputs, and make it appear in the sandbox.
5454
*/
55-
virtual void addDependency(const StorePath & path) = 0;
55+
void addDependency(const StorePath & path)
56+
{
57+
if (isAllowed(path))
58+
return;
59+
addDependencyImpl(path);
60+
}
61+
62+
protected:
63+
64+
/**
65+
* This is the underlying implementation to be defined. The caller
66+
* will ensure that this is only called on newly added dependencies,
67+
* and that idempotent calls are a no-op.
68+
*/
69+
virtual void addDependencyImpl(const StorePath & path) = 0;
5670
};
5771

5872
/**

src/libstore/unix/build/derivation-builder.cc

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ class DerivationBuilderImpl : public DerivationBuilder, public DerivationBuilder
325325

326326
protected:
327327

328-
void addDependency(const StorePath & path) override;
328+
void addDependencyImpl(const StorePath & path) override;
329329

330330
/**
331331
* Make a file owned by the builder.
@@ -1186,11 +1186,8 @@ void DerivationBuilderImpl::stopDaemon()
11861186
daemonSocket.close();
11871187
}
11881188

1189-
void DerivationBuilderImpl::addDependency(const StorePath & path)
1189+
void DerivationBuilderImpl::addDependencyImpl(const StorePath & path)
11901190
{
1191-
if (isAllowed(path))
1192-
return;
1193-
11941191
addedPaths.insert(path);
11951192
}
11961193

src/libstore/unix/build/linux-derivation-builder.cc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -703,8 +703,11 @@ struct ChrootLinuxDerivationBuilder : ChrootDerivationBuilder, LinuxDerivationBu
703703
DerivationBuilderImpl::killSandbox(getStats);
704704
}
705705

706-
void addDependency(const StorePath & path) override
706+
void addDependencyImpl(const StorePath & path) override
707707
{
708+
if (isAllowed(path))
709+
return;
710+
708711
auto [source, target] = ChrootDerivationBuilder::addDependencyPrep(path);
709712

710713
/* Bind-mount the path into the sandbox. This requires
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{ pathDoesntExistNested1 = /totallydoesntexistreally; pathDoesntExistNested2 = /totallydoesntexistreally/subdir1; pathDoesntExistRoot = /; pathRoot = /; stringEmpty = "."; stringMultipleSeps = "a//"; stringNoSep = "."; stringRoot = "/"; stringRootA = "/"; stringRootSlash = "/"; stringRootSlashSlash = "//"; stringSingleDir = "a"; stringWithDot = "a/b/c/."; stringWithDotAndDotDot = "a/b/c/../."; stringWithDotAndDotDotSep2 = "a/b/c/.././"; stringWithDotDot = "a/b/c/.."; stringWithDotDotSep2 = "a/b/c/../"; stringWithDotSep2 = "a/b/c/./"; }
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
stringEmpty = dirOf "";
3+
stringNoSep = dirOf "filename";
4+
stringSingleDir = dirOf "a/b";
5+
stringMultipleSeps = dirOf "a///b";
6+
stringRoot = dirOf "/";
7+
stringRootSlash = dirOf "//";
8+
stringRootSlashSlash = dirOf "///";
9+
stringRootA = dirOf "/a";
10+
stringWithDot = dirOf "a/b/c/./d";
11+
stringWithDotSep2 = dirOf "a/b/c/.//d";
12+
stringWithDotDot = dirOf "a/b/c/../d";
13+
stringWithDotDotSep2 = dirOf "a/b/c/..//d";
14+
stringWithDotAndDotDot = dirOf "a/b/c/.././d";
15+
stringWithDotAndDotDotSep2 = dirOf "a/b/c/.././/d";
16+
17+
pathRoot = dirOf /.;
18+
pathDoesntExistRoot = dirOf /totallydoesntexistreally;
19+
pathDoesntExistNested1 = dirOf /totallydoesntexistreally/subdir1;
20+
pathDoesntExistNested2 = dirOf /totallydoesntexistreally/subdir1/subdir2;
21+
}

0 commit comments

Comments
 (0)