LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 07-22-2011, 08:05 AM   #1
adb101
LQ Newbie
 
Registered: Jul 2011
Posts: 6

Rep: Reputation: Disabled
ksh-20100202-1.el5 integer typeset issue


Hi

I've got a problem with a shell script under Red Hat Enterprise Linux 5. Essentially it is to so with the max integer length that typeset -i can cope with. The script has worked fine in the past but with ksh-20100202-1 the max integer is massively smaller than before.

For example:

[root@linux1 ~]# rpm -qa | grep ksh
ksh-20060214-1.4
[root@linux1 ~]# ksh
# typeset -i a=1234567890123456789
# echo $a
1234567890123456789

[root@linux9 tmp]# rpm -qa | grep ksh
ksh-20100202-1.el5
[root@linux9 tmp]# ksh
# typeset -i a=1234567890123456789
# echo $a
2112454933

The max size for ksh-20100202-1.el5 is 2147483647 (which matches the INT_MAX parameter):

#rpm -qa | grep ksh
ksh-20100202-1.el5
# getconf INT_MAX
2147483647
# typeset -i a=2147483647
# echo $a
2147483647
# set -o vi
# typeset -i a=2147483648
# echo $a
-2147483648

However on ksh-20060214-1.4:
[root@linux1 ~]# rpm -qa | grep ksh
ksh-20060214-1.4
[root@linux1 ~]# ksh
# typeset -i a=2147483647
# echo $a
2147483647
# set -o vi
# typeset -i a=2147483648
# echo $a
2147483648

Anyone have any ideas why this has changed? I copied the ksh-20060214-1.4 version of ksh onto the other server and it runs fine which suggests its the way ksh-20100202-1.el5 has been compiled rather than an environmental issue.

Anyway of forcing ksh to accept a larger max int value?

Thanks
 
Old 07-29-2011, 08:21 AM   #2
adb101
LQ Newbie
 
Registered: Jul 2011
Posts: 6

Original Poster
Rep: Reputation: Disabled
Hi,

In case anyone's interested I've got an update back from OEL support regarding this issue:

"I made some tests, seems the behavior of "typeset -i" changed between ksh-2006 and ksh-2008.

In ksh-2006, the variable value setting by "typeset -i" could reach to "long" not the "int".

The behavior changed between ksh-20060214-1.7 and ksh-20080202-2.

# getconf -a|grep LONG
LONG_BIT 64
ULONG_MAX 18446744073709551615

# bc
bc 1.06
Copyright 1991-1994, 1997, 1998, 2000 Free Software Foundation, Inc.
This is free software with ABSOLUTELY NO WARRANTY.
For details type `warranty'.
18446744073709551615/2
9223372036854775807
quit

# rpm -q ksh
ksh-20060214-1.7

# ksh
# typeset -i a=9223372036854775807
# echo $a
9223372036854775807
# typeset -i a=9223372036854775808
# echo $a
-9223372036854775808

Although the changelog does not show anything between ksh-2006 and ksh-2008, but I assume/believe it is a bug in ksh-2006 and has been fixed in ksh-2008 and later."

Looks like I'm going to have to do some recoding!

 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Binary compatibility issue between RH EL4 and RH EL5 (SIGFPE: Floating Point Exceptio karhel Red Hat 19 06-30-2014 07:21 AM
ksh typeset bug? vgoel Programming 2 12-19-2010 06:16 PM
Mail server issue : Linux EL5 amaldev_1986 Linux - Newbie 1 04-23-2009 05:00 PM
ksh typeset problem sefaklc Programming 7 08-28-2007 11:37 PM
typeset issues in ksh talalrabbani Linux - Distributions 0 09-23-2005 12:13 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 06:07 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration