[v2] buildtools: fix build for some mktemp

Message ID 20181027003815.943-1-ferruh.yigit@intel.com (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers
Series [v2] buildtools: fix build for some mktemp |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Ferruh Yigit Oct. 27, 2018, 12:38 a.m. UTC
  build error:
== Build drivers/net/tap
mktemp: cannot create temp file /tmp/dpdk.auto-config-h.sh.XXX.c:
Invalid argument
.../buildtools/auto-config-h.sh: line 86: : No such file or directory
.../drivers/net/tap/Makefile:55: recipe for target
   'tap_autoconf.h.new' failed

Above error observed on Wind River Linux 8.0

`mktemp` command in that system has a restrictions to have X in
the template at the end and at least six of them.

Complied to mktemp requirements and add -xc flag to compiler to say
`temp` file is a C file

Fixes: ff37ca5d3773 ("devtools: use a common prefix for temporary files")

Reported-by: Shuai Zhu <shuaix.zhu@intel.com>
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
---
v2:
* keep using mktemp, add -xc to compiler
---
 buildtools/auto-config-h.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
  

Comments

Thomas Monjalon Oct. 26, 2018, 11:47 p.m. UTC | #1
27/10/2018 02:38, Ferruh Yigit:
> build error:
> == Build drivers/net/tap
> mktemp: cannot create temp file /tmp/dpdk.auto-config-h.sh.XXX.c:
> Invalid argument
> .../buildtools/auto-config-h.sh: line 86: : No such file or directory
> .../drivers/net/tap/Makefile:55: recipe for target
>    'tap_autoconf.h.new' failed
> 
> Above error observed on Wind River Linux 8.0
> 
> `mktemp` command in that system has a restrictions to have X in
> the template at the end and at least six of them.
> 
> Complied to mktemp requirements and add -xc flag to compiler to say
> `temp` file is a C file
> 
> Fixes: ff37ca5d3773 ("devtools: use a common prefix for temporary files")
> 
> Reported-by: Shuai Zhu <shuaix.zhu@intel.com>
> Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
> ---
> v2:
> * keep using mktemp, add -xc to compiler
> ---
>  buildtools/auto-config-h.sh | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> --- a/buildtools/auto-config-h.sh
> +++ b/buildtools/auto-config-h.sh
> -temp=$(mktemp -t dpdk.${0##*/}.XXX.c)
> +temp=$(mktemp -t dpdk.${0##*/}.c.XXXXXX)

It looks OK for this script.

Should we do the same kind of change for devtools/check-includes.sh?
and devtools/cocci.sh?
  
Ferruh Yigit Oct. 26, 2018, 11:53 p.m. UTC | #2
On 10/27/2018 12:47 AM, Thomas Monjalon wrote:
> 27/10/2018 02:38, Ferruh Yigit:
>> build error:
>> == Build drivers/net/tap
>> mktemp: cannot create temp file /tmp/dpdk.auto-config-h.sh.XXX.c:
>> Invalid argument
>> .../buildtools/auto-config-h.sh: line 86: : No such file or directory
>> .../drivers/net/tap/Makefile:55: recipe for target
>>    'tap_autoconf.h.new' failed
>>
>> Above error observed on Wind River Linux 8.0
>>
>> `mktemp` command in that system has a restrictions to have X in
>> the template at the end and at least six of them.
>>
>> Complied to mktemp requirements and add -xc flag to compiler to say
>> `temp` file is a C file
>>
>> Fixes: ff37ca5d3773 ("devtools: use a common prefix for temporary files")
>>
>> Reported-by: Shuai Zhu <shuaix.zhu@intel.com>
>> Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
>> ---
>> v2:
>> * keep using mktemp, add -xc to compiler
>> ---
>>  buildtools/auto-config-h.sh | 4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> --- a/buildtools/auto-config-h.sh
>> +++ b/buildtools/auto-config-h.sh
>> -temp=$(mktemp -t dpdk.${0##*/}.XXX.c)
>> +temp=$(mktemp -t dpdk.${0##*/}.c.XXXXXX)
> 
> It looks OK for this script.
> 
> Should we do the same kind of change for devtools/check-includes.sh?
> and devtools/cocci.sh?

Not sure, this script is part of buildtool and required for build, so needs to
be compatible for various systems. Above are devtools and can use new mktemp.
  
Thomas Monjalon Oct. 27, 2018, 12:05 a.m. UTC | #3
27/10/2018 01:53, Ferruh Yigit:
> On 10/27/2018 12:47 AM, Thomas Monjalon wrote:
> > 27/10/2018 02:38, Ferruh Yigit:
> >> build error:
> >> == Build drivers/net/tap
> >> mktemp: cannot create temp file /tmp/dpdk.auto-config-h.sh.XXX.c:
> >> Invalid argument
> >> .../buildtools/auto-config-h.sh: line 86: : No such file or directory
> >> .../drivers/net/tap/Makefile:55: recipe for target
> >>    'tap_autoconf.h.new' failed
> >>
> >> Above error observed on Wind River Linux 8.0
> >>
> >> `mktemp` command in that system has a restrictions to have X in
> >> the template at the end and at least six of them.
> >>
> >> Complied to mktemp requirements and add -xc flag to compiler to say
> >> `temp` file is a C file
> >>
> >> Fixes: ff37ca5d3773 ("devtools: use a common prefix for temporary files")
> >>
> >> Reported-by: Shuai Zhu <shuaix.zhu@intel.com>
> >> Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
> >> ---
> >> v2:
> >> * keep using mktemp, add -xc to compiler
> >> ---
> >>  buildtools/auto-config-h.sh | 4 ++--
> >>  1 file changed, 2 insertions(+), 2 deletions(-)
> >>
> >> --- a/buildtools/auto-config-h.sh
> >> +++ b/buildtools/auto-config-h.sh
> >> -temp=$(mktemp -t dpdk.${0##*/}.XXX.c)
> >> +temp=$(mktemp -t dpdk.${0##*/}.c.XXXXXX)
> > 
> > It looks OK for this script.
> > 
> > Should we do the same kind of change for devtools/check-includes.sh?
> > and devtools/cocci.sh?
> 
> Not sure, this script is part of buildtool and required for build, so needs to
> be compatible for various systems. Above are devtools and can use new mktemp.

You mean nobody will use Wind River Linux 8.0 for developing?
You are probably right :)
  
Thomas Monjalon Oct. 27, 2018, 1:30 p.m. UTC | #4
27/10/2018 01:53, Ferruh Yigit:
> On 10/27/2018 12:47 AM, Thomas Monjalon wrote:
> > 27/10/2018 02:38, Ferruh Yigit:
> >> build error:
> >> == Build drivers/net/tap
> >> mktemp: cannot create temp file /tmp/dpdk.auto-config-h.sh.XXX.c:
> >> Invalid argument
> >> .../buildtools/auto-config-h.sh: line 86: : No such file or directory
> >> .../drivers/net/tap/Makefile:55: recipe for target
> >>    'tap_autoconf.h.new' failed
> >>
> >> Above error observed on Wind River Linux 8.0
> >>
> >> `mktemp` command in that system has a restrictions to have X in
> >> the template at the end and at least six of them.
> >>
> >> Complied to mktemp requirements and add -xc flag to compiler to say
> >> `temp` file is a C file
> >>
> >> Fixes: ff37ca5d3773 ("devtools: use a common prefix for temporary files")
> >>
> >> Reported-by: Shuai Zhu <shuaix.zhu@intel.com>
> >> Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
> >> ---
> >> v2:
> >> * keep using mktemp, add -xc to compiler
> >> ---
> >>  buildtools/auto-config-h.sh | 4 ++--
> >>  1 file changed, 2 insertions(+), 2 deletions(-)
> >>
> >> --- a/buildtools/auto-config-h.sh
> >> +++ b/buildtools/auto-config-h.sh
> >> -temp=$(mktemp -t dpdk.${0##*/}.XXX.c)
> >> +temp=$(mktemp -t dpdk.${0##*/}.c.XXXXXX)
> > 
> > It looks OK for this script.
> > 
> > Should we do the same kind of change for devtools/check-includes.sh?
> > and devtools/cocci.sh?
> 
> Not sure, this script is part of buildtool and required for build, so needs to
> be compatible for various systems. Above are devtools and can use new mktemp.

Applied, thanks
  

Patch

diff --git a/buildtools/auto-config-h.sh b/buildtools/auto-config-h.sh
index 6130429eb..5b613c35f 100755
--- a/buildtools/auto-config-h.sh
+++ b/buildtools/auto-config-h.sh
@@ -23,7 +23,7 @@  name=${5:?define/type/function name required}
 
 : ${CC:=cc}
 
-temp=$(mktemp -t dpdk.${0##*/}.XXX.c)
+temp=$(mktemp -t dpdk.${0##*/}.c.XXXXXX)
 
 case $type in
 define)
@@ -86,7 +86,7 @@  printf "\
 " "$include" "$code" > "${temp}" &&
 if ${CC} ${CPPFLAGS} ${EXTRA_CPPFLAGS} ${CFLAGS} ${EXTRA_CFLAGS} \
 	${AUTO_CONFIG_CFLAGS} \
-	-c -o ${temp}.o "${temp}" 1>&${out} 2>&${err}
+	-xc -c -o ${temp}.o "${temp}" 1>&${out} 2>&${err}
 then
 	rm -f "${temp}" "${temp}.o"
 	printf "\