Skip to contentSkip to conversation

update_gio_module_cache: Do not chown a non-existing file

PATCH In review Peter Kjellerstedt 3 participants 6 messages Mar 29, 2017 – Mar 30, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 update_gio_module_cache: Do not chown a non-existing file

Only change the ownership of ${libdir}/gio/modules/giomodule.cache if it exists.

---
 scripts/postinst-intercepts/update_gio_module_cache | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
scripts/postinst-intercepts/update_gio_module_cache +3 -3
index 92092f2144..fc3f9d0d6c 100644
@@ -3,7 +3,7 @@
 set -e
 
 PSEUDO_UNLOAD=1 qemuwrapper -L $D -E LD_LIBRARY_PATH=$D${libdir}:$D${base_libdir} \
-        $D${libexecdir}/${binprefix}gio-querymodules $D${libdir}/gio/modules/
-
-chown root:root $D${libdir}/gio/modules/giomodule.cache
+	$D${libexecdir}/${binprefix}gio-querymodules $D${libdir}/gio/modules/
 
+[ ! -e $D${libdir}/gio/modules/giomodule.cache ] ||
+	chown root:root $D${libdir}/gio/modules/giomodule.cache
Signature · 1 line
2.12.0
#1 lore raw
Quoted 2 lines · Peter Kjellerstedt

Only change the ownership of ${libdir}/gio/modules/giomodule.cache if it exists.

Why do we need to change the owndership in the first place?

Alex

#2 lore raw
Quoted 6 lines · Alexander Kanavin
Quoted 4 lines · Peter Kjellerstedt

Only change the ownership of ${libdir}/gio/modules/giomodule.cache if
it exists.

Why do we need to change the owndership in the first place?

The qemu call in the line above is made under PSEUDO_UNLOAD, see the original patch from Chris.

Cheers,

Richard

#3 lore raw
Quoted 7 lines · Richard Purdie
Quoted 4 lines
Quoted 3 lines

Only change the ownership of ${libdir}/gio/modules/giomodule.cache if
it exists.

Why do we need to change the owndership in the first place?

The qemu call in the line above is made under PSEUDO_UNLOAD, see the original patch from Chris.

With this change, if the qemu call fails (which it is allowed to), will the entire script fail, and be deferred to first boot as it should?

Alex

#4 lore raw
In reply to Peter Kjellerstedt
Quoted 14 lines · Peter Kjellerstedt

Only change the ownership of ${libdir}/gio/modules/giomodule.cache if it exists.

---
 scripts/postinst-intercepts/update_gio_module_cache | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
scripts/postinst-intercepts/update_gio_module_cache +0 -0
index 92092f2144..fc3f9d0d6c 100644

scripts/postinst-intercepts/update_gio_module_cache line 9

Quoted 10 lines
scripts/postinst-intercepts/update_gio_module_cache +3 -3
@@ -3,7 +3,7 @@
 set -e
 
 PSEUDO_UNLOAD=1 qemuwrapper -L $D -E LD_LIBRARY_PATH=$D${libdir}:$D${base_libdir} \
-        $D${libexecdir}/${binprefix}gio-querymodules $D${libdir}/gio/modules/
-
-chown root:root $D${libdir}/gio/modules/giomodule.cache
+	$D${libexecdir}/${binprefix}gio-querymodules $D${libdir}/gio/modules/
 
+[ ! -e $D${libdir}/gio/modules/giomodule.cache ] ||
+	chown root:root $D${libdir}/gio/modules/giomodule.cache

Nope. The postinst-intercept scirpts are allowed to fail, and if they are, they are deferred to first boot. If giomodule.cache file does not exist, that means that qemu does not work for the target machine, which is not a bug, and is handled by detecting script failure and taking the same action at first boot time - which your change breaks.

Alex

#5 lore raw
Quoted 45 lines

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Alexander Kanavin
Sent: den 30 mars 2017 11:39
To: [email protected]
Subject: Re: [OE-core] [PATCH] update_gio_module_cache: Do not chown a non-existing file

Review

Quoted 9 lines · Peter Kjellerstedt

Only change the ownership of ${libdir}/gio/modules/giomodule.cache if it exists.

---
 scripts/postinst-intercepts/update_gio_module_cache | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
(quoted diff) +0 -0

b/scripts/postinst-intercepts/update_gio_module_cache

scripts/postinst-intercepts/update_gio_module_cache line 5

Quoted 7 lines

index 92092f2144..fc3f9d0d6c 100644

scripts/postinst-intercepts/update_gio_module_cache +0 -0
@@ -3,7 +3,7 @@
 set -e
 
 PSEUDO_UNLOAD=1 qemuwrapper -L $D -E

LD_LIBRARY_PATH=$D${libdir}:$D${base_libdir} \

scripts/postinst-intercepts/update_gio_module_cache line 6

Quoted 1 line
scripts/postinst-intercepts/update_gio_module_cache +0 -1
-        $D${libexecdir}/${binprefix}gio-querymodules

$D${libdir}/gio/modules/

scripts/postinst-intercepts/update_gio_module_cache

Quoted 3 lines
scripts/postinst-intercepts/update_gio_module_cache +1 -2
-
-chown root:root $D${libdir}/gio/modules/giomodule.cache
+	$D${libexecdir}/${binprefix}gio-querymodules

$D${libdir}/gio/modules/

scripts/postinst-intercepts/update_gio_module_cache

Quoted 4 lines
scripts/postinst-intercepts/update_gio_module_cache +2 -0
+[ ! -e $D${libdir}/gio/modules/giomodule.cache ] ||
+	chown root:root $D${libdir}/gio/modules/giomodule.cache
 

Nope. The postinst-intercept scirpts are allowed to fail, and if they are, they are deferred to first boot. If giomodule.cache file does not exist, that means that qemu does not work for the target machine, which is not a bug, and is handled by detecting script failure and taking the same action at first boot time - which your change breaks.

Quoted 1 line

Alex

No, the script will still fail if running gio-querymodules fails since set -e is in effect. But it will no longer fail if gio-querymodules succeeds without producing a cache file, which is the case for us.

I do not know under what circumstances gio-querymodules will or will not produce a cache file, but I have tried running it on our target and it does not produce a cache file there either, so I assume the build time job is doing the right thing in not creating a file.

//Peter