[frameworks/kio/Frameworks/6.24] src/widgets: KFilePermissionsPropsPlugin: fix isIrregular calculation when using extended ACLs

Marco Martin <[email protected]>
Newsgroups gmane.comp.kde.cvs
Message-ID <[email protected]>
Git commit 7ef722329eeb144138f059c8c88330868672959e by Marco Martin.
Committed on 27/07/2026 at 09:53.
Pushed by mart into branch 'Frameworks/6.24'.

KFilePermissionsPropsPlugin: fix isIrregular calculation when using extended ACLs

After the "Advanced Permissions" dialog is shown, the isIrregular value is recalculated to update the "Permissions" page. However, when the filesystem suports ACLs this calculation is performed using the wrong (hidden) controls. This happens because the extended ACL widget creates its own controls (checkboxes), while the default controls are no longer used.

As a result, the "isIrregular" value never changes, causing modifications made on the "Advanced Permissions" page not to be saved.

For example, if the file permissions are "rwxr-xr-x", the permisions are considered regular and the "Execute" checkbox is not grayed out. If the user then uses the "Advanced Permissions" page to change the permissions to "rwxr--r--", this becomes an irregular combination. However, it is still evaluated as regular because the calculation uses the hidden checkboxes. Since "Execute" remains enabled, saving the changes results in "rwxr-xr-x" instead of the intended "rwxr--r--".

This patch attempts to fix this issue by recalculating "isIrregular" using the actual values from the ACL controls, so that the "Permissions" page is reloaded correctly.


(cherry picked from commit 3ac55ad6fdd043323d5d0a2a7a4fd236cf146431)

77a84f63 KFilePermissionsPropsPlugin: fix isIrregular calculation when using extended ACLs
16c8ffb4 Rearrange code
9e306c7d Skips processing hidden checkboxes
9fb3cd92 Apply 1 suggestion(s) to 1 file(s)

Co-authored-by: David Wild <[email protected]>

M  +22   -9    src/widgets/kpropertiesdialogbuiltin_p.cpp

https://invent.kde.org/frameworks/kio/-/commit/7ef722329eeb144138f059c8c88330868672959e

diff --git a/src/widgets/kpropertiesdialogbuiltin_p.cpp b/src/widgets/kpropertiesdialogbuiltin_p.cpp
index 1b4df6f608..942cf77ffa 100644
--- a/src/widgets/kpropertiesdialogbuiltin_p.cpp
+++ b/src/widgets/kpropertiesdialogbuiltin_p.cpp
@@ -1607,6 +1607,12 @@ void KFilePermissionsPropsPlugin::slotShowAdvancedPermissions()
     mode_t orPermissions = 0;
     for (int row = 0; row < 3; ++row) {
         for (int col = 0; col < 4; ++col) {
+#if HAVE_POSIX_ACL
+            //Skips hidden controls
+            if (extendedACLs && theNotSpecials.contains(cba[row][col])) {
+                continue;
+            }
+#endif            
             switch (cba[row][col]->checkState()) {
             case Qt::Checked:
                 orPermissions |= fperm[row][col];
@@ -1620,14 +1626,6 @@ void KFilePermissionsPropsPlugin::slotShowAdvancedPermissions()
         }
     }
 
-    const KFileItemList items = properties->items();
-    d->isIrregular = std::any_of(items.cbegin(), items.cend(), [this, andPermissions, orPermissions](const KFileItem &item) {
-        return isIrregular((item.permissions() & andPermissions) | orPermissions, item.isDir(), item.isLink());
-    });
-
-    d->permissions = orPermissions;
-    d->partialPermissions = andPermissions;
-
 #if HAVE_POSIX_ACL
     // override with the acls, if present
     if (extendedACLs) {
@@ -1636,8 +1634,23 @@ void KFilePermissionsPropsPlugin::slotShowAdvancedPermissions()
         d->hasExtendedACL = d->extendedACL.isExtended() || d->defaultACL.isValid();
         d->permissions = d->extendedACL.basePermissions();
         d->permissions |= (andPermissions | orPermissions) & (S_ISUID | S_ISGID | S_ISVTX);
-    }
+        d->partialPermissions = 0; //there is no partial state
+
+        const KFileItemList items = properties->items();
+        d->isIrregular = std::any_of(items.cbegin(), items.cend(), [this](const KFileItem &item) {
+            return isIrregular(d->permissions, item.isDir(), item.isLink());
+        });
+    } else
 #endif
+    {        
+        d->permissions = orPermissions;
+        d->partialPermissions = andPermissions;
+
+        const KFileItemList items = properties->items();
+        d->isIrregular = std::any_of(items.cbegin(), items.cend(), [this, andPermissions, orPermissions](const KFileItem &item) {
+            return isIrregular((item.permissions() & andPermissions) | orPermissions, item.isDir(), item.isLink());
+        });
+    }
 
     dlg.setMinimumSize(dlg.sizeHint());
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.