2020-06-01 19:28:44

by Kenneth Dsouza

[permalink] [raw]
Subject: [PATCH] nfs4_setfacl: Add file name to error output.

Currently when a user tries to set acl's recursively and if
the operation fails the user is not aware on which file the error
occured. This patch adds file name to error output.

Example:
nfs4_setfacl -R -s A:dfg:6:RWX /nfsmount
Failed setxattr operation: /nfsmount/test: Operation not permitted
An error occurred during recursive file tree walk.

Signed-off-by: Kenneth D'souza <[email protected]>
---
libnfs4acl/nfs4_set_acl.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/libnfs4acl/nfs4_set_acl.c b/libnfs4acl/nfs4_set_acl.c
index 8a53f05..45e42fa 100644
--- a/libnfs4acl/nfs4_set_acl.c
+++ b/libnfs4acl/nfs4_set_acl.c
@@ -61,13 +61,13 @@ int nfs4_set_acl(struct nfs4_acl *acl, const char *path)
goto out_free;
} else if (res < 0) {
if (errno == EOPNOTSUPP)
- fprintf(stderr,"Operation to set ACL not supported.\n");
+ fprintf(stderr,"Operation to set ACL not supported: %s\n", path);
else if (errno == ENODATA)
- fprintf(stderr,"ACL Attribute not found on file.\n");
+ fprintf(stderr,"ACL Attribute not found on file: %s\n", path);
else if (errno == EREMOTEIO)
fprintf(stderr,"An NFS server error occurred.\n");
else
- perror("Failed setxattr operation");
+ printf("Failed setxattr operation: %s: %s\n", path, strerror(errno));
}

out_free:
--
2.21.1


2020-06-02 20:11:52

by J. Bruce Fields

[permalink] [raw]
Subject: Re: [PATCH] nfs4_setfacl: Add file name to error output.

Thanks, applied.--b.

On Tue, Jun 02, 2020 at 12:57:54AM +0530, Kenneth D'souza wrote:
> Currently when a user tries to set acl's recursively and if
> the operation fails the user is not aware on which file the error
> occured. This patch adds file name to error output.
>
> Example:
> nfs4_setfacl -R -s A:dfg:6:RWX /nfsmount
> Failed setxattr operation: /nfsmount/test: Operation not permitted
> An error occurred during recursive file tree walk.
>
> Signed-off-by: Kenneth D'souza <[email protected]>
> ---
> libnfs4acl/nfs4_set_acl.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/libnfs4acl/nfs4_set_acl.c b/libnfs4acl/nfs4_set_acl.c
> index 8a53f05..45e42fa 100644
> --- a/libnfs4acl/nfs4_set_acl.c
> +++ b/libnfs4acl/nfs4_set_acl.c
> @@ -61,13 +61,13 @@ int nfs4_set_acl(struct nfs4_acl *acl, const char *path)
> goto out_free;
> } else if (res < 0) {
> if (errno == EOPNOTSUPP)
> - fprintf(stderr,"Operation to set ACL not supported.\n");
> + fprintf(stderr,"Operation to set ACL not supported: %s\n", path);
> else if (errno == ENODATA)
> - fprintf(stderr,"ACL Attribute not found on file.\n");
> + fprintf(stderr,"ACL Attribute not found on file: %s\n", path);
> else if (errno == EREMOTEIO)
> fprintf(stderr,"An NFS server error occurred.\n");
> else
> - perror("Failed setxattr operation");
> + printf("Failed setxattr operation: %s: %s\n", path, strerror(errno));
> }
>
> out_free:
> --
> 2.21.1