coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: chmod --cheap option


From: Pádraig Brady
Subject: Re: chmod --cheap option
Date: Wed, 25 May 2016 09:41:25 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0

On 25/05/16 07:31, Hrubák, András wrote:
Hi Eric and Coreutils Members,

I know about the risk of race condition. It would be just an option.
If you tell about
it in usage help, users will be notified about the risks and decide
according to it.
There are several usecases when this race condition is acceptable.
Without this internal logic in chmod, scripters must write their own
logic in upper level (eg. shell script: compute numeric mode from
symbolic mode notation -> stat the file -> test the current mode
against the old one -> call chmod conditionally, etc.), which means
bigger probability of race condition.
So I would state the risks of this option in help text, explaining the
meaning of '--cheap', and of course make it NOT default.
You can find the patch in attachment.

I think your use case here is to call fchmod()
but only update the ctime if needed?
That really can only be done without races within the kernel.
It would be dangerous to provide racy functionality otherwise,
as you could never implement anything robust with it,
or worse some might expect their implementation to be robust,
and encounter tricky race conditions later.

thanks,
Pádraig



reply via email to

[Prev in Thread] Current Thread [Next in Thread]