lkml.org 
[lkml]   [2004]   [Jun]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    Subject[PATCH] Stop printk printing non-printable chars
    Hi,

    I have had problems recently with the output from dmesg. Somewhere in
    the depths of ACPI (drivers/acpi/tables.c:104) the
    header->asl_compiler_id contained non-printable characters, and it made
    xterm stop displaying any more output. dmesg|less had to be used as less
    filters out the duff chars.

    The main problem seems to be in ACPI, but I don't see any reason for
    printk to even consider printing _any_ non-printable characters at all.
    It makes all characters out of the range 32..126 (except for newline)
    print as a '?'.

    Patch is for 2.6.7.

    Matthew


    --- linux-2.6.7/kernel/printk.c.orig 2004-06-18 20:44:28.000000000 +0100
    +++ linux-2.6.7/kernel/printk.c 2004-06-18 20:53:36.000000000 +0100
    @@ -14,6 +14,8 @@
    * manfreds@colorfullife.com
    * Rewrote bits to get rid of console_lock
    * 01Mar01 Andrew Morton <andrewm@uow.edu.au>
    + * Stop emit_log_char from emitting non-ASCII chars.
    + * Matthew Newton, 18 June 2004 <matthew-lkml@newtoncomputing.co.uk>
    */

    #include <linux/kernel.h>
    @@ -538,7 +540,11 @@
    }
    log_level_unknown = 0;
    }
    - emit_log_char(*p);
    + if (p[0] != '\n' && (p[0] < 32 || p[0] > 126)) {
    + emit_log_char('?');
    + } else {
    + emit_log_char(*p);
    + }
    if (*p == '\n')
    log_level_unknown = 1;
    }

    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

    \
     
     \ /
      Last update: 2005-03-22 14:03    [W:0.051 / U:29.752 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site