Skip to contentSkip to conversation

init/Kconfig: Specify the interpreter for rust-version.sh

PATCH In review SeongJae Park 2 participants 4 messages Jan 10, 2022 – Jan 12, 2022 Rust

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 init/Kconfig: Specify the interpreter for rust-version.sh

Some common tools like 'diff' don't support permissions of the files. Due to that, 'rust-version.sh' in some trees including '-mm' result in having no execution permission, and therefore build fails like below:

    $ make O=../linux.out/ olddefconfig
    make[1]: Entering directory 'linux.out'
      GEN     Makefile
    sh: 1: linux/scripts/rust-version.sh: Permission denied
    init/Kconfig:71: syntax error
    init/Kconfig:70: invalid statement
    linux/scripts/kconfig/Makefile:77: recipe for target 'olddefconfig' failed
    make[2]: *** [olddefconfig] Error 1
    linux/Makefile:666: recipe for target 'olddefconfig' failed
    make[1]: *** [olddefconfig] Error 2
    make[1]: Leaving directory 'linux.out'
    Makefile:226: recipe for target '__sub-make' failed
    make: *** [__sub-make] Error 2

It's not a big deal, but not so fun. This commit works around the issue by specifying the interpreter for 'rust-version.sh' in the Kconfig file. The ugly work around wouldn't be needed once 'rust-version.sh' file is merged in the mainline with the execution permission.

---
Changes from v1
(https://lore.kernel.org/all/[email protected]/)
- Collect 'Reviewed-by:' from Wei Liu
- Specify that this is temporal workaround and when it can be reverted (Miguel Ojeda)

 init/Kconfig | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
init/Kconfig +7 -1
index cd23faa163d1..d3707b9f222c 100644
@@ -67,7 +67,13 @@ config HAS_RUST
 config RUSTC_VERSION
 	depends on HAS_RUST
 	int
-	default $(shell,$(srctree)/scripts/rust-version.sh $(RUSTC))
+	# Because some common tools like 'diff' don't support permissions of
+	# the files, 'rust-version.sh' in some trees that managed with such
+	# tools result in having no execution permission.  As a temporal work
+	# around, we specify the interpreter ('/bin/sh').  It will be unneeded
+	# once 'rust-version.sh' is merged in the mainline with its execution
+	# permission.
+	default $(shell,/bin/sh $(srctree)/scripts/rust-version.sh $(RUSTC))
 
 config CC_CAN_LINK
 	bool
Signature · 1 line
2.17.1
#1 lore raw
Quoted 2 lines · SeongJae Park

Some common tools like 'diff' don't support permissions of the files.

Picking it up, thanks!

Cheers,
Miguel

#2 lore raw
Quoted 2 lines · Miguel Ojeda

Picking it up, thanks!

This is now in linux-next (Jan 11) -- hopefully it is now better for you!

I will carry the patch in our rust-next branch but I won't put it in the patch series, this way we won't need to revert it when merged into mainline.

Cheers,
Miguel

#3 lore raw
Quoted 6 lines · On Wed, 12 Jan 2022 01:32:20 +0100 Miguel Ojeda…
Quoted 2 lines · Miguel Ojeda

Picking it up, thanks!

This is now in linux-next (Jan 11) -- hopefully it is now better for you!

Confirmed that, thank you! :)

Quoted 4 lines

I will carry the patch in our rust-next branch but I won't put it in the patch series, this way we won't need to revert it when merged into mainline.

Sure. Looking forward to the day!

Thanks,
SJ

Quoted 3 lines

Cheers,
Miguel