On Mon, Apr 25, 2016 at 03:17:09AM +0300, Dmitry V. Levin wrote:
Hi,On Sun, Apr 24, 2016 at 06:52:44PM -0500, Zev Weiss wrote:Hello, I noticed recently that strace puts quotes around the f_type member of struct statfs: statfs(".", {f_type="EXT2_SUPER_MAGIC", ...}) = 0 The double-quotes seem to predate git history; ChangeLog-CVS indicates they were added intentionally in a commit from Rick Sladkey in 1995 ("Enclose string result in double quotes"), though I don't see any reasoning as to why this was done. Given that strace's output format generally seems to aim for an approximate resemblance to C source code, it seems like f_type's value would be better off without quotes (since it's just a macro, not a string). Unless there's some more subtle reason for the current formatting that I'm not seeing, could the attached patch be applied to remove them?I agree, macro name shouldn't be quoted.@@ -45,7 +45,7 @@ sprintfstype(const unsigned int magic) s = xlat_search(fsmagic, ARRAY_SIZE(fsmagic), magic); if (s) { - sprintf(buf, "\"%s\"", s); + sprintf(buf, "%s", s);I think this sprintf is not needed, sprintfstype can just return s.
Ah, good point -- it *does* become pretty superfluous then. Amended patch attached.
Zev
>From ad59d354248ff3d107596e8368201815a0541682 Mon Sep 17 00:00:00 2001 From: Zev Weiss <[email protected]> Date: Sun, 24 Apr 2016 18:32:33 -0500 Subject: [PATCH] statfs: don't quote f_type macro names * statfs.c (sprintfstype): Don't add double-quotes to fs magic macros. * tests/statfs.expected: Remove double-quotes. --- statfs.c | 6 ++---- tests/statfs.expected | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/statfs.c b/statfs.c index bd3c7ba..882ee9c 100644 --- a/statfs.c +++ b/statfs.c @@ -44,10 +44,8 @@ sprintfstype(const unsigned int magic) const char *s; s = xlat_search(fsmagic, ARRAY_SIZE(fsmagic), magic); - if (s) { - sprintf(buf, "\"%s\"", s); - return buf; - } + if (s) + return s; sprintf(buf, "%#x", magic); return buf; } diff --git a/tests/statfs.expected b/tests/statfs.expected index 93e2b51..f39013b 100644 --- a/tests/statfs.expected +++ b/tests/statfs.expected @@ -1 +1 @@ -statfs(64)?\("/proc/self/status"(, [1-9][0-9]*)?, \{f_type="PROC_SUPER_MAGIC", f_bsize=[1-9][0-9]*, f_blocks=[0-9]+, f_bfree=[0-9]+, f_bavail=[0-9]+, f_files=[0-9]+, f_ffree=[0-9]+, f_fsid=\{[0-9]+, [0-9]+\}, f_namelen=[1-9][0-9]*(, f_frsize=[0-9]+)?(, f_flags=[0-9]+)?\}\) += 0 +statfs(64)?\("/proc/self/status"(, [1-9][0-9]*)?, \{f_type=PROC_SUPER_MAGIC, f_bsize=[1-9][0-9]*, f_blocks=[0-9]+, f_bfree=[0-9]+, f_bavail=[0-9]+, f_files=[0-9]+, f_ffree=[0-9]+, f_fsid=\{[0-9]+, [0-9]+\}, f_namelen=[1-9][0-9]*(, f_frsize=[0-9]+)?(, f_flags=[0-9]+)?\}\) += 0 -- 2.8.0.rc3
------------------------------------------------------------------------------ Find and fix application performance issues faster with Applications Manager Applications Manager provides deep performance insights into multiple tiers of your business applications. It resolves application problems quickly and reduces your MTTR. Get your free trial! https://ad.doubleclick.net/ddm/clk/302982198;130105516;z
_______________________________________________ Strace-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/strace-devel
