Skip to Main Content

Infrastructure Software

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

awk behavior difference between Solaris 9 and Solaris 10

807557Nov 30 2007 — edited Nov 30 2007
We have been compiling our application under Soalris using Sun Studio 11 with no problems. Part of the compilation process invokes a shell script that uses sed and awk to process a .h file and create a .cc file. As I said this works fine on Soalri9 w/ SS11. However, we are moving to Solaris 10 08/07. Sun Studio 12 and are building on a T2000. When I invoke the exact shell script, the resulting .cc file has not been created correctly and thus we end up with a compile error. Investigating this problem it appears to be an awk problem. I downloaded and installed patch 118815-06 but it made no difference.

Here is the Solaris 9 run:

kirk% (mscfixes) -> sed -n '/enum NodeType/,/};/p' SysCmnId.h > xyz
kirk% (mscfixes) -> cat xyz
enum NodeType
{
NO_TYPE = 0, // not defined, invalid
MSF = 1, // Multi-services Fabric
MSC = 2, // Multi-services Controller
DLC = 3,
ESWITCH = 4, // Ethernet switch
V5IF = 5,
LAG = 6,
MAX_TYPE // used for verification; keep as last in list
};
kirk% (mscfixes) -> awk -F' ' '/[[:space:]][A-Z][A-Z]/{
printf " if (!strcmp (pType, \"%s\"))\n", $1;
printf " return SysCmnId::%s;\n", $1;
}' xyz
if (!strcmp (pType, "NO_TYPE"))
return SysCmnId::NO_TYPE;
if (!strcmp (pType, "MSF"))
return SysCmnId::MSF;
if (!strcmp (pType, "MSC"))
return SysCmnId::MSC;
if (!strcmp (pType, "DLC"))
return SysCmnId::DLC;
if (!strcmp (pType, "ESWITCH"))
return SysCmnId::ESWITCH;
if (!strcmp (pType, "LAG"))
return SysCmnId::LAG;
if (!strcmp (pType, "MAX_TYPE"))
return SysCmnId::MAX_TYPE;
kirk% (mscfixes) ->

As you can see the output from awk if perfectly compilable code.

Here is the same run on a Solaris 10 system:

chekov% (mscfixes) -> sed -n '/enum NodeType/,/};/p' SysCmnId.h > xyz
chekov% (mscfixes) -> cat xyz
enum NodeType
{
NO_TYPE = 0, // not defined, invalid
MSF = 1, // Multi-services Fabric
MSC = 2, // Multi-services Controller
DLC = 3,
ESWITCH = 4, // Ethernet switch
V5IF = 5,
LAG = 6,
MAX_TYPE // used for verification; keep as last in list
};
chekov% (mscfixes) -> awk -F' ' '/[[:space:]][A-Z][A-Z]/{
quote> printf " if (!strcmp (pType, \"%s\"))\n", $1;
quote> printf " return SysCmnId::%s;\n", $1;
quote> }' xyz
if (!strcmp (pType, "enum"))
return SysCmnId::enum;
if (!strcmp (pType, "NO_TYPE"))
return SysCmnId::NO_TYPE;
if (!strcmp (pType, "MSF"))
return SysCmnId::MSF;
if (!strcmp (pType, "MSC"))
return SysCmnId::MSC;
if (!strcmp (pType, "DLC"))
return SysCmnId::DLC;
if (!strcmp (pType, "ESWITCH"))
return SysCmnId::ESWITCH;
if (!strcmp (pType, "LAG"))
return SysCmnId::LAG;
if (!strcmp (pType, "MAX_TYPE"))
return SysCmnId::MAX_TYPE;
chekov% (mscfixes) ->

As you can see on the S10 system, awk has picked and put into the output:

if (!strcmp (pType, "enum"))
return SysCmnId::enum;

Which, obviously, won't compile.

The questions is (sorry it is so long) there something different with awk for S10? This uses the awk in:
chekov% (mscfixes) -> whence awk
/usr/xpg4/bin/awk

Same awk is used on S9. Thier cksums are different. I have tried using the awk in /usrbin and I get NO output at all!

Can someone give me a clue as to what might be going on?

Thanks,
Doug
doug.jones@genband.com
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 28 2007
Added on Nov 30 2007
2 comments
384 views