Patch Name: PHCO_30728 Patch Description: s700_800 11.00 awk(1) cumulative patch Creation Date: 04/04/14 Post Date: 04/05/17 Hardware Platforms - OS Releases: s700: 11.00 s800: 11.00 Products: N/A Filesets: OS-Core.CORE-ENG-A-MAN,fr=B.11.00,fa=HP-UX_B.11.00_32/64,v=HP OS-Core.UX-CORE,fr=B.11.00,fa=HP-UX_B.11.00_32/64,v=HP Automatic Reboot?: No Status: General Release Critical: Yes PHCO_30728: MEMORY_LEAK Category Tags: defect_repair general_release critical memory_leak Path Name: /hp-ux_patches/s700_800/11.X/PHCO_30728 Symptoms: PHCO_30728: 1. Memory leak in awk(1) when calling in-built functions. 2. awk(1) does not place full path in ARGV[0] when executing as /usr/bin/awk under UNIX95. PHCO_27521: 1.awk(1) reports incorrect error messages like "awk: xxxxxx cannot be used as an array" even if run on scripts that have proper array variables defined. 2.In multibyte environment awk(1) recognizes some extra characters in conjunction with blank, tab and newline as default field separators. 3.awk(1) doesn't recognize numbers with leading blanks in relational operations. PHCO_24285: 1.awk(1) incorrectly formats unsigned numbers. 2.awk(1) reports only integer results with modulo operator. 3.Concatenating null string does not force string comparison in awk(1). 4.Concatenating null string does not force type string of argument to awk(1) printf %c. 5.printf statement in awk(1) returns wrong results if an array with string subscript is passed in a for loop. 6.awk(1) dumps core if number of elements in an array is large. 7.awk(1) output field separator not inserted in output unless $0 is touched. Defect Description: PHCO_30728: 1.The allocated memory is not being freed by awk(1). This is observed when awk(1) calls toupper/tolower/substr/[s]printf() inbuilt functions. The memory allocated for the conversion of strings was not freed and hence resulted in memory leak. Resolution: The problem is resolved by freeing the allocated memory for the conversion of strings. 2. awk(1) keeps truncated pathname of the invoking process if the process was invoked with complete pathname. If awk(1) is invoked with path (relative or absolute), awk(1) stores truncated value in ARGV[0]. The path (relative or absolute) is removed and only 'awk' is stored in ARGV[0]. The defect can be reproduced by the following steps: $export UNIX95=1 $/usr/bin/awk 'BEGIN { print ARGV[0] ; exit }' awk The expected output is /usr/bin/awk. Resolution: The variable which stores the value is corrected to store the complete path name under UNIX95. PHCO_27521: 1.awk(1) can generate incorrect error messages due to improper internal memory management. Resolution: For proper memory management in awk(1), a new variable has been introduced to differentiate between active and unused (free) memory nodes. 2.awk(1) documentation says that default FS are blank, tab and newline. But for multibyte locale awk(1) recognizes other characters too as FS. Steps: $ export LANG=ja_JP.SJIS $ echo "This i\rs\tawk t\vest" | awk '{printf("%s/%s/%s/ %s\n",$1,$2,$3,$4);}' This/i/s/awk <=== This is wrong The output should be : s/awk/t est Resolution: For multibyte locale, awk(1) used to treat the set as FS set. Instead of this, changes have been made to check set (containing blank,\t and alternate blank characters) and newline character. 3.In case any of the operands in relational operation contain leading blanks, awk(1) performs string comparison. This is true even if the operand has a numeric value, after ignoring the leading and trailing blanks. Steps: $ export UNIX95=1 $ awk 'BEGIN {a=" 0.1";if(a>0.01){print "True"}else{print "False"}}' False <=== It should print "True" $ Resolution: Changes have been made to perform string comparisons only when both the operands are strings else if any of the operands is numeric, numeric comparison is carried out. This fix is required to conform to UNIX95 standards, hence it is available only when the UNIX95 flag is set. If UNIX95 flag is unset then awk will retain the earlier behavior. PHCO_24285: 1.awk(1) incorrectly formats unsigned numbers. Resolution: A new flag is added to take care of formatting unsigned numbers. 2.The % (modulo) operator gives integer result for decimal values. The problem was due to the typecasting of the output to an integer value. Resolution: Typecasting of the output is removed to solve the problem. 3.awk(1) used to ignore explicit stringizing operator from the input considering them as number. Because of this, strings like 006008E1"" got converted into corresponding float values. Resolution: Code is changed to do string comparison instead of numeric comparison when explicit stringizing operator is used in input. 4.awk(1) should recognize "" as a stringizing operator when given with the printf statements with %c formatter. Resolution: awk(1) is corrected to interpret the stringizing operator "" properly when included with the %c formatter. 5.awk(1) was converting the array subscript to "number" type, which was supposed to be processed as "string" type. Resolution: Code is changed to preserve the data type of the array subscript by setting a flag. While printing, this flag is checked to print the correct output. 6.awk(1) produces memory leak if number of elements in an array is large. The process grows until maxdsize is reached and awk(1) coredumps. Resolution: A call to free(2) is introduced to take care of this. 7.awk(1) output field separator not inserted in output unless $0 is touched. Resolution: The OFS is inserted in the output if construct like "$1=$1" is used and hence the problem is corrected. Enhancement: No SR: 8606352231 8606335428 8606268592 8606257112 8606212881 8606157561 8606127663 8606108449 5003400713 8606178380 5003455592 8606100812 1653298844 1653265835 1653232835 Patch Files: OS-Core.CORE-ENG-A-MAN,fr=B.11.00,fa=HP-UX_B.11.00_32/64, v=HP: /usr/share/man/man1.Z/awk.1 OS-Core.UX-CORE,fr=B.11.00,fa=HP-UX_B.11.00_32/64,v=HP: /usr/lib/nls/msg/C/awk.cat /sbin/awk /usr/bin/awk what(1) Output: OS-Core.CORE-ENG-A-MAN,fr=B.11.00,fa=HP-UX_B.11.00_32/64, v=HP: /usr/share/man/man1.Z/awk.1: None OS-Core.UX-CORE,fr=B.11.00,fa=HP-UX_B.11.00_32/64,v=HP: /usr/lib/nls/msg/C/awk.cat: None OS-Core.UX-CORE,fr=B.11.00,fa=HP-UX_B.11.00_32/64,v=HP: /sbin/awk: $Revision: 82.2.1.17 $ $ PATCH/11.00:PHCO_19491 Aug 9 1999 09:49:32 $ PATCH_11_00: awk.g_s.o awk.lx_s.o b_s.o main_s.o tra n_s.o lib_s.o run_s.o parse_s.o proctab_s.o hpux_rel_s.o 04/04/14 OS-Core.UX-CORE,fr=B.11.00,fa=HP-UX_B.11.00_32/64,v=HP: /usr/bin/awk: $Revision: 82.2.1.17 $ PATCH_11_00: awk.g.o awk.lx.o b.o main.o tran.o lib. o run.o parse.o proctab.o hpux_rel.o 04/04/1 4 cksum(1) Output: OS-Core.CORE-ENG-A-MAN,fr=B.11.00,fa=HP-UX_B.11.00_32/64, v=HP: 4204420571 8889 /usr/share/man/man1.Z/awk.1 OS-Core.UX-CORE,fr=B.11.00,fa=HP-UX_B.11.00_32/64,v=HP: 536183147 7578 /usr/lib/nls/msg/C/awk.cat OS-Core.UX-CORE,fr=B.11.00,fa=HP-UX_B.11.00_32/64,v=HP: 2665758479 413696 /sbin/awk OS-Core.UX-CORE,fr=B.11.00,fa=HP-UX_B.11.00_32/64,v=HP: 380806642 143360 /usr/bin/awk Patch Conflicts: None Patch Dependencies: None Hardware Dependencies: None Other Dependencies: None Supersedes: PHCO_24285 PHCO_27521 Equivalent Patches: None Patch Package Size: 300 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_30728 5. Run swinstall to install the patch: swinstall -x autoreboot=true -x patch_match_target=true \ -s /tmp/PHCO_30728.depot By default swinstall will archive the original software in /var/adm/sw/save/PHCO_30728. 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_30728.text file is available in the product readme: swlist -l product -a readme -d @ /tmp/PHCO_30728.depot To put this patch on a magnetic tape and install from the tape drive, use the command: dd if=/tmp/PHCO_30728.depot of=/dev/rmt/0m bs=2k Special Installation Instructions: None