All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] tests/functional/qemu_test/asset.py: Don't use setxattr when it doesn't exist
@ 2026-05-01 11:55 Peter Maydell
  2026-05-01 12:07 ` Daniel P. Berrangé
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Peter Maydell @ 2026-05-01 11:55 UTC (permalink / raw)
  To: qemu-devel
  Cc: Thomas Huth, Daniel P. Berrangé, Philippe Mathieu-Daudé

The Python os.setxattr() API is Linux-specific, so trying to use
it on other OSes triggers a failure:

  File "/Users/pm215/src/qemu/tests/functional/qemu_test/asset.py",
line 227, in fetch
    os.setxattr(str(tmp_cache_file), "user.qemu-asset-url",
    ^^^^^^^^^^^
AttributeError: module 'os' has no attribute 'setxattr'

Since we only set the attributes here for informational
purposes, skip them when os.setxattr() isn't available.

Cc: qemu-stable@nongnu.org
Fixes: 9903217a4ed013 ("tests/functional: add a module for handling asset download & caching")
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 tests/functional/qemu_test/asset.py | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/tests/functional/qemu_test/asset.py b/tests/functional/qemu_test/asset.py
index 51a434b2b7..0abd89e0a3 100644
--- a/tests/functional/qemu_test/asset.py
+++ b/tests/functional/qemu_test/asset.py
@@ -223,11 +223,14 @@ def fetch(self):
             raise AssetError(self, "Download retries exceeded", transient=True)
 
         try:
-            # Set these just for informational purposes
-            os.setxattr(str(tmp_cache_file), "user.qemu-asset-url",
-                        self.url.encode('utf8'))
-            os.setxattr(str(tmp_cache_file), "user.qemu-asset-hash",
-                        self.hash.encode('utf8'))
+            # Set these just for informational purposes. Note that
+            # setxattr is Linux-only; as this is only informational
+            # we can simply skip it on other platforms.
+            if hasattr(os, "setxattr"):
+                os.setxattr(str(tmp_cache_file), "user.qemu-asset-url",
+                            self.url.encode('utf8'))
+                os.setxattr(str(tmp_cache_file), "user.qemu-asset-hash",
+                            self.hash.encode('utf8'))
         except OSError as e:
             self.log.debug("Unable to set xattr on %s: %s", tmp_cache_file, e)
 
-- 
2.43.0



^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH] tests/functional/qemu_test/asset.py: Don't use setxattr when it doesn't exist
  2026-05-01 11:55 [PATCH] tests/functional/qemu_test/asset.py: Don't use setxattr when it doesn't exist Peter Maydell
@ 2026-05-01 12:07 ` Daniel P. Berrangé
  2026-05-01 12:38 ` Alex Bennée
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 8+ messages in thread
From: Daniel P. Berrangé @ 2026-05-01 12:07 UTC (permalink / raw)
  To: Peter Maydell; +Cc: qemu-devel, Thomas Huth, Philippe Mathieu-Daudé

On Fri, May 01, 2026 at 12:55:06PM +0100, Peter Maydell wrote:
> The Python os.setxattr() API is Linux-specific, so trying to use
> it on other OSes triggers a failure:
> 
>   File "/Users/pm215/src/qemu/tests/functional/qemu_test/asset.py",
> line 227, in fetch
>     os.setxattr(str(tmp_cache_file), "user.qemu-asset-url",
>     ^^^^^^^^^^^
> AttributeError: module 'os' has no attribute 'setxattr'
> 
> Since we only set the attributes here for informational
> purposes, skip them when os.setxattr() isn't available.
> 
> Cc: qemu-stable@nongnu.org
> Fixes: 9903217a4ed013 ("tests/functional: add a module for handling asset download & caching")
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
>  tests/functional/qemu_test/asset.py | 13 ++++++++-----
>  1 file changed, 8 insertions(+), 5 deletions(-)

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>


Daniel



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] tests/functional/qemu_test/asset.py: Don't use setxattr when it doesn't exist
  2026-05-01 11:55 [PATCH] tests/functional/qemu_test/asset.py: Don't use setxattr when it doesn't exist Peter Maydell
  2026-05-01 12:07 ` Daniel P. Berrangé
