diff mbox series

package/pkg-generic: ignore error when chmod'ing extracted source

Message ID 20220616020353.497241-1-uwu@icenowy.me
State Rejected
Headers show
Series package/pkg-generic: ignore error when chmod'ing extracted source | expand

Commit Message

Icenowy Zheng June 16, 2022, 2:03 a.m. UTC
The chmod command included in GNU coreutils 9.0 will exit with 1 when in
a recursive a symlink is met and the mode of both itself and its target
is retained; however this situation is usually expected (such kind of
symlink exists in, e.g., a newly extracted tarball of Linux kernel),
thus not a failure.

Considering this chmod call is only kind of vanishing, ignore error for
it.

Signed-off-by: Icenowy Zheng <uwu@icenowy.me>
---
 package/pkg-generic.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Romain Naour Feb. 6, 2023, 10:48 p.m. UTC | #1
Hello,

Le 16/06/2022 à 04:03, Icenowy Zheng a écrit :
> The chmod command included in GNU coreutils 9.0 will exit with 1 when in
> a recursive a symlink is met and the mode of both itself and its target
> is retained; however this situation is usually expected (such kind of
> symlink exists in, e.g., a newly extracted tarball of Linux kernel),
> thus not a failure.
> 
> Considering this chmod call is only kind of vanishing, ignore error for
> it.

Thanks for the report, it seems that GNU coreutils chmod 9.0 had a regression
[1] that has been fixed in GNU coreutils 9.1.

I'm not sure if we should apply this workaround now that coreutils is fixed.

[1] https://debbugs.gnu.org/cgi/bugreport.cgi?bug=50784

Best regards,
Romain

> 
> Signed-off-by: Icenowy Zheng <uwu@icenowy.me>
> ---
>  package/pkg-generic.mk | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/package/pkg-generic.mk b/package/pkg-generic.mk
> index b233b07548..03e4b029b3 100644
> --- a/package/pkg-generic.mk
> +++ b/package/pkg-generic.mk
> @@ -216,7 +216,7 @@ $(BUILD_DIR)/%/.stamp_extracted:
>  	$(Q)mkdir -p $(@D)
>  	$($(PKG)_EXTRACT_CMDS)
>  # some packages have messed up permissions inside
> -	$(Q)chmod -R +rw $(@D)
> +	-$(Q)chmod -R +rw $(@D)
>  	$(foreach hook,$($(PKG)_POST_EXTRACT_HOOKS),$(call $(hook))$(sep))
>  	@$(call step_end,extract)
>  	$(Q)touch $@
Arnout Vandecappelle Feb. 7, 2023, 1:09 p.m. UTC | #2
Hi Icenswy,

On 16/06/2022 04:03, Icenowy Zheng wrote:
> The chmod command included in GNU coreutils 9.0 will exit with 1 when in

  As mentioned by Romain, this is really a bug in coreutils which was fixed in 
coreutils 9.1. Since I assume all distros will have updated their coreutils, I 
see little value in carrying a fix in Buildroot. On the other hand, there is 
some value in seeing a failure of the chmod.

  Therefore, I've marked this patch as Rejected in patchwork.

  Regardless, thank you for your contribution!

  Regards,
  Arnout

> a recursive a symlink is met and the mode of both itself and its target
> is retained; however this situation is usually expected (such kind of
> symlink exists in, e.g., a newly extracted tarball of Linux kernel),
> thus not a failure.
> 
> Considering this chmod call is only kind of vanishing, ignore error for
> it.
> 
> Signed-off-by: Icenowy Zheng <uwu@icenowy.me>
> ---
>   package/pkg-generic.mk | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/package/pkg-generic.mk b/package/pkg-generic.mk
> index b233b07548..03e4b029b3 100644
> --- a/package/pkg-generic.mk
> +++ b/package/pkg-generic.mk
> @@ -216,7 +216,7 @@ $(BUILD_DIR)/%/.stamp_extracted:
>   	$(Q)mkdir -p $(@D)
>   	$($(PKG)_EXTRACT_CMDS)
>   # some packages have messed up permissions inside
> -	$(Q)chmod -R +rw $(@D)
> +	-$(Q)chmod -R +rw $(@D)
>   	$(foreach hook,$($(PKG)_POST_EXTRACT_HOOKS),$(call $(hook))$(sep))
>   	@$(call step_end,extract)
>   	$(Q)touch $@
diff mbox series

Patch

diff --git a/package/pkg-generic.mk b/package/pkg-generic.mk
index b233b07548..03e4b029b3 100644
--- a/package/pkg-generic.mk
+++ b/package/pkg-generic.mk
@@ -216,7 +216,7 @@  $(BUILD_DIR)/%/.stamp_extracted:
 	$(Q)mkdir -p $(@D)
 	$($(PKG)_EXTRACT_CMDS)
 # some packages have messed up permissions inside
-	$(Q)chmod -R +rw $(@D)
+	-$(Q)chmod -R +rw $(@D)
 	$(foreach hook,$($(PKG)_POST_EXTRACT_HOOKS),$(call $(hook))$(sep))
 	@$(call step_end,extract)
 	$(Q)touch $@