When using the "-s" option to skip certain outputs, Autogen sets FPF_{STATIC_NM,NOUNLINK,NOCHMOD} flags on the output control record of the current main output file. However, these flags are not cleared before other main output files are processed. This means that if one output spec is skipped, then all main output files thereafter will not be set read-only. (Also, there is probably a small memory leak, since the dynamically allocated names won't be getting freed either.)
Symptoms:
$ head -4 ../../../AUTOGEN-LIB/c-files.agt
{@@ autogen5 template
impl_c=%s.c
impl_h=%s.h
iface_h=%s.h-frag
$ make | grep autogen
/usr/local/bin/autogen -S ../../../AUTOGEN-LIB/c-emitter.scm -L ../../../AUTOGEN-LIB -s impl_h -s iface_h ../AGD/test.agd
/usr/local/bin/autogen -S ../../../AUTOGEN-LIB/c-emitter.scm -L ../../../AUTOGEN-LIB -s impl_c -s iface_h ../AGD/test.agd
$ ls -l test.{c,h} | awk '{print $1,$9}'
-r--r--r-- test.c
-rw-r--r-- test.h
Attached is a tiny patch to fix the problem. Results after fix:
$ make | grep autogen
/usr/local/bin/autogen -S ../../../AUTOGEN-LIB/c-emitter.scm -L ../../../AUTOGEN-LIB -s impl_h -s iface_h ../AGD/test.agd
/usr/local/bin/autogen -S ../../../AUTOGEN-LIB/c-emitter.scm -L ../../../AUTOGEN-LIB -s impl_c -s iface_h ../AGD/test.agd
$ ls -l test.{c,h} | awk '{print $1,$9}'
-r--r--r-- test.c
-r--r--r-- test.h
Thanks.
Fix for Output Control Record Flag Reset Problem
Thank you very much! Regards, Bruce