@ 2026-05-01 12:38 ` Alex Bennée
  2026-05-01 21:01 ` Thomas Huth
  2026-05-11 14:47 ` Peter Maydell
  3 siblings, 0 replies; 8+ messages in thread
From: Alex Bennée @ 2026-05-01 12:38 UTC (permalink / raw)
  To: Peter Maydell
  Cc: qemu-devel, Thomas Huth, Daniel P. Berrangé,
	Philippe Mathieu-Daudé

Peter Maydell <peter.maydell@linaro.org> writes:

> The Python os.setxattr() API is Linux-specific, so trying to use
> it on other OSes triggers a failure:
>
>   File "/Users/pm215/src/qemu/tests/functional/qemu_test/asset.py",
> line 227, in fetch
>     os.setxattr(str(tmp_cache_file), "user.qemu-asset-url",
>     ^^^^^^^^^^^
> AttributeError: module 'os' has no attribute 'setxattr'
>
> Since we only set the attributes here for informational
> purposes, skip them when os.setxattr() isn't available.
>
> Cc: qemu-stable@nongnu.org
> Fixes: 9903217a4ed013 ("tests/functional: add a module for handling asset download & caching")
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
>  tests/functional/qemu_test/asset.py | 13 ++++++++-----
>  1 file changed, 8 insertions(+), 5 deletions(-)
>
> diff --git a/tests/functional/qemu_test/asset.py b/tests/functional/qemu_test/asset.py
> index 51a434b2b7..0abd89e0a3 100644
> --- a/tests/functional/qemu_test/asset.py
> +++ b/tests/functional/qemu_test/asset.py
> @@ -223,11 +223,14 @@ def fetch(self):
>              raise AssetError(self, "Download retries exceeded", transient=True)
>  
>          try:
> -            # Set these just for informational purposes
> -            os.setxattr(str(tmp_cache_file), "user.qemu-asset-url",
> -                        self.url.encode('utf8'))
> -            os.setxattr(str(tmp_cache_file), "user.qemu-asset-hash",
> -                        self.hash.encode('utf8'))
> +            # Set these just for informational purposes. Note that
> +            # setxattr is Linux-only; as this is only informational
> +            # we can simply skip it on other platforms.
> +            if hasattr(os, "setxattr"):
> +                os.setxattr(str(tmp_cache_file), "user.qemu-asset-url",
> +                            self.url.encode('utf8'))
> +                os.setxattr(str(tmp_cache_file), "user.qemu-asset-hash",
> +                            self.hash.encode('utf8'))

Well TIL:

  attr -g qemu-asset-url /home/alex/.cache/qemu/download/ff9d7dd7c6bdba325bd85ee85c02db61ff653e129558aeffe6aff55bffb6763a
  Attribute "qemu-asset-url" had a 73 byte value for /home/alex/.cache/qemu/download/ff9d7dd7c6bdba325bd85ee85c02db61ff653e129558aeffe6aff55bffb6763a:
  https://qemu-advcal.gitlab.io/qac-best-of-multiarch/download/day20.tar.xz

Reviewed-by: Alex Bennée <alex.bennee@linaro.org>

>          except OSError as e:
>              self.log.debug("Unable to set xattr on %s: %s", tmp_cache_file, e)

-- 
Alex Bennée
Virtualisation Tech Lead @ Linaro


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] tests/functional/qemu_test/asset.py: Don't use setxattr when it doesn't exist
  2026-05-01 11:55 [PATCH] tests/functional/qemu_test/asset.py: Don't use setxattr when it doesn't exist Peter Maydell
  2026-05-01 12:07 ` Daniel P. Berrangé
  2026-05-01 12:38 ` Alex Bennée
@ 2026-05-01 21:01 ` Thomas Huth
  2026-05-11 14:47 ` Peter Maydell
  3 siblings, 0 replies; 8+ messages in thread
From: Thomas Huth @ 2026-05-01 21:01 UTC (permalink / raw)
  To: Peter Maydell
  Cc: qemu-devel, Daniel P. Berrangé, Philippe Mathieu-Daudé

Am Fri,  1 May 2026 12:55:06 +0100
schrieb Peter Maydell <peter.maydell@linaro.org>:

> The Python os.setxattr() API is Linux-specific, so trying to use
> it on other OSes triggers a failure:
> 
>   File "/Users/pm215/src/qemu/tests/functional/qemu_test/asset.py",
> line 227, in fetch
>     os.setxattr(str(tmp_cache_file), "user.qemu-asset-url",
>     ^^^^^^^^^^^
> AttributeError: module 'os' has no attribute 'setxattr'
> 
> Since we only set the attributes here for informational
> purposes, skip them when os.setxattr() isn't available.
> 
> Cc: qemu-stable@nongnu.org
> Fixes: 9903217a4ed013 ("tests/functional: add a module for handling asset download & caching")
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
>  tests/functional/qemu_test/asset.py | 13 ++++++++-----
>  1 file changed, 8 insertions(+), 5 deletions(-)
> 
> diff --git a/tests/functional/qemu_test/asset.py b/tests/functional/qemu_test/asset.py
> index 51a434b2b7..0abd89e0a3 100644
> --- a/tests/functional/qemu_test/asset.py
> +++ b/tests/functional/qemu_test/asset.py
> @@ -223,11 +223,14 @@ def fetch(self):
>              raise AssetError(self, "Download retries exceeded", transient=True)
>  
>          try:
> -            # Set these just for informational purposes
> -            os.setxattr(str(tmp_cache_file), "user.qemu-asset-url",
> -                        self.url.encode('utf8'))
> -            os.setxattr(str(tmp_cache_file), "user.qemu-asset-hash",
> -                        self.hash.encode('utf8'))
> +            # Set these just for informational purposes. Note that
> +            # setxattr is Linux-only; as this is only informational
> +            # we can simply skip it on other platforms.
> +            if hasattr(os, "setxattr"):
> +                os.setxattr(str(tmp_cache_file), "user.qemu-asset-url",
> +                            self.url.encode('utf8'))
> +                os.setxattr(str(tmp_cache_file), "user.qemu-asset-hash",
> +                            self.hash.encode('utf8'))
>          except OSError as e:
>              self.log.debug("Unable to set xattr on %s: %s", tmp_cache_file, e)
>  

Reviewed-by: Thomas Huth <th.huth+qemu@posteo.eu>


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] tests/functional/qemu_test/asset.py: Don't use setxattr when it doesn't exist
  2026-05-01 11:55 [PATCH] tests/functional/qemu_test/asset.py: Don't use setxattr when it doesn't exist Peter Maydell
                   ` (2 preceding siblings ...)
  2026-05-01 21:01 ` Thomas Huth
@ 2026-05-11 14:47 ` Peter Maydell
  2026-05-11 15:15   ` Daniel P. Berrangé
  2026-05-12  4:49   ` Thomas Huth
  3 siblings, 2 replies; 8+ messages in thread
