how to get arc diff on the command line to assume yes on very large number of changes - phabricator

My Jenkins server is running arc diff, and once in a while I have large diffs, I don't want my job to fail if that is the case:
Right with the latest master of arc, I get:
This diff has a very large number of changes (762). Differential works
best for changes which will receive detailed human review, and not as
well for large automated changes or bulk checkins. See
https://secure.phabricator.com/book/phabricator/article/differential_large_changes/
for information about reviewing big checkins. Continue anyway? [y/N]
[1mUsage Exception:[m Aborted generation of gigantic diff.
Build step 'Execute shell' marked build as failure
My current code tries to avoid interactivity and mostly works, except for large diffs. Any way around this?
echo "jenkins
Summary:
Test Plan:
required
Reviewers:
alberto56
Subscribers:
JIRA Issues:
$JIRAISSUE" > arc_info.txt
arc diff --allow-untracked --message jenkins --message-file arc_info.txt origin/master
rm arc_info.txt

There is no interaction option (yet) for arc diff. You may wanna try something like:
echo 'y' | arc diff ...
or even
echo 'y y y' | arc diff ...
You could also use the Yes command: http://linux.die.net/man/1/yes

Related

why "netstat -a" do not exit immediately but "netstat -n" does?

I have checked about the function of "-n" --
"Displays active TCP connections, however, addresses and port numbers are expressed numerically and no attempt is made to determine names."
But I can't see why "-n" can make netstat exit immediately?
From a quick check, I don't see the same description for the "-n" option as you do, and it doesn't make netstat run continuously.
As you didn't specify the version and exact command you are using, I tried both the version that comes with RH7.6 (net-tools 2.10-alpha) and the latest from source code (net-tools 3.14-alpha). The net-tools source code can be found in github [1].
As I couldn't find the exact option you describe, I tried all flags (without combinations) that don't require an argument. As far as I can tell the only options that cause netstat to not exit immediately are '-g' and '-c'. '-c' makes sense as it is the flag for running netstat continuously. For '-g' it isn't as obvious as the continuous behavior is coming from reading the /proc/net/igmp and /proc/net/igmp6 files line-by-line. The first file is read quickly but the igmp6 file takes much longer (1 line per ~1 sec). The '-g' option isn't really continuous, but just takes a lot of time to finish.
From the code, the only reason for continuous execution is (appears 4 times in the code):
if (i || !flag_cnt)
break;
wait_continous();
'i' is a return code from a function and the 'break' command is to break from an infinite for loop, so basically the code will run continuously only if flag_cnt is set (only happens when '-c' is provided) and there were no errors with previous commands.
For the specific issue above there could be a few reasons:
The option involves reading from a file and it takes very long time to finish, but it is not really continuous.
There's a correlation between the given option and flag_cnt, which cause flag_cnt to be set.
There's a call to wait_continous() which doesn't follow the condition above.
As I said, I couldn't reproduce the issue in the original question, nor could I find any flag with the description above. Also, non of the flags besides '-c' caused netstat to run continuously.
If you still want to figure this out I suggest you take a look at your code, or at least specify the net-tools version you use. The kernel version is also important as some code would be compiled-out due to missing kernel support.
[1] https://github.com/ecki/net-tools

Visualization library for disjoint intervals

I want to visualize memory mapping states of processes. For this I parsed the output of
# strace -s 256 -v -k -f -e trace=memory,process command
and now I have a time series of disjoint sums of intervals on the real line. Is there a convenient visualization library for such data? Haskell interface would be the most time-saving for me, but any suggestion is welcome. Thanks!
Just in case this might be useful for anyone, I hacked up a little tool to do this. (By the way I ended up using R/Shiny for interactive visualization.)
Here's the github repo.
It's interactive in that if you click a region, the stack traces responsible for the memory mapping
will be shown like this:
trace:
22695 mmap(NULL, 251658240, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_NORESERVE, -1, 0) = 0x2b4210000000
/lib/x86_64-linux-gnu/libc-2.19.so(mmap64+0xa) [0xf487a]
/usr/lib/jvm/java-8-oracle/jre/lib/amd64/server/libjvm.so(_ZN2os17pd_reserve_memoryEmPcm+0x31) [0x91e9c1]
/usr/lib/jvm/java-8-oracle/jre/lib/amd64/server/libjvm.so(_ZN2os14reserve_memoryEmPcm+0x20) [0x91ced0]
/usr/lib/jvm/java-8-oracle/jre/lib/amd64/server/libjvm.so(_ZN13ReservedSpace10initializeEmmbPcmb+0x256) [0xac20a6]
/usr/lib/jvm/java-8-oracle/jre/lib/amd64/server/libjvm.so(_ZN17ReservedCodeSpaceC1Emmb+0x2c) [0xac270c]
/usr/lib/jvm/java-8-oracle/jre/lib/amd64/server/libjvm.so(_ZN8CodeHeap7reserveEmmm+0xa5) [0x61a3c5]
/usr/lib/jvm/java-8-oracle/jre/lib/amd64/server/libjvm.so(_ZN9CodeCache10initializeEv+0x80) [0x47ff50]
/usr/lib/jvm/java-8-oracle/jre/lib/amd64/server/libjvm.so(_Z12init_globalsv+0x45) [0x63c905]
/usr/lib/jvm/java-8-oracle/jre/lib/amd64/server/libjvm.so(_ZN7Threads9create_vmEP14JavaVMInitArgsPb+0x23e) [0xa719be]
/usr/lib/jvm/java-8-oracle/jre/lib/amd64/server/libjvm.so(JNI_CreateJavaVM+0x74) [0x6d11c4]
/usr/lib/jvm/java-8-oracle/lib/amd64/jli/libjli.so(JavaMain+0x9e) [0x745e]
/lib/x86_64-linux-gnu/libpthread-2.19.so(start_thread+0xc4) [0x8184]
/lib/x86_64-linux-gnu/libc-2.19.so(clone+0x6d) [0xfa37d]
The same colors correspond to the same flags for mmap/msync/madvise etc.
Synopsis
$ make show-prerequisites
# (Follow the instructions)
$ make COMMAND="time ls"
...
DATA_DIR=build/data-2016-12-12_02h38m13s
Listening on http://127.0.0.1:5000
....
$ firefox http://127.0.0.1:5000
$ # Re-browse the previous results
$ make DATA_DIR=build/data-2016-12-12_02h38m13s
In the process of development I realized the striking geometricity of the problem.
So I created a module called Sheaf and described there a recipe for defining a Grothendieck
topology and a constant sheaf on it. It now seems the Grothendieck (or Lawvere-Tierney) topologies
are actually ubiquitous for programming.. but I'm not sure if it will prove anything worthy.
So feel free to check it!

how to run arc diff in a script, without prompting for a message

Phabricator's arcanist command line tool allows you to add a "diff" for revision. This is useful because you can quickly generate a diff which your colleagues can review.
Normally, running arc diff master, for example, will prompt your for a diff message, a test plan, and some other information, and then create a diff on Phabricator.
However, I would like to run arc diff from a continuous integration server, therefore assuming yes to all questions and passing the message and test plan as an argument to the command. What I have now is:
arc diff master --allow-untracked
Still, it is assuming that it is being called from a human user, and asking for a message, which fails when called from a continuous integration server. How can skip the prompts?
I think what you are looking for is the --verbatim option.
Considering the changes are committed so that it has a commit message you can run a command like:
arc diff --verbatim --reviewers xxxx --uncommitted --allow-untracked
This implies you set the Test plan to optional, else you have to specify it as well.
Finally you can also read revision info from a file using --message-file.
Another approach would be:
Create a Diff (but not a rev) with arc diff --raw-command "git diff origin/master"
Read the result to get the diff Id
Use the createrevision conduit call as described here to create the revision:
https://secure.phabricator.com/conduit/method/differential.createrevision/
the best practice is:
You can prepare a template file like this. This file can be named msg.conf
${title}
Summary:
${summary_content}
修订人:
${reviewers}
订阅者:
RBA-DEV
Test Plan:
${test_plan}
and then you can generate some content you need to fill this template and then.
you can rum this command:
arc diff --create --allow-untracked --skip-binaries --message-file msg.conf origin/master

Bind query resolution time in munin

Is it possible to graph the query resolution time of bind9 in munin?
I know there is a way to graph it in a unbound server, is it already done in bind? If not how do I start writing a munin plugin for that? I'm getting stats from http://127.0.0.1:8053/ in the bind9 server.
I don't believe that "query time" is a function of BIND. About the only time that I see that value (with individual lookups) is when using dig. If you're willing to use that, the following might be a good starting point:
#!/bin/sh
case $1 in
config)
cat <<'EOM'
graph_title Red Hat Query Time
graph_vlabel time
time.label msec
EOM
exit 0;;
esac
echo -n "time.value "
dig www.redhat.com|grep Query|cut -d':' -f2|cut -d\ -f2
Note that there's two spaces after the "-d\" in the second cut statement. If you save the above as "querytime" and run it at the command line, output should look something like:
root#pi1:~# ./querytime
time.value 189
root#pi1:~# ./querytime config
graph_title Red Hat Query Time
graph_vlabel time
time.label msec
I'm not sure of the value in tracking the above though. The response time can be affected: if the query is an initial lookup, if the answer is cached locally, depending on server load, depending on intervening network congestion, etc.
Note: the above may be a bit buggy as I've written it on the fly, but it should give you a good starting point. That it returned the above output is a good sign.
In any case, recommend reading the following before you write your own: http://munin-monitoring.org/wiki/HowToWritePlugins

Who know the history of unix fork?

Fork is a great tool in unix.We can use it to generate our copy and change its behaviour.But I don't know the history of fork.
Does someone can tell me the story?
Actually, unlike many of the basic UNIX features, fork was a relative latecomer (a).
The earliest existence of multiple processes within UNIX consisted of a few (fixed number of) processes, one per terminal that was attached to the PDP-7 machine (b).
The basic idea was that the shell process for a given terminal would accept a command from the user, locate the program file, load a small bootstrap program into high memory and jump to it, passing enough details for the bootstrap code to load the program file.
The bootstrap code, after loading the program into low memory (overwriting the shell), would then jump to it.
When the program was finished, it would call exit but it wasn't like the exit we know and love today. This exit would simply reload the shell and run it using pretty much the same method used to load the program in the first place.
So it was really more like a rudimentary exec command, the one that replaces your current program with another, in the same process space.
The shell would exec your program then, when your program was done, it would again exec the shell by calling exit.
This method was similar to that found in many other interactive systems at the time, including the Multics from whence UNIX got its name.
From the two-way exec, it was actually not that big a leap to adding fork as a process duplicator to work in conjunction. While many systems run another program directly, it's this "just add what's needed" method which is responsible for the separation of duties between fork and exec in UNIX. It also resulted in a very simple fork function.
If you're interested in the early history of various features(c) of Unix, you cannot go past the article The Evolution of the Unix Time-Sharing System by Dennis Ritchie, presented at a 1979 conference in Australia, and subsequently published by AT&T.
(a) Though I mean latecomer in the sense that the separation of the four fundamental forces in the universe was "late", happening some 0.00000000001 seconds after the big bang.</humour>.
(b) Since a question was raised in a comment as to how the shells were originally started off, there's a great resource holding very early source code for Unix over at The Unix Heritage Society, specifically the source code archives and, in particular, the first edition.
The init.s file from the first edition shows how the fixed number of shell processes were created (slightly reformatted):
...
mov $itab, r1 / address of table to r1
1:
mov (r1)+, r0 / 'x, x=0, 1... to r0
beq 1f / branch if table end
movb r0, ttyx+8 / put symbol in ttyx
jsr pc, dfork / go to make new init for this ttyx
mov r0, (r1)+ / save child id in word offer '0, '1, etc
br 1b / set up next child
1:
...
itab:
'0; ..
'1; ..
'2; ..
'3; ..
'4; ..
'5; ..
'6; ..
'7; ..
0
Here you can see the snippet which creates the processes for each connected terminal. These are the days of hard-coded values, no auto detection of terminal quantity involved. The zero-terminated table at itab is used to create a number of processes and hopefully the comments from the code explain how (the only possibly tricky bit is the labels - though there are multiple 1 labels, you branch to the nearest one in a given direction, hence 1b means the closest 1 label in the backwards direction).
The code shown simply processes the table, calling dfork to create a process for each terminal and start getty, the login prompt. The getty program, in turn, eventually started the shell. From that point, it's as I described in the main part of this answer.
(c) No paths (and use of temporary links to get around this limitation), limited processes, why there's a GECOS field in the password file, and all sorts of other trivia, generally interesting only to uber-geeks, of course.

Resources