[LEDE-DEV] [PATCH] base-files: uci-defaults: do config flush in one shot

John Crispin john at phrozen.org
Tue Dec 12 03:41:57 PST 2017



On 12/12/17 12:37, Felix Fietkau wrote:
> On 2017-12-12 11:19, John Crispin wrote:
>>
>> On 02/12/17 00:26, Roman Yeryomin wrote:
>>> Moving a file between tmpfs and other fs is neither
>>> faster nor safer, thus no point in doing it in two steps.
>>>
>>> Signed-off-by: Roman Yeryomin <roman at advem.lv>
>> Hi Roman,
>>
>> The code needs to stay like this. the moment you start the command with
>> redirection, the shell will truncate the target file and wont write it
>> until a flush() or close() is called. this would leave a window where
>> the file is 0 bytes. doing this in 2 steps mitigates that problem.
> I think Roman has a point that even now it's unsafe and leaves a time
> window where the file is incomplete. That said, it's not a good reason
> to make this window even bigger. We could easily fix this entirely by
> storing the intermediate file in /etc instead of /tmp to ensure that
> it's on the same filesystem as the target file.
>
> - Felix

Hi,

or add a -w <file> parameter to json_dump to have it write the file directly

     John

> _______________________________________________
> Lede-dev mailing list
> Lede-dev at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/lede-dev




More information about the Lede-dev mailing list