From: Peter Maydell @ 2026-05-11 14:47 UTC (permalink / raw)
  To: qemu-devel
  Cc: Thomas Huth, Daniel P. Berrangé, Philippe Mathieu-Daudé

On Fri, 1 May 2026 at 12:55, Peter Maydell <peter.maydell@linaro.org> wrote:
>
> The Python os.setxattr() API is Linux-specific, so trying to use
> it on other OSes triggers a failure:
>
>   File "/Users/pm215/src/qemu/tests/functional/qemu_test/asset.py",
> line 227, in fetch
>     os.setxattr(str(tmp_cache_file), "user.qemu-asset-url",
>     ^^^^^^^^^^^
> AttributeError: module 'os' has no attribute 'setxattr'
>
> Since we only set the attributes here for informational
> purposes, skip them when os.setxattr() isn't available.
>
> Cc: qemu-stable@nongnu.org
> Fixes: 9903217a4ed013 ("tests/functional: add a module for handling asset download & caching")
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>

Is anybody going to pick this up via their tree, or should
I just put it into target-arm.next ?

thanks
-- PMM


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] tests/functional/qemu_test/asset.py: Don't use setxattr when it doesn't exist
  2026-05-11 14:47 ` Peter Maydell
@ 2026-05-11 15:15   ` Daniel P. Berrangé
  2026-05-11 15:23     ` Peter Maydell
  2026-05-12  4:49   ` Thomas Huth
  1 sibling, 1 reply; 8+ messages in thread
From: Daniel P. Berrangé @ 2026-05-11 15:15 UTC (permalink / raw)
  To: Peter Maydell; +Cc: qemu-devel, Thomas Huth, Philippe Mathieu-Daudé

On Mon, May 11, 2026 at 03:47:33PM +0100, Peter Maydell wrote:
> On Fri, 1 May 2026 at 12:55, Peter Maydell <peter.maydell@linaro.org> wrote:
> >
> > The Python os.setxattr() API is Linux-specific, so trying to use
> > it on other OSes triggers a failure:
> >
> >   File "/Users/pm215/src/qemu/tests/functional/qemu_test/asset.py",
> > line 227, in fetch
> >     os.setxattr(str(tmp_cache_file), "user.qemu-asset-url",
> >     ^^^^^^^^^^^
> > AttributeError: module 'os' has no attribute 'setxattr'
> >
> > Since we only set the attributes here for informational
> > purposes, skip them when os.setxattr() isn't available.
> >
> > Cc: qemu-stable@nongnu.org
> > Fixes: 9903217a4ed013 ("tests/functional: add a module for handling asset download & caching")
> > Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> 
> Is anybody going to pick this up via their tree, or should
> I just put it into target-arm.next ?

I have it for my misc queue, but if you want to send a PR now then
consider it to havve

  Acked-by: Daniel P. Berrangé <berrange@redhat.com>

With regards,
Daniel
-- 
|: https://berrange.com       ~~        https://hachyderm.io/@berrange :|
|: https://libvirt.org          ~~          https://entangle-photo.org :|
|: https://pixelfed.art/berrange   ~~    https://fstop138.berrange.com :|



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] tests/functional/qemu_test/asset.py: Don't use setxattr when it doesn't exist
  2026-05-11 15:15   ` Daniel P. Berrangé
@ 2026-05-11 15:23     ` Peter Maydell
  0 siblings, 0 replies; 8+ messages in thread
