Re: debugfs: ls -p can print invalid characters
From: Theodore Ts'o <tytso@mit.edu>
Date: 2017-01-31 03:34:24
On Wed, Dec 21, 2016 at 01:11:45PM -0600, Samuel Voss wrote:
From: Clayton Shotwell <redacted> The recent modification to the "ls -p" function can print out characters that the other ls functions do not print out. Adding a slight change to use the same print function for all of the ls options. Signed-off-by: Clayton Shotwell <redacted> Signed-off-by: Samuel Voss <redacted>
This was deliberate. The "-p" option for debugfs's ls command is
intended for used when piping to a shell script, and the use of '/' is
because it is _rare_ for that character to show up file names.
If I were doing it all over again (ls -p has been around for a very
long time), I'd use the just-added print_c_string() function in which
encodes special characters using C strings (e.g., \001\000\n\t, etc.)
and then use an unencoded "RS" ASCII character (\036) as the record
separator between each field. But since there are existing
shell/perl/python scripts and other programs out there depending on
the output of debugfs's ls -p, I don't want to change the output at
this point.
Cheers,
- Ted