--- ./rsync.c.orig 2022-12-13 01:17:07 +0000 +++ ./rsync.c 2022-12-13 01:25:26 +0000 @@ -653,7 +653,11 @@ #endif #ifdef HAVE_CHMOD +#ifndef HAVE_AIX_ACLS if (!BITS_EQUAL(sxp->st.st_mode, new_mode, CHMOD_BITS)) { +#endif + /* Because chmod will disable extended permissions on + * AIX, so always use do_chmod update permissions */ int ret = am_root < 0 ? 0 : do_chmod_at(fname, new_mode); if (ret < 0) { rsyserr(FERROR_XFER, errno, @@ -663,8 +667,10 @@ } if (ret == 0) /* ret == 1 if symlink could not be set */ updated |= UPDATED_MODE; +#ifndef HAVE_AIX_ACLS } #endif +#endif if (INFO_GTE(NAME, 2) && flags & ATTRS_REPORT) { if (updated) --- ./syscall.c_orig 2026-05-25 01:46:32.391153390 -0400 +++ ./syscall.c 2026-05-25 01:54:41.447263721 -0400 @@ -22,6 +22,10 @@ #include "rsync.h" +#ifdef HAVE_SYS_ACL_H +#include +#endif + #if !defined MKNOD_CREATES_SOCKETS && defined HAVE_SYS_UN_H #include #endif @@ -791,8 +795,31 @@ # else code = 1; # endif - } else + } else { +#ifdef HAVE_AIX_ACLS + struct stat s; + if (stat(path, &s) == -1) + return -1; +#endif code = chmod(path, mode & CHMOD_BITS); /* DISCOURAGED FUNCTION */ +#ifdef HAVE_AIX_ACLS + /* The extended permissions are disabled when use the + * chmod() on AIX, so we must enable it again */ + struct acl *acl; + + if (s.st_mode & S_IXACL) { + /* BUFSIZ equal MAX_ACL_SIZE */ + if ((acl = (struct acl *)calloc(BUFSIZ, 1)) == NULL) + return -1; + if (statacl((char *)path, 0, acl, BUFSIZ) < 0) + return -1; + acl->acl_mode |= S_IXACL; + if (chacl((char *)path, acl, acl->acl_len) < 0) + return -1; + free(acl); + } +#endif + } break; } if (code != 0 && (preserve_perms || preserve_executability)) --- ./lib/sysacls.c_orig 2026-05-25 01:55:06.174006939 -0400 +++ ./lib/sysacls.c 2026-05-25 02:02:10.829733189 -0400 @@ -1802,6 +1802,7 @@ case SMB_ACL_USER_OBJ: case SMB_ACL_GROUP_OBJ: case SMB_ACL_OTHER: + case SMB_ACL_MASK: *tag_type_p = entry_d->ace_id->id_type; break; @@ -2424,7 +2425,7 @@ file_acl->acl_mode = S_IXACL; for (acl_entry_link=theacl; acl_entry_link != NULL; acl_entry_link = acl_entry_link->nextp) { - acl_entry_link->entryp->ace_access >>= 6; + /* acl_entry_link->entryp->ace_access >>= 6; */ id_type = acl_entry_link->entryp->ace_id->id_type; switch (id_type) {