gsoc 2015
杨秉武
detailyang at gmail.com
Wed Mar 4 18:03:51 UTC 2015
Nice to join the mailing list:)
My name is Yang bingwu, a Chinese guy, a senior student at Hangzhou Dianzi
University. Introduce to myself in brief. i did a remote work as a free
elancer for front-end (html/js/css) half year, a intern as a system admin
and developer (shell/node.js/python/php/c) one and a half year .
*why do i choose the strace?*
1. it's because that strace is very powerful tool to see what
happened for process. I was used to use strace to solve my production's
problem (php|python).
2. i am a system admin, it's very important to know how system call
to call and what system call do. learning strace can help me to understand
system call and to see which system call is called. first watch program ,
then profile program:)
3. I hope to become a long-term developer for a open source
program. It's personal desire to open source and develope the userful tools
to people use like linux kernel:).
To understand a program how to run, it's the easiest way to write test
unit:).So i take some time to test the strace.
I check the makefile to find some test target (like make test but i do not
find), i find this
> RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
> html-recursive info-recursive install-data-recursive \
> install-dvi-recursive install-exec-recursive \
> install-html-recursive install-info-recursive \
> install-pdf-recursive install-ps-recursive install-recursive \
> installcheck-recursive installdirs-recursive pdf-recursive \
> ps-recursive uninstall-recursive
So i guess the check-recursive target is the test. the test result as below:
>
> =================================================
> strace 4.9.0.377-6a63: tests/test-suite.log
> =================================================
> 1 of 23 tests failed. (12 tests were not run).
one test failed and 12 tests skip.
the failed test is "FAIL: caps.test (exit: 1)", check the caps.test, its a
bash script. Oh, the test is easy that it use awk to match the strace's
stdout, and the test print Line 1 does not match.
So i check the script, find the awk script didnt match the stdout
capget({_LINUX_CAPABILITY_VERSION_3, 0},
> {CAP_CHOWN|CAP_DAC_OVERRIDE|CAP_DAC_READ_SEARCH|CAP_FOWNER|CAP_FSETID|CAP_KILL|CAP_SETGID|CAP_SETUID|CAP_SETPCAP|CAP_LINUX_IMMUTABLE|CAP_NET_BIND_SERVICE|CAP_NET_BROADCAST|CAP_NET_ADMIN|CAP_NET_RAW|CAP_IPC_LOCK|CAP_IPC_OWNER|CAP_SYS_MODULE|CAP_SYS_RAWIO|CAP_SYS_CHROOT|CAP_SYS_PTRACE|CAP_SYS_PACCT|CAP_SYS_ADMIN|CAP_SYS_BOOT|CAP_SYS_NICE|CAP_SYS_RESOURCE|CAP_SYS_TIME|CAP_SYS_TTY_CONFIG|CAP_MKNOD|CAP_LEASE|CAP_AUDIT_WRITE|CAP_AUDIT_CONTROL|CAP_SETFCAP|CAP_MAC_OVERRIDE|CAP_MAC_ADMIN|CAP_SYSLOG|CAP_WAKE_ALARM|CAP_BLOCK_SUSPEND|CAP_AUDIT_READ|0xffffffc0,
> CAP_CHOWN|CAP_DAC_OVERRIDE|CAP_DAC_READ_SEARCH|CAP_FOWNER|CAP_FSETID|CAP_KILL|CAP_SETGID|CAP_SETUID|CAP_SETPCAP|CAP_LINUX_IMMUTABLE|CAP_NET_BIND_SERVICE|CAP_NET_BROADCAST|CAP_NET_ADMIN|CAP_NET_RAW|CAP_IPC_LOCK|CAP_IPC_OWNER|CAP_SYS_MODULE|CAP_SYS_RAWIO|CAP_SYS_CHROOT|CAP_SYS_PTRACE|CAP_SYS_PACCT|CAP_SYS_ADMIN|CAP_SYS_BOOT|CAP_SYS_NICE|CAP_SYS_RESOURCE|CAP_SYS_TIME|CAP_SYS_TTY_CONFIG|CAP_MKNOD|CAP_LEASE|CAP_AUDIT_WRITE|CAP_AUDIT_CONTROL|CAP_SETFCAP|CAP_MAC_OVERRIDE|CAP_MAC_ADMIN|CAP_SYSLOG|CAP_WAKE_ALARM|CAP_BLOCK_SUSPEND|CAP_AUDIT_READ|0xffffffc0,
> 0}) = 0
> capset({_LINUX_CAPABILITY_VERSION_3, 0}, {CAP_DAC_OVERRIDE|CAP_WAKE_ALARM,
> CAP_DAC_READ_SEARCH|CAP_BLOCK_SUSPEND, 0}) = -1 EPERM (Operation not
> permitted)
> +++ exited with 0 +++
i check the awk reg pattern
fail = 0
> lines = 3
> cap =
> "(0|CAP_[A-Z_]+(\\|CAP_[A-Z_]+)*|CAP_[A-Z_]+(\\|CAP_[A-Z_]+){37}\\|0xffffffc0)"
> capget = "^capget\\(\\{_LINUX_CAPABILITY_VERSION_3, 0\\}, \\{" cap ", "
> cap ", " cap "\\}\\) = 0$"
as usual, it should match the stdout, but on my system (CentOS release 6.6
(Final) GNU Awk 3.1.7) it doesnt work. So i guess it's the compatibility
about awk and gnu awk. RTFM, i find [1]
{n}{n,}{n,m}
>
> Interval expressions were not traditionally available in awk. They were
> added as part of the POSIX standard to make awk and egrep consistent with
> each other.
>
> Initially, because old programs may use ‘{’ and ‘}’ in regexp constants,
> gawk did *not* match interval expressions in regexps.
>
> However, beginning with version 4.0, gawk does match interval expressions
> by default. This is because compatibility with POSIX has become more
> important to mostgawk users than compatibility with old programs.
>
> For programs that use ‘{’ and ‘}’ in regexp constants, it is good
> practice to always escape them with a backslash. Then the regexp constants
> are valid and work the way you want them to, using any version of awk.17
> <https://www.gnu.org/software/gawk/manual/html_node/Regexp-Operators.html#FOOT17>
>
> Finally, when ‘{’ and ‘}’ appear in regexp constants in a way that cannot
> be interpreted as an interval expression (such as /q{a}/), then they
> stand for themselves.
>
finally i find the reason. because the Interval expressions were not
traditionally available in awk. They were added as part of the POSIX
standard to make awk and egrep consistent with each other.solving this
problem just add the option --posix to match.
awk --posix -f "$srcdir"/caps.awk "$LOG" ||
> { cat "$LOG"; fail_ 'unexpected output'; }
during this the road to test, i find some problem.
1. some test will skip if the check_prog failed(program is not exist),
so the test is incomplete. it didnt run all tests.
2. some test script depend linux program like time, on my system it
didnt be installed. I mean we should check the program version. It's
universal to check the dependence version. some package management will do
this like yum pip npm.
3. it 's not automated.
i'm very happy to write test suite to be familiar with the strace code
base, then develop the strace code base as long-term devleloper:)
thanks for reading:)
now Chinese time is 2015-03-05 02:03:30 (CST), it's time to sleep.
[1]. http://w3-o.cs.hm.edu/~ruckert/compiler/regexp.html#Options
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.strace.io/pipermail/strace-devel/attachments/20150305/9dc33a7e/attachment.html>
More information about the Strace-devel
mailing list