On Sun, 2016-08-21 at 22:03 +0200, Denys Vlasenko wrote: > On Fri, Aug 19, 2016 at 3:47 PM, Richard Purdie <[email protected]> > wrote: > > Index: busybox-1.24.1/applets/applet_tables.c > > =================================================================== > > --- busybox-1.24.1.orig/applets/applet_tables.c > > +++ busybox-1.24.1/applets/applet_tables.c > > @@ -151,23 +151,15 @@ int main(int argc, char **argv) > > // printf("#define MAX_APPLET_NAME_LEN %u\n", > > MAX_APPLET_NAME_LEN); > > > > if (argv[2]) { > > - char line_old[80]; > > char line_new[80]; > > FILE *fp; > > > > - line_old[0] = 0; > > - fp = fopen(argv[2], "r"); > > - if (fp) { > > - fgets(line_old, sizeof(line_old), fp); > > - fclose(fp); > > - } > > sprintf(line_new, "#define NUM_APPLETS %u\n", > > NUM_APPLETS); > > - if (strcmp(line_old, line_new) != 0) { > > - fp = fopen(argv[2], "w"); > > - if (!fp) > > - return 1; > > - fputs(line_new, fp); > > - } > > + fp = fopen(argv[2], "w"); > > + if (!fp) > > + return 1; > > + fputs(line_new, fp); > > + fclose(fp); > > This is done on purpose: if number of applets did not change, no need > to rebuild files which depend on NUM_APPLETS.h
I appreciate the idea, however it doesn't work as the makefiles rely on timestamps of the dependent objects changing and the above code means the timestamps may or may not change. If they don't change, the rules can keep being re-triggered as far as I can tell. For example, if it rebuilds applet_tables for some reason, but when it runs applet tables, NUM_APPLETS.h doesn't change, it will keep running it over and over in submakes since NUM_APPLETS.h depends on applet_tables and its older however it won't get its timestamp updated. That is bad enough, however it will continually rewrite applet_tables.h, and that gives rise to a build race since the file may be getting rewritten when the compiler looks at it. Having said all this, I applied my patch to our builds and we're still seeing failures so there is some further problem :( Cheers, Richard _______________________________________________ busybox mailing list [email protected] http://lists.busybox.net/mailman/listinfo/busybox