From: Peter Maydell @ 2026-05-11 15:23 UTC (permalink / raw)
  To: Daniel P. Berrangé
  Cc: qemu-devel, Thomas Huth, Philippe Mathieu-Daudé

On Mon, 11 May 2026 at 16:16, Daniel P. Berrangé <berrange@redhat.com> wrote:
>
> On Mon, May 11, 2026 at 03:47:33PM +0100, Peter Maydell wrote:
> > On Fri, 1 May 2026 at 12:55, Peter Maydell <peter.maydell@linaro.org> wrote:
> > >
> > > The Python os.setxattr() API is Linux-specific, so trying to use
> > > it on other OSes triggers a failure:
> > >
> > >   File "/Users/pm215/src/qemu/tests/functional/qemu_test/asset.py",
> > > line 227, in fetch
> > >     os.setxattr(str(tmp_cache_file), "user.qemu-asset-url",
> > >     ^^^^^^^^^^^
> > > AttributeError: module 'os' has no attribute 'setxattr'
> > >
> > > Since we only set the attributes here for informational
> > > purposes, skip them when os.setxattr() isn't available.
> > >
> > > Cc: qemu-stable@nongnu.org
> > > Fixes: 9903217a4ed013 ("tests/functional: add a module for handling asset download & caching")
> > > Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> >
> > Is anybody going to pick this up via their tree, or should
> > I just put it into target-arm.next ?
>
> I have it for my misc queue, but if you want to send a PR now then
> consider it to havve
>
>   Acked-by: Daniel P. Berrangé <berrange@redhat.com>

I probably won't have a full pullreq ready to send until the
end of the week, so feel free to keep it in your queue.

thanks
-- PMM


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] tests/functional/qemu_test/asset.py: Don't use setxattr when it doesn't exist
  2026-05-11 14:47 ` Peter Maydell
  2026-05-11 15:15   ` Daniel P. Berrangé
@ 2026-05-12  4:49   ` Thomas Huth
  1 sibling, 0 replies; 8+ messages in thread
From: Thomas Huth @ 2026-05-12  4:49 UTC (permalink / raw)
  To: Peter Maydell, qemu-devel
  Cc: Daniel P. Berrangé, Philippe Mathieu-Daudé

On 11/05/2026 16.47, Peter Maydell wrote:
> On Fri, 1 May 2026 at 12:55, Peter Maydell <peter.maydell@linaro.org> wrote:
>>
>> The Python os.setxattr() API is Linux-specific, so trying to use
>> it on other OSes triggers a failure:
>>
>>    File "/Users/pm215/src/qemu/tests/functional/qemu_test/asset.py",
>> line 227, in fetch
>>      os.setxattr(str(tmp_cache_file), "user.qemu-asset-url",
>>      ^^^^^^^^^^^
>> AttributeError: module 'os' has no attribute 'setxattr'
>>
>> Since we only set the attributes here for informational
>> purposes, skip them when os.setxattr() isn't available.
>>
>> Cc: qemu-stable@nongnu.org
>> Fixes: 9903217a4ed013 ("tests/functional: add a module for handling asset download & caching")
>> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> 
> Is anybody going to pick this up via their tree, or should
> I just put it into target-arm.next ?

I currently don't have any other patches in my queue, so it would be great 
if Daniel or you could take it.

  Thanks,
   Thomas



^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2026-05-12  4:50 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-01 11:55 [PATCH] tests/functional/qemu_test/asset.py: Don't use setxattr when it doesn't exist Peter Maydell
2026-05-01 12:07 ` Daniel P. Berrangé
2026-05-01 12:38 ` Alex Bennée
2026-05-01 21:01 ` Thomas Huth
2026-05-11 14:47 ` Peter Maydell
2026-05-11 15:15   ` Daniel P. Berrangé
2026-05-11 15:23     ` Peter Maydell
2026-05-12  4:49   ` Thomas Huth

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.