<div dir="ltr"><div>Nice to join the mailing list:)</div><div><br></div><div>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 .</div><div><br></div><div><b>why do i choose the strace?</b></div><div><ol><li> 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).<br></li><li> 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:)<br></li><li> 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:).<br></li></ol></div><div><br></div><div>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.</div><div>I check the makefile to find some test target (like make test but i do not find), i find this</div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \<br> html-recursive info-recursive install-data-recursive \<br> install-dvi-recursive install-exec-recursive \<br> install-html-recursive install-info-recursive \<br> install-pdf-recursive install-ps-recursive install-recursive \<br> installcheck-recursive installdirs-recursive pdf-recursive \<br> ps-recursive uninstall-recursive</blockquote><div><br></div><div>So i guess the check-recursive target is the test. the test result as below:</div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><br>=================================================<br> strace 4.9.0.377-6a63: tests/test-suite.log<br>=================================================<br>1 of 23 tests failed. (12 tests were not run).</blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">one test failed and 12 tests skip. </blockquote><div><br></div><div><br></div><div>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.</div><div>So i check the script, find the awk script didnt match the stdout</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">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<br>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)<br>+++ exited with 0 +++</blockquote><div><br></div><div>i check the awk reg pattern</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"> fail = 0<br> lines = 3<br> cap = "(0|CAP_[A-Z_]+(\\|CAP_[A-Z_]+)*|CAP_[A-Z_]+(\\|CAP_[A-Z_]+){37}\\|0xffffffc0)"<br> capget = "^capget\\(\\{_LINUX_CAPABILITY_VERSION_3, 0\\}, \\{" cap ", " cap ", " cap "\\}\\) = 0$"</blockquote><div><br></div><div>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]</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">{n}{n,}{n,m}<br><p style="color:rgb(0,0,0);font-family:'Source Han Sans CN'">Interval expressions were not traditionally available in <code>awk</code>. They were added as part of the POSIX standard to make <code>awk</code> and <code>egrep</code> consistent with each other.</p><a name="index-gawk_002c-interval-expressions-and" style="color:rgb(0,0,0);font-family:'Source Han Sans CN'"></a><span style="color:rgb(0,0,0);font-family:'Source Han Sans CN'"></span><p style="color:rgb(0,0,0);font-family:'Source Han Sans CN'">Initially, because old programs may use ‘<samp>{</samp>’ and ‘<samp>}</samp>’ in regexp constants, <code>gawk</code> did <em>not</em> match interval expressions in regexps.</p><p style="color:rgb(0,0,0);font-family:'Source Han Sans CN'">However, beginning with version 4.0, <code>gawk</code> does match interval expressions by default. This is because compatibility with POSIX has become more important to most<code>gawk</code> users than compatibility with old programs.</p><p style="color:rgb(0,0,0);font-family:'Source Han Sans CN'">For programs that use ‘<samp>{</samp>’ and ‘<samp>}</samp>’ 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 <code>awk</code>.<a name="DOCF17" href="https://www.gnu.org/software/gawk/manual/html_node/Regexp-Operators.html#FOOT17"><sup>17</sup></a></p><p style="color:rgb(0,0,0);font-family:'Source Han Sans CN'">Finally, when ‘<samp>{</samp>’ and ‘<samp>}</samp>’ appear in regexp constants in a way that cannot be interpreted as an interval expression (such as <code>/q{a}/</code>), then they stand for themselves.</p></blockquote><div><br></div><div>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.</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">awk --posix -f "$srcdir"/caps.awk "$LOG" ||<br> { cat "$LOG"; fail_ 'unexpected output'; }</blockquote><div><br></div><div>during this the road to test, i find some problem.</div><div><ol><li>some test will skip if the check_prog failed(program is not exist), so the test is incomplete. it didnt run all tests.<br></li><li>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.<br></li><li>it 's not automated.</li></ol></div><div><br></div><div>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:)</div><div><br></div><div>thanks for reading:)</div><div>now Chinese time is 2015-03-05 02:03:30 (CST), it's time to sleep.</div>
<div><br></div><div>[1]. <a href="http://w3-o.cs.hm.edu/~ruckert/compiler/regexp.html#Options">http://w3-o.cs.hm.edu/~ruckert/compiler/regexp.html#Options</a></div></div>