File U_01-Remove-unused-pmixp_fixrights.patch of Package slurm.32313
From: Tim Wickberg <tim@schedmd.com>
Date: Wed Oct 11 12:45:25 2023 -0600
Subject: [PATCH 1/19]Remove unused pmixp_fixrights().
Patch-mainline: Upstream
Git-repo: https://github.com/SchedMD/slurm
Git-commit: 4da6c6880b9aa4e1a6db96ffd667f07dd42a4941
References: bsc#1216207
Signed-off-by: Egbert Eich <eich@suse.de>
---
src/plugins/mpi/pmix/pmixp_client.c | 6 ----
src/plugins/mpi/pmix/pmixp_utils.c | 65 -------------------------------------
src/plugins/mpi/pmix/pmixp_utils.h | 1 -
3 files changed, 72 deletions(-)
diff --git a/src/plugins/mpi/pmix/pmixp_client.c b/src/plugins/mpi/pmix/pmixp_client.c
index 9976ed01ec..7ec538e40b 100644
--- a/src/plugins/mpi/pmix/pmixp_client.c
+++ b/src/plugins/mpi/pmix/pmixp_client.c
@@ -526,12 +526,6 @@ extern int pmixp_libpmix_init(void)
/* TODO: must be deleted in future once info-key approach harden */
setenv(PMIXP_PMIXLIB_TMPDIR, pmixp_info_tmpdir_lib(), 1);
- /*
- if( pmixp_fixrights(pmixp_info_tmpdir_lib(),
- (uid_t) pmixp_info_jobuid(), rights) ){
- }
- */
-
return 0;
}
diff --git a/src/plugins/mpi/pmix/pmixp_utils.c b/src/plugins/mpi/pmix/pmixp_utils.c
index 3b73f71aa1..ff0147e8b3 100644
--- a/src/plugins/mpi/pmix/pmixp_utils.c
+++ b/src/plugins/mpi/pmix/pmixp_utils.c
@@ -539,71 +539,6 @@ int pmixp_rmdir_recursively(char *path)
return rc;
}
-static inline int _file_fix_rights(char *path, uid_t uid, mode_t mode)
-{
- if (chmod(path, mode) < 0) {
- PMIXP_ERROR("chown(%s): %m", path);
- return errno;
- }
-
- if (chown(path, uid, (gid_t) -1) < 0) {
- PMIXP_ERROR("chown(%s): %m", path);
- return errno;
- }
- return 0;
-}
-
-int pmixp_fixrights(char *path, uid_t uid, mode_t mode)
-{
- char nested_path[PATH_MAX];
- DIR *dp;
- struct dirent *ent;
- int rc = 0;
-
- /*
- * Make sure that "directory" exists and is a directory.
- */
- if (1 != (rc = _is_dir(path))) {
- PMIXP_ERROR("path=\"%s\" is not a directory", path);
- return (rc == 0) ? -1 : rc;
- }
-
- if ((dp = opendir(path)) == NULL) {
- PMIXP_ERROR_STD("cannot open path=\"%s\"", path);
- return -1;
- }
-
- while ((ent = readdir(dp)) != NULL) {
- if (0 == xstrcmp(ent->d_name, ".")
- || 0 == xstrcmp(ent->d_name, "..")) {
- /* skip special dir's */
- continue;
- }
- snprintf(nested_path, sizeof(nested_path), "%s/%s", path,
- ent->d_name);
- if (_is_dir(nested_path)) {
- if ((rc = _file_fix_rights(nested_path, uid, mode))) {
- PMIXP_ERROR_STD("cannot fix permissions for "
- "\"%s\"",
- nested_path);
- goto exit;
- }
- pmixp_rmdir_recursively(nested_path);
- } else {
- if ((rc = _file_fix_rights(nested_path, uid, mode))) {
- PMIXP_ERROR_STD("cannot fix permissions for "
- "\"%s\"",
- nested_path);
- goto exit;
- }
- }
- }
-
-exit:
- closedir(dp);
- return rc;
-}
-
int pmixp_mkdir(char *path, mode_t rights)
{
/* NOTE: we need user who owns the job to access PMIx usock
diff --git a/src/plugins/mpi/pmix/pmixp_utils.h b/src/plugins/mpi/pmix/pmixp_utils.h
index 4e61081ad0..f27ff20128 100644
--- a/src/plugins/mpi/pmix/pmixp_utils.h
+++ b/src/plugins/mpi/pmix/pmixp_utils.h
@@ -63,7 +63,6 @@ int pmixp_p2p_send(const char *nodename, const char *address, const char *data,
uint32_t len, unsigned int start_delay,
unsigned int retry_cnt, int silent);
int pmixp_rmdir_recursively(char *path);
-int pmixp_fixrights(char *path, uid_t uid, mode_t mode);
int pmixp_mkdir(char *path, mode_t rights);
/* lightweight pmix list of pointers */