e2fsprogs/debugfs
Eric Biggers 9033a31e26 debugfs: avoid ambiguity when printing filenames
The way debugfs escapes filenames is ambiguous because a sequence like
M-A can mean either the byte 'A' + 128 == 0xc1 or the three bytes
{'M', '-', 'A'}.  Similarly, ^A can mean either the byte
'A' ^ 0x40 == 0x01 or the two bytes {'^', 'A'}.

Fix this and simplify the code by switching to a simpler strategy where
all bytes < 32, all bytes >= 127, and backslash are encoded with C-style
hex escape sequences.  E.g., the byte 0xc1 will now be encoded as \xc1
rather than M-A as it was before, while a filename consisting of the
three bytes {'M', '-', 'A'} will continue to be shown as M-A.

I want to fix this mainly because I want to use debugfs to retrieve raw
encrypted filenames for ciphertext verification tests.  But this doesn't
work if the returned filenames are ambiguous.

Fixes: 68a1de3df3 ("debugfs: pretty print encrypted filenames in the ls command")
Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2019-04-28 19:42:41 -04:00
..
Android.bp AOSP: Update Android.bp files. 2018-08-05 13:54:26 -04:00
debug_cmds.ct debugfs: add the debugfs copy_inode subcommand 2016-08-31 18:13:16 -04:00
debugfs.8.in debugfs: add support to display details of extended attribute structures 2018-06-13 18:41:45 -04:00
debugfs.c Merge branch 'maint' into next 2019-02-10 21:50:26 -05:00
debugfs.h debugfs: fix set_inode_field so it can set the checksum field 2018-12-15 18:31:40 -05:00
do_journal.c Fix function declarations for ss commands to fix LTO warnings 2018-08-08 19:59:40 -04:00
dump.c Fix function declarations for ss commands to fix LTO warnings 2018-08-08 19:59:40 -04:00
extent_cmds.ct debugfs: add the ability to manipulate the extent tree directly 2012-12-24 10:49:41 -05:00
extent_inode.c Fix function declarations for ss commands to fix LTO warnings 2018-08-08 19:59:40 -04:00
filefrag.c Fix function declarations for ss commands to fix LTO warnings 2018-08-08 19:59:40 -04:00
htree.c debugfs: support encoding when printing the file hash 2018-12-02 23:59:12 -05:00
icheck.c Fix function declarations for ss commands to fix LTO warnings 2018-08-08 19:59:40 -04:00
journal.c tune2fs/fuse2fs/debugfs: after replaying the journal, fix up s_lastcheck 2018-02-24 18:11:19 -05:00
journal.h debugfs: cleanup gcc -Wall warnings 2015-07-13 16:00:12 -04:00
logdump.c Fix function declarations for ss commands to fix LTO warnings 2018-08-08 19:59:40 -04:00
ls.c debugfs: avoid ambiguity when printing filenames 2019-04-28 19:42:41 -04:00
lsdel.c Fix function declarations for ss commands to fix LTO warnings 2018-08-08 19:59:40 -04:00
Makefile.in debugfs: support encoding when printing the file hash 2018-12-02 23:59:12 -05:00
ncheck.c Fix function declarations for ss commands to fix LTO warnings 2018-08-08 19:59:40 -04:00
quota.c Fix function declarations for ss commands to fix LTO warnings 2018-08-08 19:59:40 -04:00
ro_debug_cmds.ct debugfs: add commands to query the quota information 2014-05-13 10:13:19 -04:00
set_fields.c debugfs: fix set_inode_field so it can set the checksum field 2018-12-15 18:31:40 -05:00
unused.c Fix function declarations for ss commands to fix LTO warnings 2018-08-08 19:59:40 -04:00
util.c debugfs: fix set_inode_field so it can set the checksum field 2018-12-15 18:31:40 -05:00
xattrs.c debugfs: fix printing of xattrs with ea_in_inode values 2019-03-26 09:36:53 -04:00
zap.c Fix function declarations for ss commands to fix LTO warnings 2018-08-08 19:59:40 -04:00