View Ticket
Bounty program for improvements to Tcl and certain Tcl packages.
Tcl 2019 Conference, Houston/TX, US, Nov 4-8
Send your abstracts to [email protected]
or submit via the online form by Sep 9.
Ticket UUID: 47edc4cb21e0add7eb7c78fac02ca1ff6ab01473
Title: Avoid unnecessary temporary files at build time
Status: Closed Type: Build Problem
Severity: Minor Priority: Immediate
Subsystem: Resolution: Rejected
Last Modified: 2017-01-17 15:44:50
Version Found In:
User Comments:
anonymous added on 2017-01-17 11:00:04:
I suggest the following change, to avoid unnecessary temporary files at build time.

Index: Makefile.in
==================================================================
--- Makefile.in
+++ Makefile.in
@@ -36,14 +36,12 @@

 # Create a C-source-ified version of the script resources
 # for TclTLS so that we only need a single file to enable
 # this extension
 tls.tcl.h: @[email protected]/tls.tcl Makefile
-       od -A n -v -t xC < '@[email protected]/tls.tcl' > tls.tcl.h.new.1
-       sed '[email protected]  *@@g;[email protected]@0x&, @g' < tls.tcl.h.new.1 > tls.tcl.h.new.2
-       rm -f tls.tcl.h.new.1
-       mv tls.tcl.h.new.2 tls.tcl.h
+       od -A n -v -t xC < '@[email protected]/tls.tcl' | \
+       sed '[email protected]  *@@g;[email protected]@0x&, @g' > tls.tcl.h

 # Create default DH parameters
 dh_params.h: @[email protected]/gen_dh_params Makefile
        @[email protected]/gen_dh_params @[email protected] > dh_params.h.new
        mv dh_params.h.new dh_params.h

rkeene added on 2017-01-17 14:42:59:

The reason it's done this way is because the exit status is only of the last command in the pipeline. Your solution will only fail if 'sed' fails, not if 'od' fails. The result will appear to be successful but be a zero byte file.