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

 
 

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

Submitted by:  Manoj Srivastava <srivasta>
Submitted on:  Sat 31 Dec 2005 04:00:34 PM UTC  
 
Severity: 3 - NormalItem Group: None
Status: FixedPrivacy: Public
Assigned to: Paul D. Smith <psmith>Open/Closed: Closed
Component Version: NoneOperating System: None
Fixed Release: 3.81Triage Status: None

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

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>
Project AdministratorIn charge of this item.
Sat 31 Dec 2005 04:00:34 PM UTC, original submission:

[Please retain the CC to -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 File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

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

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 6 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Sat 01 Apr 2006 07:18:15 AM UTCpsmithFixed Release4.0=>3.81
    Mon 06 Feb 2006 04:17:43 PM UTCpsmithStatusNone=>Fixed
      Assigned toNone=>psmith
      Open/ClosedOpen=>Closed
      Fixed ReleaseNone=>4.0
    Tue 03 Jan 2006 05:02:22 AM UTCpsmithCarbon-Copy-=>Added -unavailable-

    Back to the top


    Powered by Savane 3.1-cleanup1