awk/gawk arithmetic problem

I use a simple inline awk script to extract the numbers from a file to
build a proper RELEASE code (this is in a Makefile). The following
simplified sample shows that 6.3.0 awk/gawk has a problem with the %
operator - sometimes.

awk ‘END {v=int(1001012);printf “%d.%d.%d-%d\n”, v/1000000,
(v/1000)%1000, v%1000, v}’ version.c

version.c is any file .

The result shows 1.1.11-1001012. Changing the number shows the simple %
operator always results in the proper value -1. All previous flavours
of 6.2.x work OK.

My interim workaround is to use the 6.2.x awk.

Further information :-

awk/gawk is not at fault! I brought the 6.2.1 version into 6.3 and it
was also faulty. I then hacked the executable to force load a local
libc.so.2 that I copied from 6.2.1 (instead of /usr/lib/ldqnx.so.2) and
it worked. Likewise, patching the 6.3.0 gawk to use the local library
also worked.

I then copied /lib/libc.so.2 into the local directory
(LD_LIBRARY_PATH=.:…) and the hacked programs failed.

The appearance is that something is wrong with libc.so.2 / gawk. A
quickie ‘C’ program does not show any problem.

Warren Deitch wrote:

I use a simple inline awk script to extract the numbers from a file to
build a proper RELEASE code (this is in a Makefile). The following
simplified sample shows that 6.3.0 awk/gawk has a problem with the %
operator - sometimes.

awk ‘END {v=int(1001012);printf “%d.%d.%d-%d\n”, v/1000000,
(v/1000)%1000, v%1000, v}’ version.c

version.c is any file .

The result shows 1.1.11-1001012. Changing the number shows the simple %
operator always results in the proper value -1. All previous flavours
of 6.2.x work OK.

My interim workaround is to use the 6.2.x awk.

Warren Deitch wrote:

I use a simple inline awk script to extract the numbers from a file to
build a proper RELEASE code (this is in a Makefile). The following
simplified sample shows that 6.3.0 awk/gawk has a problem with the %
operator - sometimes.

awk ‘END {v=int(1001012);printf “%d.%d.%d-%d\n”, v/1000000,
(v/1000)%1000, v%1000, v}’ version.c

version.c is any file .

The result shows 1.1.11-1001012. Changing the number shows the simple %
operator always results in the proper value -1. All previous flavours
of 6.2.x work OK.

My interim workaround is to use the 6.2.x awk.

Curiously, this seems to work for any value up to 999, but fails for
v%1000. I’ll open a problem report against this bug.


Cheers,
-Barry

Just wanted to let you know someone’s looking into this…

Warren Deitch wrote:

I use a simple inline awk script to extract the numbers from a file to
build a proper RELEASE code (this is in a Makefile). The following
simplified sample shows that 6.3.0 awk/gawk has a problem with the %
operator - sometimes.

awk ‘END {v=int(1001012);printf “%d.%d.%d-%d\n”, v/1000000,
(v/1000)%1000, v%1000, v}’ version.c

version.c is any file .

The result shows 1.1.11-1001012. Changing the number shows the simple %
operator always results in the proper value -1. All previous flavours
of 6.2.x work OK.

My interim workaround is to use the 6.2.x awk.


cburgess@qnx.com

Thank you!

Barry wrote:

Warren Deitch wrote:

I use a simple inline awk script to extract the numbers from a file to
build a proper RELEASE code (this is in a Makefile). The following
simplified sample shows that 6.3.0 awk/gawk has a problem with the %
operator - sometimes.

awk ‘END {v=int(1001012);printf “%d.%d.%d-%d\n”, v/1000000,
(v/1000)%1000, v%1000, v}’ version.c

version.c is any file .

The result shows 1.1.11-1001012. Changing the number shows the simple
% operator always results in the proper value -1. All previous
flavours of 6.2.x work OK.

My interim workaround is to use the 6.2.x awk.


Curiously, this seems to work for any value up to 999, but fails for
v%1000. I’ll open a problem report against this bug.


Cheers,
-Barry

Has this been resolved yet ?


Warren Deitch wrote:

Thank you!

Barry wrote:

Warren Deitch wrote:

I use a simple inline awk script to extract the numbers from a file
to build a proper RELEASE code (this is in a Makefile). The
following simplified sample shows that 6.3.0 awk/gawk has a problem
with the % operator - sometimes.

awk ‘END {v=int(1001012);printf “%d.%d.%d-%d\n”, v/1000000,
(v/1000)%1000, v%1000, v}’ version.c

version.c is any file .

The result shows 1.1.11-1001012. Changing the number shows the
simple % operator always results in the proper value -1. All
previous flavours of 6.2.x work OK.

My interim workaround is to use the 6.2.x awk.


Curiously, this seems to work for any value up to 999, but fails for
v%1000. I’ll open a problem report against this bug.


Cheers,
-Barry

Has this been fixed in SP1 ??


Warren Deitch wrote:

Has this been resolved yet ?


Warren Deitch wrote:

Thank you!

Barry wrote:

Warren Deitch wrote:

I use a simple inline awk script to extract the numbers from a file
to build a proper RELEASE code (this is in a Makefile). The
following simplified sample shows that 6.3.0 awk/gawk has a problem
with the % operator - sometimes.

awk ‘END {v=int(1001012);printf “%d.%d.%d-%d\n”, v/1000000,
(v/1000)%1000, v%1000, v}’ version.c

version.c is any file .

The result shows 1.1.11-1001012. Changing the number shows the
simple % operator always results in the proper value -1. All
previous flavours of 6.2.x work OK.

My interim workaround is to use the 6.2.x awk.


Curiously, this seems to work for any value up to 999, but fails for
v%1000. I’ll open a problem report against this bug.


Cheers,
-Barry

I loaded SP1 over the weekend and NO this bug has not been fixed. It
means that I must retain a computer with 6.2.1 just to do release
compiles!! (SP1 has a much bigger BUG list - more when I get time to
document this – I am using 6.2.1 to send this because mozilla under
6.3.1 is also broken and uninstalling back to 6.3.0 did not fix the
problem!)

Warren Deitch wrote:

Has this been fixed in SP1 ??


Warren Deitch wrote:

Has this been resolved yet ?


Warren Deitch wrote:

Thank you!

Barry wrote:

Warren Deitch wrote:

I use a simple inline awk script to extract the numbers from a file
to build a proper RELEASE code (this is in a Makefile). The
following simplified sample shows that 6.3.0 awk/gawk has a problem
with the % operator - sometimes.

awk ‘END {v=int(1001012);printf “%d.%d.%d-%d\n”, v/1000000,
(v/1000)%1000, v%1000, v}’ version.c

version.c is any file .

The result shows 1.1.11-1001012. Changing the number shows the
simple % operator always results in the proper value -1. All
previous flavours of 6.2.x work OK.

My interim workaround is to use the 6.2.x awk.


Curiously, this seems to work for any value up to 999, but fails for
v%1000. I’ll open a problem report against this bug.


Cheers,
-Barry
\

http://www.qnxzone.com/~amardare/mozilla/1.7/



Evan

Thank you !! I am downloading it now.

Evan Hillas wrote:

http://www.qnxzone.com/~amardare/mozilla/1.7/



Evan