bug-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

File timing bug


From: Herbert Euler
Subject: File timing bug
Date: Sun, 8 Jun 2008 21:51:37 +0800

I occasionally find a bug in GNU make:

  address@hidden:~/makebug$ make --version
  GNU Make 3.81
  Copyright (C) 2006  Free Software Foundation, Inc.
  This is free software; see the source for copying conditions.
  There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
  PARTICULAR PURPOSE.

  This program built for i486-pc-linux-gnu
  address@hidden:~/makebug$

To reproduce the bug, following the steps below:

1. Unpack the attached makebug.tar.gz file into a directory and change
   the current directory to it, and build the project:

     address@hidden:~$ tar xf /home/herbert/tmp/makebug.tar.gz
     address@hidden:~$ cd makebug/
     address@hidden:~/makebug$ ./configure
     ...
     address@hidden:~/makebug$ make
     ...
     address@hidden:~/makebug$ grep 'report version' doc/makebug
     A bug in make?  This is report version 0.2.
     address@hidden:~/makebug$

2. Change the version in configure.in.  Any version number that is
   different from the existing one in the file should be OK.

     address@hidden:~/makebug$ diff -c configure.in configure.in~
     *** configure.in        2008-06-08 21:43:09.000000000 -0400
     --- configure.in~       2008-06-08 21:35:10.000000000 -0400
     ***************
     *** 1,4 ****
     ! AC_INIT([makebug], [0.1])
       AM_INIT_AUTOMAKE
       AC_CONFIG_FILES([doc/Makefile Makefile])
       AC_OUTPUT
     --- 1,4 ----
     ! AC_INIT([makebug], [0.2])
       AM_INIT_AUTOMAKE
       AC_CONFIG_FILES([doc/Makefile Makefile])
       AC_OUTPUT
     address@hidden:~/makebug$

3. Type make in the directory.  The version in doc/makebug should have
   been updated to the new one in configure.in, but it does not.  Here
   we use --debug=v to track what happened at the same time:

     address@hidden:~/makebug$ make --debug=v>makelog
     address@hidden:~/makebug$ grep 'report version' doc/makebug
     A bug in make?  This is report version 0.2.
     address@hidden:~/makebug$

   I.e. the ``0.2'' in the above result should be ``0.1''.  However,
   at the same time, version.texi already has the correct content:

     address@hidden:~/makebug$ cat doc/version.texi
     @set UPDATED 8 June 2008
     @set UPDATED-MONTH June 2008
     @set EDITION 0.1
     @set VERSION 0.1
     address@hidden:~/makebug$

Looking into doc/Makefile, we can see the following dependencies:

  makebug:      makebug.texi version.texi
  version.texi: stamp-vti
  stamp-vti:    makebug.texi ../configure

We have changed configure.in, so configure is updated.  Hence we have
stamp-vti is older than ../configure, it will be regenerated.  Also,
regenerating stamp-vti causes version.texi regenerated.  As a result,
the target makebug should be regenerated, but it does not.

Here is what the file makelog says:

      Considering target file `makebug'.
        Considering target file `makebug.texi'.
         Finished prerequisites of target file `makebug.texi'.
        No need to remake target `makebug.texi'.
        Considering target file `version.texi'.
          Considering target file `stamp-vti'.
            Pruning file `makebug.texi'.
            Pruning file `../configure'.
           Finished prerequisites of target file `stamp-vti'.
           Prerequisite `makebug.texi' is older than target `stamp-vti'.
           Prerequisite `../configure' is newer than target `stamp-vti'.
          Must remake target `stamp-vti'.
  make[1]: Entering directory `/home/herbert/makebug/doc'
  Updating ./version.texi
          Successfully remade target file `stamp-vti'.
         Finished prerequisites of target file `version.texi'.
         Prerequisite `stamp-vti' is newer than target `version.texi'.
        Must remake target `version.texi'.
        Successfully remade target file `version.texi'.
       Finished prerequisites of target file `makebug'.
       Prerequisite `makebug.texi' is older than target `makebug'.
       Prerequisite `version.texi' is older than target `makebug'.
      No need to remake target `makebug'.

The last three lines explain why makebug is not regenerated: make
considers both makebug.texi and version.texi older than makebug.
However, the stat program tells us contradictory facts:

  address@hidden:~/makebug$ stat doc/version.texi
    File: `doc/version.texi'
    Size: 88              Blocks: 8          IO Block: 4096   regular file
  Device: 808h/2056d      Inode: 2463299     Links: 1
  Access: (0644/-rw-r--r--)  Uid: ( 1000/ herbert)   Gid: ( 1000/ herbert)
  Access: 2008-06-08 21:44:28.000000000 -0400
  Modify: 2008-06-08 21:43:43.000000000 -0400
  Change: 2008-06-08 21:43:43.000000000 -0400
  address@hidden:~/makebug$ stat doc/makebug
    File: `doc/makebug'
    Size: 379             Blocks: 8          IO Block: 4096   regular file
  Device: 808h/2056d      Inode: 2463308     Links: 1
  Access: (0644/-rw-r--r--)  Uid: ( 1000/ herbert)   Gid: ( 1000/ herbert)
  Access: 2008-06-08 21:43:46.000000000 -0400
  Modify: 2008-06-08 21:41:28.000000000 -0400
  Change: 2008-06-08 21:42:06.000000000 -0400
  address@hidden:~/makebug$

That is, version.texi *is* newer than makebug, according to both last
change time and last modify time.

To regenerate makebug, we have to execute make for the second time
(texinfo warnings can be ignored):

  address@hidden:~/makebug$ make --debug=v>makelog
  ./makebug.texi:11: warning: @menu seen before first @node, creating `Top' 
node.
  ./makebug.texi:11: warning: perhaps your @top node should be wrapped in 
@ifnottex rather than @ifinfo?.
  address@hidden:~/makebug$ grep 'report version' doc/makebug
  A bug in make?  This is report version 0.1.
  address@hidden:~/makebug$

And this time make considers files times correctly:

      Considering target file `makebug'.
        Considering target file `makebug.texi'.
         Finished prerequisites of target file `makebug.texi'.
        No need to remake target `makebug.texi'.
        Considering target file `version.texi'.
          Considering target file `stamp-vti'.
            Pruning file `makebug.texi'.
            Pruning file `../configure'.
           Finished prerequisites of target file `stamp-vti'.
           Prerequisite `makebug.texi' is older than target `stamp-vti'.
           Prerequisite `../configure' is older than target `stamp-vti'.
          No need to remake target `stamp-vti'.
         Finished prerequisites of target file `version.texi'.
         Prerequisite `stamp-vti' is older than target `version.texi'.
        No commands for `version.texi' and no prerequisites actually changed.
        No need to remake target `version.texi'.
       Finished prerequisites of target file `makebug'.
       Prerequisite `makebug.texi' is older than target `makebug'.
       Prerequisite `version.texi' is newer than target `makebug'.
      Must remake target `makebug'.

This time make considers files timing correctly.

Regards,
Guanpeng Xu
_________________________________________________________________
Explore the seven wonders of the world
http://search.msn.com/results.aspx?q=7+wonders+world&mkt=en-US&form=QBRE

Attachment: makebug.tar.gz
Description: application/tgz


reply via email to

[Prev in Thread] Current Thread [Next in Thread]