[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Nix-dev] [PATCH] Allow roots to refer to arbitrary files in the sto
From: |
Ludovic Courtès |
Subject: |
Re: [Nix-dev] [PATCH] Allow roots to refer to arbitrary files in the store |
Date: |
Mon, 14 Apr 2014 16:45:25 +0200 |
User-agent: |
Gnus/5.130007 (Ma Gnus v0.7) Emacs/24.3 (gnu/linux) |
(Oops, forgot the Subject line; sorry!)
Shea Levy <address@hidden> skribis:
> On Mon, Apr 14, 2014 at 03:38:01PM +0200, Ludovic Courtès wrote:
>> The patch below allows files such as /nix/store/foo to be protected from
>> GC if a root refers to them. This makes it easy for a build hook to use
>> such files for its temporary working files.
>>
>> WDYT?
>>
>
> It seems a bit odd to me to be using the store as a temporary file
> location. What's wrong with $TMPDIR?
Well, this is useful for build hooks, because it guarantees that any
garbage they leave there will eventually be reclaimed.
>> diff --git a/src/libstore/gc.cc b/src/libstore/gc.cc
>> index 96e891f..299bf5f 100644
>> --- a/src/libstore/gc.cc
>> +++ b/src/libstore/gc.cc
>> @@ -287,10 +287,7 @@ static void foundRoot(StoreAPI & store,
>> const Path & path, const Path & target, Roots & roots)
>> {
>> Path storePath = toStorePath(target);
>> - if (store.isValidPath(storePath))
>
> Hm, don't we at least want to check that it's in the store at all?
‘toStorePath’ does that:
if (!isInStore(path))
throw Error(format("path `%1%' is not in the Nix store") % path);
Thanks,
Ludo’.
- [PATCH], Ludovic Courtès, 2014/04/14