Bug 327254 - ACL default mask is ignored or mask is changed for image editor and batch queue manager
Summary: ACL default mask is ignored or mask is changed for image editor and batch que...
Status: RESOLVED FIXED
Alias: None
Product: digikam
Classification: Applications
Component: DImg-FileIO (show other bugs)
Version: 4.2.0
Platform: Gentoo Packages Linux
: NOR normal
Target Milestone: ---
Assignee: Digikam Developers
URL: https://bugs.kde.org/show_bug.cgi?id=...
Keywords:
Depends on:
Blocks:
 
Reported: 2013-11-07 02:37 UTC by Thomas Bettler
Modified: 2022-02-04 06:20 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In: 7.5.0


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Bettler 2013-11-07 02:37:04 UTC
While [batch] editing images, the new saved images get their permissions changed in a undesired way... 
The destination folder has the following ACL settings: 
bash$ getfacl . 
# file: . 
# owner: t 
# group: users 
user::rwx 
user:r:rwx 
user:t:rwx 
group::--- 
mask::rwx 
other::--- 
default:user::rwx 
default:user:r:rwx 
default:user:t:rwx 
default:group::--- 
default:mask::rwx 
default:other::---

Reproducible: Always

Steps to Reproduce:
1. edit or batch edit images with digikam
Actual Results:  
Unexpectingly and unfortunately the edited image has mask:: changed to ---

Expected Results:  
Expected behaviour: It should be mask::rw- instead.

Found to happen in:
./utilities/imageeditor/editor/editorwindow.cpp:    EditorWindow::setupTempSaveFile(const KUrl& url)
./utilities/queuemanager/manager/batchtool.cpp:    BatchTool::setOutputUrlFromInputUrl()


Please double check if there are more cases where tempfiles are created and wrong permissions applied. Eventually there should be considered a global solution for this situation.
Comment 1 caulier.gilles 2014-08-29 15:26:15 UTC
Thomas,

Problem still valid using last digiKam 4.2.0 ?

Gilles Caulier
Comment 2 Thomas Bettler 2014-09-04 00:15:35 UTC
Gilles,

1) For batch editing behaviour is still unexpected as described in bug report above.

2) For versioned image editing behaviour has changed and leads to other unexpected results, thus still needs to be fixed:

Directory defaults as mentioned above in bug report above.

File orig has rwx for several users, while group:--- / others:--- / mask:rw-
# file: orig.jpg
# owner:t
#group:users
user::rw-
user:r:rwx          #effective:rw-
user:t:rwx          #effective:rw-
group::---          
mask::rw-
other::---

Image editing leads to unexpected results for others:r-- / mask:r--
# file: edited.jpg
# owner: t
# group: users
user::rw-
user:r:rwx           #effective:r--
user:t:rwx           #effective:r--
group::---
mask::r--
other::r--

Expected results would be: New versioned file gets the same ACL as origin file
Comment 3 caulier.gilles 2014-09-04 09:15:41 UTC
Thomas,

For Image editor, ACL are managed through std::umask() in this method :

https://projects.kde.org/projects/extragear/graphics/digikam/repository/revisions/master/entry/utilities/imageeditor/editor/editorwindow.cpp#L2552

What's missing here ? Documentation about umask() function can be found here :

http://man7.org/linux/man-pages/man2/umask.2.html

In BQM, there is no similar code. So, right this is missing.

It miss also code certainly in ImportUI, when files are copy from camera to computer, but i'm not sure.

Gilles Caulier
Comment 4 caulier.gilles 2014-09-04 09:20:44 UTC
For BQM, relevant code written in ImageEditor must be called somewhere here :

https://projects.kde.org/projects/extragear/graphics/digikam/repository/revisions/master/entry/utilities/queuemanager/manager/task.cpp#L233

... to restore file attribute from original to target file.

Gilles Caulier
Comment 5 caulier.gilles 2014-09-04 12:04:32 UTC
Thomas,

I tested Image Editor ACL management on my computer where i use ext4. I open a JPEG file and just perform File Save As :

[gilles@localhost TESTS]$ ls -al *.jpg
-rw-rw-r-- 1 gilles gilles 24141637 sept.  4 13:59 2.jpg
-rw-rw-r-- 1 gilles gilles 16004774 sept.  3 17:30 1.jpg
[gilles@localhost TESTS]$ getfacl -e 1.jpg
# file: 1.jpg
# owner: gilles
# group: gilles
user::rw-
group::rw-
other::r--

[gilles@localhost TESTS]$ getfacl -e 2.jpg
# file: 2.jpg
# owner: gilles
# group: gilles
user::rw-
group::rw-
other::r--

1.jpg is original, and 2.jpg the new file created. There is no difference.

I miss something ?
Comment 6 caulier.gilles 2014-09-04 13:01:29 UTC
Git commit 1d29b8828ffde096d7d288dd76714c2f8edf56b1 by Gilles Caulier.
Committed on 04/09/2014 at 12:59.
Pushed by cgilles into branch 'master'.

Factorize ACL method preservation from ImageEditor as a static and public method
Use this method in BQM core when file are renamed.
Add documantation API

M  +10   -9    utilities/imageeditor/editor/editorwindow.cpp
M  +6    -1    utilities/imageeditor/editor/editorwindow.h
M  +7    -3    utilities/queuemanager/manager/task.cpp

http://commits.kde.org/digikam/1d29b8828ffde096d7d288dd76714c2f8edf56b1
Comment 7 caulier.gilles 2014-09-04 13:03:41 UTC
Thomas,

With my last commit, BQM must have the same behavior than Image Editor now.

It still a problem with a restoration of all ACL properties. Right ?

Gilles Caulier
Comment 8 caulier.gilles 2014-09-06 16:08:56 UTC
Marcel,

Do you know what's missing to support fully ACL with code implemented now in filemanagement.cpp, to be common between IE et BQM : 

https://projects.kde.org/projects/extragear/graphics/digikam/repository/revisions/master/entry/utilities/imageeditor/core/filemanagement.cpp#L50

Gilles
Comment 9 Marcel Wiesweg 2014-09-14 16:04:41 UTC
Sorry, I do not have ACLs in use. I would hope the original poster of this bug was available to carry out tests.
Comment 10 caulier.gilles 2016-07-25 09:05:50 UTC
Maik, 

Can you check if this file still valid with my last commit to factorize ACL management code with Editor and BQM ?

Thanks in advance

Gilles
Comment 11 caulier.gilles 2016-11-29 11:27:30 UTC
Can you reproduce the problem using digiKam Linux AppImage bundle ? The last
bundle is available at this url:

https://drive.google.com/drive/folders/0BzeiVr-byqt5Y0tIRWVWelRJenM

Gilles Caulier
Comment 12 caulier.gilles 2020-08-03 04:52:22 UTC
digiKam 7.0.0 stable release is now published:

https://www.digikam.org/news/2020-07-19-7.0.0_release_announcement/

We need a fresh feedback on this file using this version.

Best Regards

Gilles Caulier
Comment 13 caulier.gilles 2022-01-09 04:35:19 UTC
No feedback, closed