[bug #62324] Fix cache integrity check

2022-04-16 Thread Dmitry Goncharov
Additional Item Attachment, bug #62324 (project make):

File name: sv62324_test.diff  Size:2 KB


File name: sv62324_fix.diff   Size:4 KB




___

Reply to this item at:

  

___
  Message sent via Savannah
  https://savannah.gnu.org/




[bug #62324] Fix cache integrity check

2022-04-16 Thread Dmitry Goncharov
URL:
  

 Summary: Fix cache integrity check
 Project: make
Submitted by: dgoncharov
Submitted on: Sat 16 Apr 2022 05:59:23 PM UTC
Severity: 3 - Normal
  Item Group: Bug
  Status: None
 Privacy: Public
 Assigned to: None
 Open/Closed: Open
 Discussion Lock: Any
   Component Version: SCM
Operating System: None
   Fixed Release: None
   Triage Status: None

___

Details:


.SECONDEXPANSION:
all: bye.x
%.x: $$(firstword %.1;



The makefile presented above causes make to fail integrity self check 
   
with the following message
   
  
   
make: *** unterminated call to function 'firstword': missing ')'.  Stop.  
   
make: bye.x: Field 'stem' not cached: bye

This "'stem' not cached" failure happens, because in pattern_search file->stem
is temporarily set to a value for the sake of set_file_variables and reset
afterwords.  However, before file->stem can be reset variable_expand_for_file
is called and it bumps to the syntax error and causes make to perform
integrity self check before exiting. The integrity check fails, because the
stem in question was never cached.
   

This fix adds a dedicated stem parameter to set_file_variables to relieve the
callers from having to modify and then restore file->stem.
  


src/commands.c (set_file_variables): Take second parameter stem to relieve the
callers of set_file_variables from setting and restoring file->stem.
src/commands.h (set_file_variables): Ditto.
(execute_file_commands): Pass file->stem to set_file_variables.   
   
src/file.c (expand_deps): Pass d->stem to set_file_variables and remove no
longer needed code to set and restore file->stem.
src/implicit.c (pattern_search): Pass stem_str to set_file_variables and
remove no longer needed code to set and reset file->stem.
tests/scripts/features/se_explicit: Add new tests.
tests/scripts/features/se_implicit: Ditto.
tests/scripts/features/se_statpat: Ditto.
tests/scripts/variables/automatic: Ditto.




___

Reply to this item at:

  

___
  Message sent via Savannah
  https://savannah.gnu.org/