[lfs-dev] console script minor visual issue

Bruce Dubbs bruce.dubbs at gmail.com
Tue Sep 9 23:50:26 PDT 2014

Bryan Kadzban wrote:
> Bruce Dubbs wrote:
>> unset COLUMNS
>> . /lib/services/init_functions
>> <...>
>> This is pretty minor.  Is this change worth doing?
> Is it easier to just recalculate ROWS (...if needed; entirely possibly not
> although I don't know what might use it) and COLUMNS?  That ends up being a
> separate copy of the script code though, so entirely possibly not-worthwhile.
> Not sure how many fonts have different character sizes, but it *probably*
> makes sense to handle that.

ROWS is not used by the scripts.  The offending code is:

if [ -z "${COLUMNS}" ]; then
    COLUMNS=$(stty size)

# When using remote connections, such as a serial port, stty size
# returns 0
if [ "${COLUMNS}" = "0" ]; then

## Measurements for positioning result messages
COL=$((${COLUMNS} - 8))
WCOL=$((${COL} - 2))

SET_COL="\\033[${COL}G"      # at the $COL char
SET_WCOL="\\033[${WCOL}G"    # at the $WCOL char

This is sourced at the beginning of each boot script.

If the script changes the real value of ${COLUMNS} after the 
init-functions file is sourced, then it will be wrong for subsequent output.

On my system, the default font is small.  It has 240 characters on a 15 
inch wide (horizontal, not diagonal) screen.  The default font is too 
small for my eyes so I use a ter-128n font (Terminius Font 14x28 pixel 
character size).  That reduces the screen to 137 columns during the 
console script.  The commands at the top merely reset the COLUMNS 
variable and adjust the output positioning on the screen.

The bottom line is that the problem only occurs if the FONT variable is 
set for the console script and only affects the position [ OK ] or 
[FAIL] result on the screen for that one script.

I would guess the time for the script to re-source the init_functions 
file is in the single digit milliseconds.

   -- Bruce

More information about the lfs-dev mailing list