Bug 216514

Summary: rpcgen leaves broken output file if ${CPP} not found
Product: Base System Reporter: Ed Maste <emaste>
Component: binAssignee: freebsd-bugs (Nobody) <bugs>
Status: New ---    
Severity: Affects Some People    
Priority: ---    
Version: CURRENT   
Hardware: Any   
OS: Any   

Description Ed Maste freebsd_committer freebsd_triage 2017-01-27 03:02:11 UTC
As a result of a misconfigured external toolchain I ended up with ${CPP} set to a nonexistent file. In this case rpcgen creates a broken output file before exiting with an error, and subsequent builds do not try to rebuild it.

rpcgen should either not create the output file early (e.g., by writing to a temporary and renaming on success), or delete it on error.

(Root cause of this issue was an old, mismatched mips64-xtoolchain-gcc.)

Reproduction steps:
% touch foo.h
% RPCGEN_CPP=does-not-exist rpcgen -C -h foo.h -o foo.out
rpcgen: execvp does-not-exist: No such file or directory
% echo $?
1
% ls -l foo.out
-rw-r--r--  1 emaste  emaste  240 26 Jan 21:52 foo.out