[PATCH] : KIO::chmod that uses KURL::List

David Faure dfaure at klaralvdalens-datakonsult.se
Fri Jul 18 10:07:54 BST 2003

On Friday 18 July 2003 19:17, kzk wrote:
> On Thursday 17 July 2003 21:49, David Faure wrote:
> > Your idea sounds good, but I'm afraid the "mask" should be removed, since
> > there's no way to know the current permissions of the urls - so you can
> > only use chmod(list of urls) to apply a complete set of permissions to all
> > files, you can't selectively change only one bit on them (like one can do
> > with the mask).
> >
> > To be more precise, the current line 79, which uses item->permissions(),
> > will always get -1 in your case, which will result in wrong stuff being
> > done, unless m_mask is 0777 (or so).
> Thank you for your suggestion.
> On my test use, item->permissions() returns currened permission, didn't return 
> -1.
> But I finally found that this code works properly only LOCAL file.
> If local file, current permission is reset even if permission == 
> KFileItem::Unknown.

Right, it will only break for remote items, but that's not good either :)

> So, I think  improving KFileItem::init may solve this problem.

No (synchronously checking for permissions without blocking the
whole GUI for an undetermined amount of time) - and if an app wanted to do 
that, it could use NetAccess::stat anyway. This is NOT the job of KFileItem.

Therefore I'm not too keen on this going in - it's an open door to a rather
difficult-to-find bug: it will work with a full mask, it will work with a partial mask
and local files, but it can't work with a partial mask and remote files...

The only safe way would be to remove the mask feature from this KURL::List call,
which makes sense when the app knows which permissions it wants to give to
a given url (or many). Adding/removing permissions is mostly done by the
properties dialog anyway, isn't it?

David Faure -- faure at kde.org, dfaure at klaralvdalens-datakonsult.se
Qt/KDE/KOffice developer
Klarälvdalens Datakonsult AB, Platform-independent software solutions

More information about the kde-core-devel mailing list