bugmake - Bugs: bug #15341, make: the "-W...

 
 

bug #15341: make: the "-W <file>" option used with VPATH does not work correctly

Submitter:  Manoj Srivastava <srivasta>
Submitted:  Sat 31 Dec 2005 04:00:34 PM UTC
   
 
Severity:  3 - Normal Item Group:  None
Status:  Fixed Privacy:  Public
Assigned to:  psmith Open/Closed:  Closed
Component Version:  None Operating System:  None
Fixed Release:  3.81 Triage Status:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Mon 06 Feb 2006 04:17:43 PM UTC, comment #1: 

Hm.  This is a tricky problem, and exposes the weakness of the current vpath/VPATH rename solution.  The vpath search does check the internal database and so it does find the internal version of b-dir/b, which was set to be "infinitely newer" with the -W option.  However, by the time it gets to this point it's beyond the "normal" place that it would have detected this situation, and after it finds the file it runs stat() on it and overwrites the "infinitely newer" marker with the actual timestamp, and so does not think b-dir/b is newer any longer.

I've added some checks into the code to avoid this and it works but really, it feels hacky.  I wonder if the entire handling of -o/-W needs a look.

Anyway, it's fixed.

Paul D. Smith <psmith>
Group administrator
Sat 31 Dec 2005 04:00:34 PM UTC, original submission:  

[Please retain the CC to -email is unavailable- so that the Debian Bug Tracking system can record your input]

This has been reported by a debian user.

There seems to be a strange interaction with the "-W <file>" option when it is used in conjunction with the VPATH feature of make.

Firstly, here is an excerpt from the make info manual,

    `-W FILE'
    `--what-if=FILE'
    `--new-file=FILE'
    `--assume-new=FILE'

    Pretend that the target FILE has just been modified.  When    used with the `-n' flag, this shows you what would happen if you were to modify that file.  Without `-n', it is almost the same as running a `touch' command on the given file before running `make', except that the modification time is changed only in the imagination of `make'.

Now, an annotated typescript that demonstrates the problem,

1. !139, 140, 141, 142 - here is the situation, "a" depends on "b", however, "b" only exists as "./b-dir/b", while "a" exists only in the directory from which make is being run.  As you can see, "a" is up to date.

  139 jeff /tmp $ echo .{,/b-dir}/{a,b}
  ./a ./b ./b-dir/a ./b-dir/b

  140 jeff /tmp $ ls -l .{,/b-dir}/{a,b}
ls: ./b: No such file or directory
ls: ./b-dir/a: No such file or directory
-rw-rw-r--    1 jeff     root            0 Aug  3 14:29 ./a
-rw-rw-r--    1 jeff     root            0 Aug  3 14:29 ./b-dir/b
    --> exit status 1

  141 jeff /tmp $ printf '%b' 'a: b\n\tcp $(<) $(@)\n'
  a: b
          cp $(<) $(@)
  142 jeff /tmp $ printf '%b' 'a: b\n\tcp $(<) $(@)\n' | make -f\
       /dev/stdin  VPATH=b-dir
  make: `a' is up to date.

2. !143, 144, 145 - I maintain that make should behave identically at both !143 and !144-145, ie, at !143, "a" should have been re-made.

 143 jeff /tmp $ printf '%b' 'a: b\n\tcp $(<) $(@)\n' | make -f \
     /dev/stdin  VPATH=b-dir -W ./b-dir/b
  make: `a' is up to date.

  144 jeff /tmp $ touch ./b-dir/b

 145 jeff /tmp $ printf '%b' 'a: b\n\tcp $(<) $(@)\n' | make -f \
     /dev/stdin  VPATH=b-dir
   cp b-dir/b a

3. !146, 147, 148 - here make behaves correctly at !146 and !147, however, the behavior at !148 is problematic, IMO.  Since VPATH is in effect, make should pretend that the first "b" that it finds in the VPATH has just been modified, instead make ignores VPATH entirely, and considers "b", ie, "./b" as the prerequisite for "a".

   One could argue here that "-W b" means "-W ./b", thus make is behaving correctly at !148, however, such an interpretation makes it very difficult to use "-W <file>" along with VPATH and forces the user to know exactly where VPATH would have found <pathname-to-file> in order for her to specify it as "-W <pathname-to-file>".

 146 jeff /tmp $ printf '%b' 'a: b\n\tcp $(<) $(@)\n' | make -f \
    /dev/stdin  VPATH=b-dir
  make: `a' is up to date.

 147 jeff /tmp $ printf '%b' 'a: b\n\tcp $(<) $(@)\n' | make -f \
   /dev/stdin  VPATH=b-dir -W ./b
   cp b a
   cp: cannot stat `b': No such file or directory
   make: * [a] Error 1
    --> exit status 2

 148 jeff /tmp $ printf '%b' 'a: b\n\tcp $(<) $(@)\n' | make -f \
     /dev/stdin  VPATH=b-dir -W b
    cp b a
    cp: cannot stat `b': No such file or directory
    make: * [a] Error 1
    --> exit status 2



Manoj Srivastava <srivasta>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by psmith
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 6 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2006-04-01 psmith Fixed Release4.0 3.81
    2006-02-06 psmith StatusNone Fixed
        Assigned toNone psmith
        Open/ClosedOpen Closed
        Fixed ReleaseNone 4.0
    2006-01-03 psmith Carbon-Copy- Added -email is unavailable-

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code