 |
≫ |
|
|
 |
パッチ名: PHCO_36161
パッチ摘要: s700_800 11.11 awk(1)パッチ
作成日: 07/07/26
公開日: 07/08/03
ハードウェアプラットフォームおよびOSリリース:
s700: 11.11
s800: 11.11
現象:
PHCO_36161:
1.(SR:8606478090 CR:JAGag32417)
200文字より長いコメント行を検出すると、awk(1)スクリプトがコアダンプを
取ります。
2.(SR:8606454418 CR:JAGag11066)
UNIX95モードの場合、awk(1)が非整数値を正しく表示しません。
問題点の説明:
PHCO_36161:
1.(SR:8606478090 CR:JAGag32417)
コメントの長さが200文字を超えていると、awk(1)スクリプトが、コアダンプ
を取るか、または、エラーメッセージを表示して終了していました。
問題の再現手順:
#cat file
function hugo()
{
printf("Hello\n");
}
BEGIN {
hugo();
}
#12345678901234567890123456789012345678901234567890123456789
012345678901234567890123456789012345678901234567890123456789
012345678901234567890123456789012345678901234567890123456789
012345678901234567890123456789012345678901234567890123456789
01234567890123456789012345678901234567890
# awk -f file
awk: Cannot make an assignment to . It is a function.
The source line number is 7.
または
# awk -f file
Memory fault(coredump)
解決方法:
この問題を解決するようにawk(1)を修正しました。
これで、上記のawk(1)スクリプトは次のように正しい出力を表示します。
$ awk -f file1
Hello
2.(SR:8606454418 CR:JAGag11066)
UNIX95仕様によると、整数値と等しい数値の場合、awk(1)は内部変換フォーマ
ットとして%dを使用しなければなりません。その他の数値の場合は、fmt引き
数として変数CONVFMTの値を使って文字列に変換する必要があります。ところ
が、次のような問題が起きていました。
$ print 2147483648 | UNIX95=1 awk '{ print $1-0 }'
出力: 2147483647 (これは不正な出力です)
変換する数値が整数でない(INT_MAXより大きい)場合でも、書式指定子として
%dを使用していました。
解決方法:
UNIX95標準に準拠するようにawk(1)を修正しました。
これで、上記の例の場合、次のように正しい出力が表示されます。
$ print 2147483648 | UNIX95=1 awk '{ print $1-0 }'
2.14748e+09
-----------------------------------------------------------------------------
Patch Name: PHCO_36161
Patch Description: s700_800 11.11 awk(1) patch
Creation Date: 07/07/26
Post Date: 07/08/03
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:
Yes
PHCO_36161: ABORT
PHCO_29952: MEMORY_LEAK
Category Tags:
defect_repair general_release critical halts_system
memory_leak
Path Name: /hp-ux_patches/s700_800/11.X/PHCO_36161
Symptoms:
PHCO_36161:
( SR:8606478090 CR:JAGag32417 )
awk(1) script dumps core when encountering an comment line
of length > 200 characters.
( SR:8606454418 CR:JAGag11066 )
The behaviour of awk(1) under UNIX95 mode when printing
non-integers is wrong.
PHCO_33916:
( SR:8606413258 CR:JAGaf73119 )
awk(1) doesn't recognize invalid assignment arguments on the
command line as file names.
PHCO_29952:
( SR:8606352471 CR:JAGaf13276 )
Memory leak in awk(1) when calling in-built
functions.
( SR:8606335553 CR:JAGae96607 )
awk(1) does not place full path in ARGV[0] when
executing as /usr/bin/awk under UNIX95.
PHCO_27559:
( SR:8606268592 CR:JAGae32830 ) Duplicate
( SR:8606276719 CR:JAGae40794 )
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.
( SR:8606257112 CR:JAGae21422 )
In multibyte environment awk(1) recognizes some extra
characters in conjunction with blank, tab and newline as
default field separators.
( SR:8606212881 CR:JAGad82068 )
awk(1) doesn't recognize numbers with leading blanks in
relational operations.
Defect Description:
PHCO_36161:
( SR:8606478090 CR:JAGag32417 )
awk(1) script core dumps if the comment length is > 200
characters. Sometimes it core dumps and sometimes it exits
with an error message.
Problem Reproduction:
#cat file
function hugo()
{
printf("Hello\n");
}
BEGIN {
hugo();
}
#12345678901234567890123456789012345678901234567890123456789
012345678901234567890123456789012345678901234567890123456789
012345678901234567890123456789012345678901234567890123456789
012345678901234567890123456789012345678901234567890123456789
01234567890123456789012345678901234567890
# awk -f file
awk: Cannot make an assignment to . It is a function.
The source line number is 7.
Or
# awk -f file
Memory fault(coredump)
Resolution:
awk(1) has been modified to fix the issue.
The above awk(1) script gives the following output with the
fix:
$ awk -f file1
Hello
( SR:8606454418 CR:JAGag11066 )
According to UNIX95 specification, awk(1) should use %d as
the internal conversion format for a numeric value that is
exactly equal to the value of an integer. Any other numeric
value should be converted to a string with the value of the
variable CONVFMT as the fmt argument. The defect can be
seen as:
$ print 2147483648 | UNIX95=1 awk '{ print $1-0 }'
O/p : 2147483647 (This is wrong o/p)
Here %d is used as the format specifier even if the number
to be converted is non-integer (greater than INT_MAX).
Resolution:
awk(1) is modified to comply with the UNIX95 standards.
The above example gives the following output with fix:
$ print 2147483648 | UNIX95=1 awk '{ print $1-0 }'
2.14748e+09
PHCO_33916:
( SR:8606413258 CR:JAGaf73119 )
According to UNIX95 specification, awk(1) should consider
invalid assignment arguments as filenames.The defect can be
seen when awk(1) command is run as follows:
awk '{print $0}' 1x=y =x inputfile
When the UNIX95 environment variable is set, the arguments
"1x=y" and "=x" in the above command shouldn't be resolved
as assignments.
Resolution:
awk(1) has been modified to comply with the
unix95 standards.
PHCO_29952:
( SR:8606352471 CR:JAGaf13276 )
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.
( SR:8606335553 CR:JAGae96607 )
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_27559:
( SR:8606268592 CR:JAGae32830 ) Duplicate
( SR:8606276719 CR:JAGae40794 )
awk(1) can generate incorrect error messages due to improper
internal memory management.
Resolution:
For proper internal memory management in awk(1), a new
variable has been introduced to differentiate between active
and unused (free) memory nodes.
( SR:8606257112 CR:JAGae21422 )
awk(1) documentation says that default field separators are
blank, tab and newline. But for multibyte locale awk(1)
recognizes other characters too as field separator.
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 <space> set
as field separator set. Instead of this, changes have been
made to check <blank> set (containing blank,\t and alternate
blank characters) and newline character.
( SR:8606212881 CR:JAGad82068 )
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.
Enhancement:
No
SR:
8606478090 8606454418 8606413258 8606212881 8606257112
8606268592 8606276719 8606335553 8606352471
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/awk.1
OS-Core.UX-CORE,fr=B.11.11,fa=HP-UX_B.11.11_32/64,v=HP:
/sbin/awk
/usr/bin/awk
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/awk.1:
None
OS-Core.UX-CORE,fr=B.11.11,fa=HP-UX_B.11.11_32/64,v=HP:
/sbin/awk:
main.c $Date: 2004/12/05 21:30:07 $Revision: r11.11/
2 PATCH_11.11 (PHCO_29952)
tran.c $Date: 2004/12/05 21:30:07 $Revision: r11.11/
3 PATCH_11.11 (PHCO_29952)
lib.c $Date: 2007/03/20 19:48:07 $Revision: r11.11/3
PATCH_11.11 (PHCO_36161)
run.c $Date: 2004/12/05 21:30:07 $Revision: r11.11/4
PATCH_11.11 (PHCO_29952)
$Revision: @(#) awk.sbin R11.11_BL2007_0726_2 PATCH
_11.11 PHCO_36161
$ Version_11.11 Jul 2 2007 07:58:40 $
/usr/bin/awk:
main.c $Date: 2004/12/05 21:30:07 $Revision: r11.11/
2 PATCH_11.11 (PHCO_29952)
tran.c $Date: 2004/12/05 21:30:07 $Revision: r11.11/
3 PATCH_11.11 (PHCO_29952)
lib.c $Date: 2007/03/20 19:48:07 $Revision: r11.11/3
PATCH_11.11 (PHCO_36161)
run.c $Date: 2004/12/05 21:30:07 $Revision: r11.11/4
PATCH_11.11 (PHCO_29952)
$Revision: @(#) awk R11.11_BL2007_0726_2 PATCH_11.1
1 PHCO_36161
cksum(1) Output:
OS-Core.CORE-ENG-A-MAN,fr=B.11.11,fa=HP-UX_B.11.11_32/64,
v=HP:
769476589 8943 /usr/share/man/man1.Z/awk.1
OS-Core.UX-CORE,fr=B.11.11,fa=HP-UX_B.11.11_32/64,v=HP:
3122232139 417792 /sbin/awk
2729331746 139264 /usr/bin/awk
Patch Conflicts: None
Patch Dependencies: None
Hardware Dependencies: None
Other Dependencies: None
Supersedes:
PHCO_33916 PHCO_29952 PHCO_27559
Equivalent Patches:
PHCO_36053:
s700: 11.23
s800: 11.23
Patch Package Size: 310 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_36161
5. Run swinstall to install the patch:
swinstall -x autoreboot=true -x patch_match_target=true \
-s /tmp/PHCO_36161.depot
By default swinstall will archive the original software in
/var/adm/sw/save/PHCO_36161. 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_36161.text file is
available in the product readme:
swlist -l product -a readme -d @ /tmp/PHCO_36161.depot
To put this patch on a magnetic tape and install from the
tape drive, use the command:
dd if=/tmp/PHCO_36161.depot of=/dev/rmt/0m bs=2k
Special Installation Instructions: None
|