#272 jfs_fsck dies with "*** %n in writable segment detected ***"

bug
closed-fixed
fsck (38)
5
2009-04-03
2009-04-03
Anonymous
No

jfs_fsck dies with "*** %n in writable segment detected ***" when repairing a filesystem that contains a file with a "%n" in the filename. This bug is in 1.1.12 and 1.1.13. The problem is in fsck/fsck_messages.c, in the function v_fsck_send_msg(). There is a section of code that reads:

if (message->msg_level <= msg_lvl) {
printf(msg_string);
if (dbg_output) {
printf(debug_detail);
}
else printf("\n");
}

The problem is with the statement: printf(msg_string);

The fix is to replace printf() with fputs(), like so:

if (message->msg_level <= msg_lvl) {
/* printf(msg_string); */
puts(msg_string);
if (dbg_output) {
printf(debug_detail);
}
else printf("\n");
}

fputs() does not care about percent-escape codes in the string it's writing, whereas printf() and related routines do.

Discussion

  • David Kleikamp

    David Kleikamp - 2009-04-03

    puts() adds an additional newline, so I'm going to go with printf("%s", msg_string) instead.

    Thanks!

     
  • David Kleikamp

    David Kleikamp - 2009-04-03
    • assigned_to: nobody --> shaggyk
     
  • David Kleikamp

    David Kleikamp - 2009-04-03

    Fixed in cvs, queued for version 1.1.14

     
  • David Kleikamp

    David Kleikamp - 2009-04-03
    • status: open --> closed-fixed