bugmake - Bugs: bug #63510, Confusing "update target...

 
 

bug #63510: Confusing "update target 'foo' due to: target does not exist" message

Submitter:  Patrick Oppenlander <pattop>
Submitted:  Sun 11 Dec 2022 10:40:04 PM UTC
   
 
Severity:  3 - Normal Item Group:  Enhancement
Status:  Fixed Privacy:  Public
Assigned to:  psmith Open/Closed:  Closed
Component Version:  None Operating System:  Any
Fixed Release:  4.4.1 Triage Status:  Small Effort
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Tue 20 Dec 2022 07:28:29 AM UTC, comment #6: 

Pushed.  Thanks for the report.

Paul D. Smith <psmith>
Group administrator
Sat 17 Dec 2022 11:40:06 PM UTC, comment #5: 

OK I have a complete fix.

Paul D. Smith <psmith>
Group administrator
Sat 17 Dec 2022 09:18:47 PM UTC, comment #4: 

That isn't good enough.  I'll look more closely.

Paul D. Smith <psmith>
Group administrator
Sat 17 Dec 2022 07:00:45 PM UTC, comment #3: 

Actually I probably should spell it out "target is .PHONY"

Paul D. Smith <psmith>
Group administrator
Sat 17 Dec 2022 06:59:39 PM UTC, comment #2: 

I'm not sure if there are other situations where this happens, besides PHONY, but I've applied this patch:

diff --git a/src/job.c b/src/job.c
index b78f279c..cdca7ce1 100644
--- a/src/job.c
+++ b/src/job.c
@@ -1893,7 +1893,6 @@ new_job (struct file *file)
      Use message here so that changes to working directories are logged.  */
   if (ISDB (DB_WHY))
     {
-      char *newer = allocated_variable_expand_for_file ("$?", c->file);
       const char *nm;

       if (! cmds->fileinfo.filenm)
@@ -1905,11 +1904,17 @@ new_job (struct file *file)
           nm = n;
         }

-      OSSS (message, 0,
-            _("%s: update target '%s' due to: %s"), nm, c->file->name,
-              newer[0] == '\0' ? _("target does not exist") : newer);
-
-      free (newer);
+      if (c->file->phony)
+        OSS (message, 0, _("%s: update target '%s' due to: target is phony"),
+             nm, c->file->name);
+      else
+        {
+          char *newer = allocated_variable_expand_for_file ("$?", c->file);
+          OSSS (message, 0,
+                _("%s: update target '%s' due to: %s"), nm, c->file->name,
+                newer[0] == '\0' ? _("target does not exist") : newer);
+          free (newer);
+        }
     }

   /* The job is now primed.  Start it running.


Now the output is:

Makefile:2: update target 'hello' due to: target is phony
touch hello


Paul D. Smith <psmith>
Group administrator
Mon 12 Dec 2022 04:32:46 AM UTC, comment #1: 

Here is a test case


$ ls hello
hello
$ cat makefile2
.PHONY: hello
hello:; touch $@
$ make -f makefile2 --trace
makefile2:2: update target 'hello' due to: target does not exist
touch hello


Dmitry Goncharov <dgoncharov>
Sun 11 Dec 2022 10:40:04 PM UTC, original submission:  

This came up as part of https://savannah.gnu.org/bugs/index.php?63484.

Sometimes when make decides to update a target it erroneously reports the reason as "target does not exist" even though the target exists.

Patrick Oppenlander <pattop>

 

(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 (Posted a comment)
  • -email is unavailable- added by dgoncharov (Posted a comment)
  • -email is unavailable- added by pattop (Submitted the item)
  •  

    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 7 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2022-12-20 psmith Item GroupNone Enhancement
        StatusNone Fixed
        Assigned toNone psmith
        Open/ClosedOpen Closed
        Operating SystemNone Any
        Fixed ReleaseNone 4.4.1
        Triage StatusNone Small Effort

    Back to the top

    Powered by Savane 3.13-caa5.
    Corresponding source code