All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg Kurz <groug@kaod.org>
To: Christian Schoenebeck <qemu_oss@crudebyte.com>
Cc: qemu-devel@nongnu.org, qemu-stable@nongnu.org,
	Keno Fischer <keno@juliacomputing.com>,
	Michael Roitzsch <reactorcontrol@icloud.com>,
	Will Cohen <wwcohen@gmail.com>,
	Akihiko Odaki <akihiko.odaki@gmail.com>
Subject: Re: [PATCH v2 5/5] 9pfs: fix removing non-existent POSIX ACL xattr on macOS host
Date: Thu, 21 Apr 2022 18:40:46 +0200	[thread overview]
Message-ID: <20220421184046.52893981@bahia> (raw)
In-Reply-To: <b0b893bac2c584f1c92b2e6aa86d1308c87d5dbe.1650553693.git.qemu_oss@crudebyte.com>

On Thu, 21 Apr 2022 17:07:55 +0200
Christian Schoenebeck <qemu_oss@crudebyte.com> wrote:

> When mapped POSIX ACL is used, we are ignoring errors when trying
> to remove a POSIX ACL xattr that does not exist. On Linux hosts we
> would get ENODATA in such cases, on macOS hosts however we get
> ENOATTR instead.
> 
> As we can be sure that ENOATTR is defined as being identical on Linux
> hosts (at least by qemu/xattr.h), it is safe to fix this issue by
> simply comparing against ENOATTR instead of ENODATA.
> 
> This patch fixes e.g. a command on Linux guest like:
> 
>   cp --preserve=mode old new
> 
> Signed-off-by: Christian Schoenebeck <qemu_oss@crudebyte.com>
> Link: https://lore.kernel.org/qemu-devel/2866993.yOYK24bMf6@silver/
> ---

Reviewed-by: Greg Kurz <groug@kaod.org>

>  hw/9pfs/9p-posix-acl.c | 12 ++++++++++--
>  1 file changed, 10 insertions(+), 2 deletions(-)
> 
> diff --git a/hw/9pfs/9p-posix-acl.c b/hw/9pfs/9p-posix-acl.c
> index eadae270dd..4b2cb3c66c 100644
> --- a/hw/9pfs/9p-posix-acl.c
> +++ b/hw/9pfs/9p-posix-acl.c
> @@ -65,7 +65,11 @@ static int mp_pacl_removexattr(FsContext *ctx,
>      int ret;
>  
>      ret = local_removexattr_nofollow(ctx, path, MAP_ACL_ACCESS);
> -    if (ret == -1 && errno == ENODATA) {
> +    /*
> +     * macOS returns ENOATTR (!=ENODATA on macOS), whereas Linux returns
> +     * ENODATA (==ENOATTR on Linux), so checking for ENOATTR is fine
> +     */
> +    if (ret == -1 && errno == ENOATTR) {
>          /*
>           * We don't get ENODATA error when trying to remove a
>           * posix acl that is not present. So don't throw the error
> @@ -115,7 +119,11 @@ static int mp_dacl_removexattr(FsContext *ctx,
>      int ret;
>  
>      ret = local_removexattr_nofollow(ctx, path, MAP_ACL_DEFAULT);
> -    if (ret == -1 && errno == ENODATA) {
> +    /*
> +     * macOS returns ENOATTR (!=ENODATA on macOS), whereas Linux returns
> +     * ENODATA (==ENOATTR on Linux), so checking for ENOATTR is fine
> +     */
> +    if (ret == -1 && errno == ENOATTR) {
>          /*
>           * We don't get ENODATA error when trying to remove a
>           * posix acl that is not present. So don't throw the error



      reply	other threads:[~2022-04-21 17:26 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-21 15:08 [PATCH v2 0/5] 9pfs: macOS host fixes Christian Schoenebeck
2022-04-21 15:07 ` [PATCH v2 1/5] 9pfs: fix qemu_mknodat(S_IFREG) on macOS Christian Schoenebeck
2022-04-21 16:32   ` Greg Kurz
2022-04-21 15:07 ` [PATCH v2 2/5] 9pfs: fix qemu_mknodat(S_IFSOCK) " Christian Schoenebeck
2022-04-21 16:36   ` Greg Kurz
2022-04-21 17:29     ` Christian Schoenebeck
2022-04-22  2:43   ` Akihiko Odaki
2022-04-22 14:06     ` Christian Schoenebeck
2022-04-23  4:33       ` Akihiko Odaki
2022-04-24 18:45         ` Christian Schoenebeck
2022-04-26  3:57           ` Akihiko Odaki
2022-04-26 12:38             ` Greg Kurz
2022-04-27  2:27               ` Akihiko Odaki
2022-04-27 10:18                 ` Greg Kurz
2022-04-27 12:32                   ` Christian Schoenebeck
2022-04-27 13:31                     ` Greg Kurz
2022-04-27 16:18                       ` Christian Schoenebeck
2022-04-27 17:12                         ` Will Cohen
2022-04-27 18:16                           ` Christian Schoenebeck
2022-04-27 17:37                         ` Greg Kurz
2022-04-27 18:36                           ` Christian Schoenebeck
2022-04-21 15:07 ` [PATCH v2 3/5] 9pfs: fix wrong encoding of rdev field in Rgetattr " Christian Schoenebeck
2022-04-21 16:39   ` Greg Kurz
2022-04-21 15:07 ` [PATCH v2 4/5] 9pfs: fix wrong errno being sent to Linux client on macOS host Christian Schoenebeck
2022-04-21 16:39   ` Greg Kurz
2022-04-21 15:07 ` [PATCH v2 5/5] 9pfs: fix removing non-existent POSIX ACL xattr " Christian Schoenebeck
2022-04-21 16:40   ` Greg Kurz [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220421184046.52893981@bahia \
    --to=groug@kaod.org \
    --cc=akihiko.odaki@gmail.com \
    --cc=keno@juliacomputing.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-stable@nongnu.org \
    --cc=qemu_oss@crudebyte.com \
    --cc=reactorcontrol@icloud.com \
    --cc=wwcohen@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.