diff options
author | edef <edef@edef.eu> | 2020-08-05T01·48+0000 |
---|---|---|
committer | edef <edef@edef.eu> | 2020-08-05T02·05+0000 |
commit | fcffacf8c9246c7b83d90164bedb50f488ca5baa (patch) | |
tree | 6b194ea986b5162365ad53f00a927dbc92a1cf36 /users/edef/depot-scan-wrap.nix | |
parent | 88a6bea6e802ce0d8190418b7b076ee12fdf1f47 (diff) |
fix(users/edef/depot-scan): properly trace readFile/readDir r/1590
Change-Id: I493e7d20504d34f83a53db50b69e86668874756e Reviewed-on: https://cl.tvl.fyi/c/depot/+/1651 Reviewed-by: edef <edef@edef.eu> Tested-by: BuildkiteCI
Diffstat (limited to 'users/edef/depot-scan-wrap.nix')
-rw-r--r-- | users/edef/depot-scan-wrap.nix | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/users/edef/depot-scan-wrap.nix b/users/edef/depot-scan-wrap.nix new file mode 100644 index 000000000000..52ea5cc8527b --- /dev/null +++ b/users/edef/depot-scan-wrap.nix @@ -0,0 +1,17 @@ +# this wraps import to override readFile and readDir to trace the files it touches +# technique inspired by lorri +{ ... }: + +let + + global = { + import = global.scopedImport {}; + scopedImport = x: builtins.scopedImport (global // x); + builtins = builtins // { + inherit (global) import scopedImport; + readFile = path: builtins.trace "depot-scan '${toString path}'" (builtins.readFile path); + readDir = path: builtins.trace "depot-scan '${toString path}'" (builtins.readDir path); + }; + }; + +in global.import |