Project

General

Profile

Bug #526

bug in /etc/rc.php_ini_setup

Added by Ganbold Ts over 9 years ago. Updated over 9 years ago.

Status:
Resolved
Priority:
Normal
Assignee:
-
Category:
-
Target version:
Start date:
04/19/2010
Due date:
% Done:

0%

Estimated time:
Affected Version:
2.0
Affected Architecture:

Description

There looks like bug in /etc/rc.php_ini_setup.
Faulty code is:

  1. Grab amount of memory that is detected
    if [ -f /var/log/dmesg.boot ]; then
    AVAILMEM=`/bin/cat /var/log/dmesg.boot |/usr/bin/awk '/avail memory/ { print $5 }'| sed 's/(//g'|tail -1`
    else
    AVAILMEM=`/sbin/dmesg -a |/usr/bin/awk '/avail memory/ { print $5 }'| sed 's/(//g'|tail -1`
    fi

Above code produces following output in RouterStation Pro:

[2.0-BETA1][]/root(2): /bin/cat /var/log/dmesg.boot |/usr/bin/awk '/avail memory/ { print $5 }'| sed 's/(//g'|tail -1
118MB)

Old code still works without a problem:

[2.0-BETA1][]/root(3): cat /var/log/dmesg.boot | grep "memory" | grep "avail" | awk '{ print $5 }' | cut -d'(' -f2 | cut -d'M' -f1
118

Associated revisions

Revision 839cad07 (diff)
Added by Seth Mos over 9 years ago

Improve the parsing of the memory value, use the reported amount of bytes, divide to get megabytes and get the 1st result. Ticket #526

History

#1 Updated by Chris Buechler over 9 years ago

  • Target version set to 2.0
  • Affected Version set to 2.0

#2 Updated by Seth Mos over 9 years ago

  • Status changed from New to Feedback

Changed the used awk function to use the byte value and calculate from there.

Alternatively. Provide the strong from

dmesg|grep "avail memory" 

#3 Updated by Ganbold Ts over 9 years ago

works here.

beastie# /bin/cat /var/run/dmesg.boot | /usr/bin/awk '/avail memory/ { memory=($4 / 1048576); printf("%0.0f\n", memory); exit}'
1937
beastie# /sbin/dmesg -a |/usr/bin/awk '/avail memory/ { memory=($4 / 1048576); printf("%0.0f\n", memory); exit}'
1937

It can be closed.

#4 Updated by Chris Buechler over 9 years ago

  • Status changed from Feedback to Resolved

Also available in: Atom PDF