timbertson / gup

A better make, inspired by djb's redo.
GNU Lesser General Public License v2.1
51 stars 5 forks source link

gup --leave emits warning #13

Open gkleen opened 6 years ago

gkleen commented 6 years ago

Should gup --leave really emit the x modified y directly-warning?

timbertson commented 6 years ago

Nope, it shouldn't

gkleen commented 6 years ago

With a file b (with arbitrary content) and a buildscript b.gup with content as follows:

#!/usr/bin/env zsh

gup --leave

I get the following behaviour:

$ gup b
gup b
gup  b.gup modified ./b directly
$ gup b
gup b
gup  b.gup modified ./b directly
timbertson commented 6 years ago

I looked into this today. The clobbering stuff is a bit of a weird heuristic to try and balance annoyance with usefulness. Also it uses the previous build's state, not the current build. It does already suppress the warning if the previous build clobbered the target, but only for an update (gup -u).

The idea is that you'll mostly run gup target for a target you're modifying/testing, most other builds of a clobbering target should come from gup -u. And the warning is most useful when you're working on the target, just in case you didn't mean to make it clobber the output.

So long story short: it would take a fair bit of code (and a slight performance impact) to make this always work correctly for --leave, and it already doesn't warn if you use gup --leave and you gup -u your target. So it's a bug, but it's at most a nuisance and it will only appear on a clean build if you use gup -u.