diff mbox series

buildtools: fix build for some mktemp

Message ID 20181026184248.78908-1-ferruh.yigit@intel.com (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers show
Series buildtools: fix build for some mktemp | expand

Checks

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

Commit Message

Ferruh Yigit Oct. 26, 2018, 6:42 p.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.

Switched back to static assignment for `temp` in buildtools,
but kept `dpdk.` prefix to preserve the common prefix intention.

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>
---
 buildtools/auto-config-h.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Thomas Monjalon Oct. 26, 2018, 5:59 p.m. UTC | #1
26/10/2018 20:42, 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.

So let's comply with this requirement.

> Switched back to static assignment for `temp` in buildtools,
> but kept `dpdk.` prefix to preserve the common prefix intention.

It is a regression.
mktemp allows to choose the temporary directory thanks to TMPDIR
environment variable.
Ferruh Yigit Oct. 26, 2018, 6:31 p.m. UTC | #2
On 10/26/2018 6:59 PM, Thomas Monjalon wrote:
> 26/10/2018 20:42, 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.
> 
> So let's comply with this requirement.

We can't directly, because that temp file needs to be a .c file.

What can be done is create a temp file via mktemp and append .c later:
_temp=$(mktemp -t dpdk.${0##*/}.XXXXXX)
temp=${_temp}.c

Do we need this?

> 
>> Switched back to static assignment for `temp` in buildtools,
>> but kept `dpdk.` prefix to preserve the common prefix intention.
> 
> It is a regression.
> mktemp allows to choose the temporary directory thanks to TMPDIR
> environment variable.
> 
> 
>
Thomas Monjalon Oct. 26, 2018, 7:59 p.m. UTC | #3
26/10/2018 20:31, Ferruh Yigit:
> On 10/26/2018 6:59 PM, Thomas Monjalon wrote:
> > 26/10/2018 20:42, 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.
> > 
> > So let's comply with this requirement.
> 
> We can't directly, because that temp file needs to be a .c file.

The .c extension is mandatory?

> What can be done is create a temp file via mktemp and append .c later:
> _temp=$(mktemp -t dpdk.${0##*/}.XXXXXX)
> temp=${_temp}.c
> 
> Do we need this?

Yes I think it's better.

> >> Switched back to static assignment for `temp` in buildtools,
> >> but kept `dpdk.` prefix to preserve the common prefix intention.
> > 
> > It is a regression.
> > mktemp allows to choose the temporary directory thanks to TMPDIR
> > environment variable.
Ferruh Yigit Oct. 26, 2018, 11:28 p.m. UTC | #4
On 10/26/2018 8:59 PM, Thomas Monjalon wrote:
> 26/10/2018 20:31, Ferruh Yigit:
>> On 10/26/2018 6:59 PM, Thomas Monjalon wrote:
>>> 26/10/2018 20:42, 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.
>>>
>>> So let's comply with this requirement.
>>
>> We can't directly, because that temp file needs to be a .c file.
> 
> The .c extension is mandatory?

This file is compiled, it is doesn't need to have .c with proper compiler flag.

> 
>> What can be done is create a temp file via mktemp and append .c later:
>> _temp=$(mktemp -t dpdk.${0##*/}.XXXXXX)
>> temp=${_temp}.c
>>
>> Do we need this?
> 
> Yes I think it's better.

This will create two temp files, one is empty, I will try above option.

> 
>>>> Switched back to static assignment for `temp` in buildtools,
>>>> but kept `dpdk.` prefix to preserve the common prefix intention.
>>>
>>> It is a regression.
>>> mktemp allows to choose the temporary directory thanks to TMPDIR
>>> environment variable.
> 
> 
>
diff mbox series

Patch

diff --git a/buildtools/auto-config-h.sh b/buildtools/auto-config-h.sh
index 6130429eb..29a0d9e9d 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=/tmp/dpdk.${0##*/}.$$.c
 
 case $type in
 define)