Patch Name: PHCO_29895 Patch Description: s700_800 11.11 make(1) cumulative patch Creation Date: 04/03/04 Post Date: 04/04/23 Hardware Platforms - OS Releases: s700: 11.11 s800: 11.11 Products: N/A Filesets: OS-Core.CORE-ENG-A-MAN,fr=B.11.11,fa=HP-UX_B.11.11_32/64,v=HP OS-Core.UX-CORE,fr=B.11.11,fa=HP-UX_B.11.11_32/64,v=HP Automatic Reboot?: No Status: General Release Critical: No Category Tags: defect_repair general_release Path Name: /hp-ux_patches/s700_800/11.X/PHCO_29895 Symptoms: PHCO_29895: ( SR:8606346520 CR:JAGaf07344 ) make(1) sets the value of an environment variable with an unexpanded macro, when makefile contains a macro with the same name as an environment variable. ( SR:8606314324 CR:JAGae77099 ) Incorrect documentation in make(1) manpage. PHCO_27755: ( SR:8606274998 CR:JAGae39075 ) make(1) picks f77 as the default FORTRAN compiler as against f90. PHCO_27280: ( SR:8606238142 CR:JAGae07180 ) make(1) when used with -P option does not assign proper values to conditional macros. ( SR:8606238180 CR:JAGae07207 ) make(1) when used with -P to build large number of objects exits with "Cannot allocate memory" error message. ( SR:8606183215 CR:JAGad52429 ) make(1) does not build the target correctly when target is a symbolic link to a non existing file. Defect Description: PHCO_29895: ( SR:8606346520 CR:JAGaf07344 ) The problem can be reproduced as follows : 1. Define an environment variable, say, MYPATH. $ export MYPATH=/home/user1 2. Create a makefile with the contents mentioned below : $ cat makefile VAR=value1 MYPATH=${VAR} VAR=value2 output : env | grep MYPATH $ 3. Execute the makefile. $ make -f makefile 4. The output will be : env | grep MYPATH MYPATH=${VAR} $ Root Cause : When make(1) encounters a macro with the same name as that of an environment variable and -e (environment overrides macro) option is not specified, it sets the value of the environment variable, MYPATH to ${VAR}. Here, ${VAR} is interpreted without being expanded. Hence, the problem. Resolution: When makefile contains a macro with the same name as that of an environment variable and -e option is not specified, the environment variable is interpreted after expanding the value it is set to. ( SR:8606314324 CR:JAGae77099 ) Manpage of make(1) does not document the information regarding re-build of targets correctly. The information in the manpage was : "If no target names are specified on the command line, make updates the first target in the (first) makefile that is not an inference rule. A target is updated only if it depends on files that are newer than the target." Resolution: Now, the manpage is corrected to contain the necessary information : "If no target names are specified on the command line, make updates the first target in the (first) makefile that is not an inference rule. A target is updated in two cases: firstly, if it depends on files that are newer than the target; secondly, if it depends on files that have same modification time as that of the target." PHCO_27755: ( SR:8606274998 CR:JAGae39075 ) f77 FORTRAN compiler is not supported on HPUX 11.11, still make(1) picks f77 as the default FORTRAN compiler. This happens because make(1) looks into a rules file to check the default FORTRAN compiler.In the rules file f77 is defined as the default compiler.This causes make(1) to pick f77 as the default FORTRAN compiler. Resolution: The rules file has been changed to make f90 as the default FORTRAN compiler. PHCO_27280: ( SR:8606238142 CR:JAGae07180 ) When make(1) is invoked with -P option,the first PARALLEL (shell variable with default as 2) number of objects are built with correct values of conditional macros but rest of the objects are built with incorrect values of the conditional macro.The problem can be reproduced as: $ touch a.cbl b.cbl c.cbl d.cbl $ cat > Makefile << _EOF LES_DML= a.gnt b.gnt c.gnt d.gnt COBFLAGS=toto ${LES_DML}:=COBFLAGS=-C LINKCOUNT=32000 gnt : ${LES_DML} .SUFFIXES: .SUFFIXES: .gnt .cbl .pco .cbl.gnt: echo COBFLAGS=${COBFLAGS} $< "-->" $@ .pco.gnt: echo coucou $< "-->" $@ _EOF $ make -P Resolution: make(1) maintains a list of all the environment and shell variables. If an object has a conditional macro associated with it then those macros are prepended to the list and once the object is built the list is restored. In case of parallel make, when PARALLEL number of objects are built the list is restored causing the subsequent builds to fail. Now code is modified to prepend the list with the conditional macros before an object is scheduled and list is restored if the object is swapped out or build is completed. ( SR:8606238180 CR:JAGae07207 ) When there are large number of targets to be built then make -P fails giving "Cannot allocate memory". The problem can be reproduced using the following script. $ cat > script <<_SCR i=2 while [ $i -lt 1000 ] do echo f$i\(\){}> f$i.c i=`expr $i + 1` done cat > f1.c << _EOF main(){} _EOF mkmf make -P rm -rf f* M* _SCR $ ./script Resolution: In parallel make an object can be scheduled several times before being complete.make(1) allocates memory to hold the shell commands associated with the object each time that object is scheduled. This memory is not freed when the object is swapped out.Now the code is changed to allocate memory just before scheduling and it is freed once the object is swapped out or build is complete. ( SR:8606183215 CR:JAGad52429 ) When the target is a symbolic link to a non-existing file, make(1) doesn't build the target. The following example will demonstrate the problem: 1. Create makefile with following contents a:a.o a.o:a.c 2. Create source file a.c with the following contents. void main() {} 3. Create dummy links ln -s aa.o a.o ln -s aa a 4.Run make(1) as below $ make a.o It gives the message "`a.o' is up to date" instead of building aa.o to which a.o is a symbolic link. This happens because make(1) uses the timestamp of the symbolic link, to determine whether the target needs to be built or not. make(1) is supposed to use the timestamp of the file pointed to by the symbolic link. Resolution: make(1) was using lstat() that provides the timestamp of a symbolic link instead of the timestamp of the file that it points to. Because of this, make(1) is coming out with the message "symbolic name" upto date, instead of building the object that the symbolic link is pointing to. make(1) is modified to build the object to which the symbolic link is pointing. Enhancement: No SR: 8606183215 8606238142 8606238180 8606274998 8606314324 8606346520 Patch Files: OS-Core.CORE-ENG-A-MAN,fr=B.11.11,fa=HP-UX_B.11.11_32/64, v=HP: /usr/share/man/man1.Z/make.1 OS-Core.UX-CORE,fr=B.11.11,fa=HP-UX_B.11.11_32/64,v=HP: /usr/ccs/bin/make what(1) Output: OS-Core.CORE-ENG-A-MAN,fr=B.11.11,fa=HP-UX_B.11.11_32/64, v=HP: /usr/share/man/man1.Z/make.1: None OS-Core.UX-CORE,fr=B.11.11,fa=HP-UX_B.11.11_32/64,v=HP: /usr/ccs/bin/make: doname.c $Date: 2004/03/03 02:15:45 $Revision: r11.1 1/3 PATCH_11.11 (PHCO_29895) misc.c $Date: 2004/03/03 02:15:45 $Revision: r11.11/ 2 PATCH_11.11 (PHCO_29895) files.c $Date: 2002/07/02 08:54:21 $Revision: r11.11 /1 PATCH_11.11 (PHCO_27280) rules.c $Date: 2002/10/06 23:26:23 $Revision: r11.11 /2 PATCH_11.11 (PHCO_27755) dosys.c $Date: 2004/03/03 02:15:45 $Revision: r11.11 /2 PATCH_11.11 (PHCO_29895) $Revision: @(#) all R11.11_BL2004_0303_5 PATCH_11.11 PHCO_29895 Thu Mar 4 01:20:49 PST 2004 $ cksum(1) Output: OS-Core.CORE-ENG-A-MAN,fr=B.11.11,fa=HP-UX_B.11.11_32/64, v=HP: 3642123128 18051 /usr/share/man/man1.Z/make.1 OS-Core.UX-CORE,fr=B.11.11,fa=HP-UX_B.11.11_32/64,v=HP: 4112675188 90112 /usr/ccs/bin/make Patch Conflicts: None Patch Dependencies: None Hardware Dependencies: None Other Dependencies: None Supersedes: PHCO_27755 PHCO_27280 Equivalent Patches: None Patch Package Size: 90 KBytes Installation Instructions: Please review all instructions and the Hewlett-Packard SupportLine User Guide or your Hewlett-Packard support terms and conditions for precautions, scope of license, restrictions, and, limitation of liability and warranties, before installing this patch. ------------------------------------------------------------ 1. Back up your system before installing a patch. 2. Login as root. 3. Copy the patch to the /tmp directory. 4. Move to the /tmp directory and unshar the patch: cd /tmp sh PHCO_29895 5. Run swinstall to install the patch: swinstall -x autoreboot=true -x patch_match_target=true \ -s /tmp/PHCO_29895.depot By default swinstall will archive the original software in /var/adm/sw/save/PHCO_29895. If you do not wish to retain a copy of the original software, include the patch_save_files option in the swinstall command above: -x patch_save_files=false WARNING: If patch_save_files is false when a patch is installed, the patch cannot be deinstalled. Please be careful when using this feature. For future reference, the contents of the PHCO_29895.text file is available in the product readme: swlist -l product -a readme -d @ /tmp/PHCO_29895.depot To put this patch on a magnetic tape and install from the tape drive, use the command: dd if=/tmp/PHCO_29895.depot of=/dev/rmt/0m bs=2k Special Installation Instructions: None