LiveCD/4.5/BTS/4410
をテンプレートにして作成
Start:
* negative mfs size at large memory
- ページ: [[LiveCD/4.5/BTS]]
- 投稿者: [[kaw]]
- 優先順位: 低
- 状態: 完了
- カテゴリー: malfunction
- 投稿日: 2009-02-26 (木) 09:03:35
- バージョン:
** メッセージ
more than 2^31 bytes are displayed as negative value. ~
Because ksh can handle integer range of -2^31 ... 2^31-1
On ksh, this is like this;
$ echo $((2147483647)) # 2^31-1
2147483647
$ echo $((2147483647+1)) # 2^31
-2147483648
Here's a concept code to check two strings representing b...
#!/bin/ksh
function isgreater {
# check presence of arguments
#
[ $# -lt 2 ] && return -- -1
x=$1
y=$2
# Are arguments both form of positive integer?
#
case "$x" in
0|[1-9]*([0-9])) : ;; # ok, do nothing
*) return -- -2 ;; # ng, string is...
esac
case "$y" in
0|[1-9]*([0-9])) : ;; # ok, do nothing
*) return -- -2 ;; # ng, string is...
esac
# Compare it
#
if [ ${#x} -gt ${#y} ]; then
return 0
elif [ ${#x} -eq ${#y} ]; then
if [ $x \> $y ]; then # string compare (not docu...
return 0
else
return 1
fi
else
return 1
fi
}
isgreater $1 $2
case $? in
0) echo $1 is greater than $2. ;;
1) echo $1 is NOT greater than $2. ;;
*) echo argument format error ;;
esac
Note
-This is needed by very early stage of boot time, so only...
-This is ksh-specific code.
----
- FIXED: above coding were introduced to /boottmp/rc at F...
- ENBUG: -gt must be replaced with > in function isgreater
- FIXED - 2009-05-19 (火) 12:00:30
End:
* negative mfs size at large memory
- ページ: [[LiveCD/4.5/BTS]]
- 投稿者: [[kaw]]
- 優先順位: 低
- 状態: 完了
- カテゴリー: malfunction
- 投稿日: 2009-02-26 (木) 09:03:35
- バージョン:
** メッセージ
more than 2^31 bytes are displayed as negative value. ~
Because ksh can handle integer range of -2^31 ... 2^31-1
On ksh, this is like this;
$ echo $((2147483647)) # 2^31-1
2147483647
$ echo $((2147483647+1)) # 2^31
-2147483648
Here's a concept code to check two strings representing b...
#!/bin/ksh
function isgreater {
# check presence of arguments
#
[ $# -lt 2 ] && return -- -1
x=$1
y=$2
# Are arguments both form of positive integer?
#
case "$x" in
0|[1-9]*([0-9])) : ;; # ok, do nothing
*) return -- -2 ;; # ng, string is...
esac
case "$y" in
0|[1-9]*([0-9])) : ;; # ok, do nothing
*) return -- -2 ;; # ng, string is...
esac
# Compare it
#
if [ ${#x} -gt ${#y} ]; then
return 0
elif [ ${#x} -eq ${#y} ]; then
if [ $x \> $y ]; then # string compare (not docu...
return 0
else
return 1
fi
else
return 1
fi
}
isgreater $1 $2
case $? in
0) echo $1 is greater than $2. ;;
1) echo $1 is NOT greater than $2. ;;
*) echo argument format error ;;
esac
Note
-This is needed by very early stage of boot time, so only...
-This is ksh-specific code.
----
- FIXED: above coding were introduced to /boottmp/rc at F...
- ENBUG: -gt must be replaced with > in function isgreater
- FIXED - 2009-05-19 (火) 12:00:30
Page: