I've released version 0.25 of Obnam,
my backup application.
nagios-last-backup-age subcommand is useful for setting up Nagios
(or similar systems) to check that backups get run properly. Thanks to
Peter Palfrader for the patch.ssh-known-hosts (for choosing which file to check for
known host keys), strict-ssh-host-keys (for disallowing unknown host
keys), and ssh-key (for choosing which key file to use for SSH
connections) allow better and safer use of ssh.--pretend option now works for backups as well.obnam ls now shows the correct timestamps for generations.
Thanks, Anders Wirzenius.
<style type="text/css">
@import "/pub/special-css/venk.css";
</style>
Since 2002, groups of college students have undertaken a 70 day, 4000+ mile summer bike ride across the United States with the goal of offering hope, inspiration and support to cancer communities along the way. This past summer was our 10th year of cycling across the country as 76 volunteers rode along three different routes: Baltimore to San Francisco, Baltimore to Portland, and Baltimore to Seattle. Our riders raised a combined $476,000 to support organizations and individuals in the fight against cancer.His fundraising goal is $5,000. Anything from $5 to $500 is a donation to an organization that helps young adult cancer surviers and their families get access to information and support resources. Can you help?
When I told people of my plans to move to Montreal, it usually prompted one of two reactions: one was some version of joyful envy, many people exclaiming breathlessly Montreal is one of my favorite cities, one person once even clutching my arm and told me as he looked me straight in the eye: you are so lucky, there is no city quite like Montreal in North America.
The second reaction came off as a thinly veiled mixture of disdain and disbelief usually peppered with many reallys: oh wow, really, really you would really leave NYC? I am pretty certain they really were thinking something along the lines of what a fool, how dare she leave a great job, a great university, a world class city (the only city to live) for some Canadian mid-sized city, which is like tundra for a good chunk of the year?
The decision to move weighed heavily on me, if for no other reason I had a choice to stay or to go and I honestly have not had a choice, a decision to make about where to go since I got accepted to graduate school (and even then the choice was more obvious than this one). So over a month into my move what is my verdict? In a word, win.
I don t miss NYC at all though I get why some people cannot leave the place and know that despite some oddities and difficulties of living in Montreal, it fits my tastes and needs much better than NYC which dwarfed me in so many ways. I never felt I could enjoy it, I grew tired of the cramped living quarters, the noise ate at my soul, and I simply felt more overwhelmed by the fact that I could not even get a handle on the neighborhoods in my vicinity, much less all the other hoods in the area.
Instead of dogging NYC anymore, I think I will spend a little time on first impressions, as they will soon be lost to the familiarity borne with time and experience. In essence Montreal is chock full of life but rather intimate, a quirky city with lots of charm but some grit and lacking the way over designed and done feel of cities like Portland.
Here are some of quirks:
1. The Hawt Metro: I fell in love with the Metro when I first rode it a few years ago. I just love the powder blue color of the cars and the super sweet 1960s aesthetic of many stations. Even better and unlike NYC, they are just clean and quiet. The downside? The temperatures approximates a sauna during the winter and while you would think this is a good thing, when you are layered with the clothing necessary to survive outside (re: long underwear along with Canada-coat, gloves, hat, and scarf), it is hooooooot down there and you feel like you need to pass out.
2. Spend money, get free stuff: In many establishments you get free stuff (like blueberries or some like sports bar) when you spend over a certain amount of money, like 70 bucks. Quirky local tradition.
3. The culture of negotiation and the kick ass standard lease: Housing is amazing here. There is plenty of it, there are many different styles, and it is rather fun exploring all the different hoods that make up the city. Problem is too that lots of apartments have weird problems and issues and I had to steer clear of anything that could even possibly have mold. I spent weeks day in day out looking for a place, desperate to move out of my corporate apartment very nicely provided by the university but still not my ideal living situation. Finally found a place that fit all my needs in the perfect location and I took it to only find out that places are priced to negotiate and I was faced with the decision to negotiate or not. Sort of did, was not thrilled about it (thinking that I might lose the place) but it sort of worked and I scored the place. If price is up to haggling, the lease on the other hand, is standard (you can buy one at your local bodega ). It is the law to use it and it is like a no nonsense, straightforward lease, which is very protective of renters.
4. Montreal is known for its exceptional food but you know Poutine is just plain gross: Food here is good and I can tell that I will get a handle of restaurants in a way that felt impossible in NYC. The gluten free religion seems to be spreading, thankfully. There are many little Fruiterias! to get your fruits veggies which I am still exploring and right around my house is a crazy supermarket that is so cheap, which is weird because consumer goods generally ain t cheap in Montreal like they are in the states but this place is a gem and everyone agrees (and almost impossible to notice from the street!). Now Poutine is disgusting. Ok it did not help that the first night I went out to eat it, I was still under the clutches of Noro virus, and I think it re-activated the nausea that had been zapped by some strong medicine and the hospital, the day before, which brings me to the next point, the health care system.
5. Healthcare, I had to use it way too early: So last week I came down with the Noro virus and you usually wait it out as it runs through you quickly but I was dehydrated before I even started to vomit to for 8 hours straight, at which point severely tired and so nauseous (I was yelling to make it stop), I went to the hospital. Now I had talked to lot of people about the healthcare system in Montreal as it seems good, really great but a bit over taxed, especially compared to where I had lived in Edmonton where it was like a magic fairy tale dream. I had heard of two things: the care is excellent but the facilities are shocking and the wait times unless dire can be atrociously long. So facilities, yea they are kinda shocking, somewhat shabby but who cares, so long as the care is good, no? Packaging is irrelevant so long as the goods are derived. Before going I was scared of the long wait times (and also the taxi took me by mistake to Montreal General Hospital was looked too much like a HUGE version of the creepy buildings in The Shining for me, and I was supposed to go to Jewish General so left for there). The wait time: nearly none, somewhat as shocking as the facilities first looked to me. I think it was a combination of the time I arrived, with the fact that my lounge was parched and yellowish-gross (sorry, it was gross), indicating I was dehydrated, oh and I was crying bit hysterically, for despite my high threshold for pain, nausea terrorizes me. I was covered by insurance and since I did not yet have my McGill health cards (it takes three months to qualify for the local stuff), I did pay and the price was laughably cheap compared to what I would pay in NYC for the same treatment.
6. Now for my favorite, snow so nice, ice oh Christ: Well this winter has been, by all accounts, weak and warm, the spirit of winter barely making its way from the underworld to the outerworld. But even though it is has been more idle than full throttle, I still got a pretty accurate taste of what winter is like, with a few days of 20- c temps, and having to walk a number of times on a layer of frozen ice that makes it feel like a very dangerous mini-ice age in the making.
I do rather love the quiet snow falling and just love love sprinting through the snow with my dog, Roscoe, who has taken a liking for prancing in the white stuff and looks awful cute with his winter man s ice beard. After a sizable snowfall, it is clear they city does not toy with the snow removal although the sidewalk snow plows do look somewhat like very large and dangerous but kinda cute toys. But let s be frank, winters are hard, so hard that I think I would go mad if I had to stay through the entire thing, being born and raised in the tropics So the fact that I am writing this from the southern hemisphere in the height of summer gives me the assurance I can handle the rest of the snow, ice, ice and snow upon my return.
debian-policy package.
Input data are the debian/copyright files of all
Debian source packages. If license-count is not
bugged, our debian/copyright files might be. One thing
that occurred to me only a few days ago is the habit of
declaring a different license for Debian packaging (the
files under debian/) than the software being packaged
itself. That's a bad habit because it might cause unwanted license
mixtures via patches that live under debian/ but I've
seen several occurrences of it in the Debian archive. For name and
(self-)shame: I've also been guilty of it in the past, when I
was young .
Is that reason enough to skew results and overestimate
GPL-d software? I don't think so, I hope not, but
ultimately I don't know. It'd be nice to rule out the possibility
entirely. So if anyone is willing to do some sampling of affected
debian/copyright files and propose patches for
license-count to exclude those "false positives",
please shout. (As a bonus point: that would also help to take more
sound decision for the typical use case of
license-count, i.e. deciding when a license should be
added to /usr/share/common-licenses.)
Other independent reviews of the results are equally
welcome.
Note: the above, as well as John's analysis, would be a trivial
exercise if DEP-5
were already widely deployed in the Debian archive.
license-count, posted a
way more likely cause of data skew in John's analysis: double
counting among the different types of copyleft licenses
The new RcppArmadillo release 0.2.35 now
supports the Rcpp::Rcout output stream device. Based on a contributed
Rcpp patch by Jelper Ypma, the
Rcpp::Rcout output stream gets redirected to R's buffered output. In other words, R's own output and that
eminating from C++ code using Rcpp::Rcout are now both in sync. This avoids a stern warning
from Section 5.6 in the Writing R Extensions manual:
Using C++ iostreams, as in this example, is best avoided. There is no guarantee that the output will appear in the R console, and indeed it will not on the R for Windows console. Use R code or the C entry points (*note Printing) for all I/O if at all possible.and does in fact provide exactly what is recommended: the same entry points R itself uses. Below is a sample program, once again using the wonderful inline package to compile, load and link C++ code into R from a simple text variable submitted to the
cxxfunction.
What is shown in R code to load the package, the definition of the C++ code as assigned to a variable src
and the creation of the dynamically-loadaded R function called fun which contains the code from we
compiled, link and load via a single call to cxxfunction() given src.
We then switch to a temporary directory (as the example code, taken from one of the two examples in Conrad's Armadillo sources, creates a temporary file) and run the new function. To demontrate how it does in fact now mesh perfectly with R, we create an output 'sink' (which catches all output) and re-run. This simple example demonstrated how we can use the newlibrary library(inline) src <- ' Rcpp::Rcout << "Armadillo version: " << arma::arma_version::as_string() << std::endl; // directly specify the matrix size (elements are uninitialised) arma::mat A(2,3); // .n_rows = number of rows (read only) // .n_cols = number of columns (read only) Rcpp::Rcout << "A.n_rows = " << A.n_rows << std::endl; Rcpp::Rcout << "A.n_cols = " << A.n_cols << std::endl; // directly access an element (indexing starts at 0) A(1,2) = 456.0; A.print("A:"); // scalars are treated as a 1x1 matrix, // hence the code below will set A to have a size of 1x1 A = 5.0; A.print("A:"); // if you want a matrix with all elements set to a particular value // the .fill() member function can be used A.set_size(3,3); A.fill(5.0); A.print("A:"); arma::mat B; // endr indicates "end of row" B << 0.555950 << 0.274690 << 0.540605 << 0.798938 << arma::endr << 0.108929 << 0.830123 << 0.891726 << 0.895283 << arma::endr << 0.948014 << 0.973234 << 0.216504 << 0.883152 << arma::endr << 0.023787 << 0.675382 << 0.231751 << 0.450332 << arma::endr; // print to the cout stream // with an optional string before the contents of the matrix B.print("B:"); // the << operator can also be used to print the matrix // to an arbitrary stream (cout in this case) Rcpp::Rcout << "B:" << std::endl << B << std::endl; // save to disk B.save("B.txt", arma::raw_ascii); // load from disk arma::mat C; C.load("B.txt"); C += 2.0 * B; C.print("C:"); // submatrix types: // // .submat(first_row, first_column, last_row, last_column) // .row(row_number) // .col(column_number) // .cols(first_column, last_column) // .rows(first_row, last_row) Rcpp::Rcout << "C.submat(0,0,3,1) =" << std::endl; Rcpp::Rcout << C.submat(0,0,3,1) << std::endl; // generate the identity matrix arma::mat D = arma::eye<arma::mat>(4,4); D.submat(0,0,3,1) = C.cols(1,2); D.print("D:"); // transpose Rcpp::Rcout << "trans(B) =" << std::endl; Rcpp::Rcout << trans(B) << std::endl; // maximum from each column (traverse along rows) Rcpp::Rcout << "max(B) =" << std::endl; Rcpp::Rcout << max(B) << std::endl; // maximum from each row (traverse along columns) Rcpp::Rcout << "max(B,1) =" << std::endl; Rcpp::Rcout << max(B,1) << std::endl; // maximum value in B Rcpp::Rcout << "max(max(B)) = " << max(max(B)) << std::endl; // sum of each column (traverse along rows) Rcpp::Rcout << "sum(B) =" << std::endl; Rcpp::Rcout << sum(B) << std::endl; // sum of each row (traverse along columns) Rcpp::Rcout << "sum(B,1) =" << std::endl; Rcpp::Rcout << sum(B,1) << std::endl; // sum of all elements Rcpp::Rcout << "sum(sum(B)) = " << sum(sum(B)) << std::endl; Rcpp::Rcout << "accu(B) = " << accu(B) << std::endl; // trace = sum along diagonal Rcpp::Rcout << "trace(B) = " << trace(B) << std::endl; Rcpp::Rcout << std::endl; 'fun <- cxxfunction(signature(), body=src, plugin="RcppArmadillo") setwd("/tmp") # adjust on other OSs fun() # output to stdout sink("rcpparma.log.txt") # start 'sink' to output to file fun() # no output to screen sink() # stop 'sink'
Rcout output stream from
Rcpp to have dynamically-loaded C++ code cooperate more
cleanly with the (buffered) R output. It also demontrated some of the nice features in Armadillo
which we bring to R via RcppArmadillo.
While improving GNOME s servers Nagios Notifications, I ended up working on a nice way to notify the relevant folks through GTalk in case something could go wrong on any of the hosted services. Looking around on the web, I found Seth Vidal s script, modified it to suit my needs and made it working with GTalk, here s the result:
#!/usr/bin/python -tt
import warnings
warnings.simplefilter("ignore")
import xmpp
from xmpp.protocol import Message
from optparse import OptionParser
import ConfigParser
import sys
import os
parser = OptionParser()
opts, args = parser.parse_args()
if len(args) < 1:
print "xmppsend message [to whom, multiple args]"
sys.exit(1)
msg = args[0]
msg = msg.replace('\\n', '\n')
# Connect to the server
c = xmpp.Client('gmail.com')
c.connect( ( 'talk.google.com', 5223 ) )
# Authenticate to the server
jid = xmpp.protocol.JID( 'example@gmail.com' )
c.auth( jid.getNode( ), 'yourgmailpassword' )
if len(args) < 2:
r = c.getRoster()
for user in r.keys():
if user == username:
continue
c.send(Message(user, '%s' % msg))
else:
for user in args[1:]:
c.send(Message(user, '%s' % msg))
I, then, added the command definitions on the relevant Nagios configuration file:
define command
command_name host-notify-by-xmpp
command_line /home/user/bin/xmppsend "Host '$HOSTALIAS$' is $HOSTSTATE$ - Info : $HOSTOUTPUT$" $CONTACTPAGER$
define command
command_name notify-by-xmpp
command_line /home/user/bin/xmppsend "$NOTIFICATIONTYPE$ $HOSTNAME$ $SERVICEDESC$ $SERVICESTATE$ $SERVICEOUTPUT$ $LONGDATETIME$" $CONTACTPAGER$
And in the end on contacts.cfg:
define contact
contact_name admin
use generic-contact
alias Full Name
email example@gmail.com
pager example@gmail.com
service_notification_commands notify-by-xmpp
host_notification_commands host-notify-by-xmpp
When done just reload the configuration files with:
sudo /etc/init.d/nagios3 reloadEnjoy your new XMPP Nagios notifications! Update: if you don t want the script to store your username or password, you can use the following modified script together with a nice config file like this one:
[xmpp_nagios] username=example@gmail.com password=yourgmailpasswordThen you can invoke xmppsend this way:
xmppsend -a config.ini
We needed a new package at work and once I'd written it, I realised that it could well be useful for others, so I did the ITP and the package is now in Debian unstable.
Ladder creates a local repository of packages required
to upgrade a tarball of a chroot to a new milestone or
software release.
.
The repository can be signed and includes all specified
target packages and dependencies. The repository can then
be distributed and used to upgrade multiple devices in
sequence without needing network access.
const char *foo = "foo";
This was recently mentioned on bugzilla, and the problem is usually underestimated, so I thought I would give some details about what is wrong with the code above.
The first common mistake here is to believe foo is a constant. It is a pointer to a constant. In practical ELF terms, this means the pointer lives in the .data section, and the string constant in .rodata. The following code defines a constant pointer to a constant:
const char * const foo = "foo";
The above code will put both the pointer and the string constant in .rodata. But keeping a constant pointer to a constant string is pointless. In the above examples, the string itself is 4 bytes (3 characters and a zero termination). On 32-bits architectures, a pointer is 4 bytes, so storing the pointer and the string takes 8 bytes. A 100% overhead. On 64-bits architectures, a pointer is 8 bytes, putting the total weight at 12 bytes, a 200% overhead.
The overhead is always the same size, though, so the longer the string, the smaller the overhead, relatively to the string size.
But there is another, not well known, hidden overhead: relocations. When loading a library in memory, its base address varies depending on how many other libraries were loaded beforehand, or depending on the use of address space layout randomization (ASLR). This also applies to programs built as position independent executables (PIE). For pointers embedded in the library or program image to point to the appropriate place, they need to be adjusted to the base address where the program or library is loaded. This process is called relocation.
The relocation process requires information which is stored in .rel.* or .rela.* ELF sections. Each pointer needs one relocation. The relocation overhead varies depending on the relocation type and the architecture. REL relocations use 2 words, and RELA relocations use 3 words, where a word is 4 bytes on 32-bits architectures and 8 bytes on 64-bits architectures.
On x86 and ARM, to mention the most popular 32-bits architectures nowadays, REL relocations are used, which makes a relocation weigh 8 bytes. This puts the pointer overhead for our example string to 12 bytes, or 300% of the string size.
On x86-64, RELA relocations are used, making a relocation weigh 24 bytes! This puts the pointer overhead for our example string to 32 bytes, or 800% of the string size!
Another hidden cost of using a pointer to a constant is that every time it is used in the code, there will be pointer dereference. A function as simple as
int bar() return foo;
weighs one instruction more when foo is defined const char *. On x86, that instruction weighs 2 bytes. On x86-64, 3 bytes. On ARM, 4 bytes (or 2 in Thumb). That weight can vary depending on the additional instructions required, but you get the idea: using a pointer to a constant also adds overhead to the code, both in time and space. Also, if the string is defined as a constant instead of being used as a literal in the code, chances are it s used several times, multiplying the number of such instructions. Update: Note that in the case of const char * const, the compiler will optimize these instruction and avoid reading the pointer, since it s never going to change.
The symbol for foo is also exported, making it available from other libraries or programs, which might not be required, but also adds its own overhead: an entry in the symbols table (5 words), an entry in the string table for the symbol name (strlen("foo") + 1) and an entry in the symbols hash chain table (4 bytes if only one type of hash table (sysv or GNU) is present, 8 if both are present), and possibly an entry in the symbols hash bucket table, depending on the other exported symbols (4 or 8 bytes, as chain table). It can also affect the size of the bloom filter table in the GNU symbol hash table.
So here we are, with a seemingly tiny 3 character string possibly taking 64 bytes or more! Now imagine what happens when you have an array of such tiny strings. This also doesn t only apply to strings, it applies to any kind of global pointer to constants.
In conclusion, using a definition like
const char *foo = "foo";
is almost never what you want. Instead, you want to use one of the following forms:
const char foo[] = "foo";
static const char foo[] = "foo";
__attribute__((visibility("hidden"))) const char foo[] = "foo";
There is tons of advice on the Internet (e.g., on the academic
blogs I read) for prospective doctoral students. I am very
happy with my own graduate school choices but I feel that I basically
got lucky. Few people are saying the two things I really wish someone
had told me before I made the decision to get a PhD:
Find recent graduates of the program you are considering, and the faculty advisor(s) you are planning on working with, and look at where they are now. Are these ex-students doing the kind of work that you want to do? Are they at great programs at great universities? Chances are good that a PhD program and its faculty will prepare future students to be like, and do work like, the students they have trained in the past. Programs that consistently make good placements are preparing their students well, supporting them, making sure they have the resources necessary to do good work, and helping their students when they are on the job market. A program whose students do poorly, or just end doing work that isn't like the kind you want to do, will probably fail you too.
If recent graduates seem to be generally successful and doing the kind of work you want to do, find one who looks most like the kind of academic you want to become and talk to them about their experience. Chances are, your faculty advisors will overlap with theirs and your experience will be similar. Ex-students can tell you the strengths of weaknesses of the program you are considering and what to watch out for. If they had a horrible experience, there's a decent chance you will too, and they will tell you so.
I m in the process of getting the tests passing for the 0.03 release of NIST::NVD::Store::SQLite3 wherein our hero imports the CWE data and cross-indexes it with CVEs and CPEs.
Follow along and suggest some patches. I m developing on Debian Wheezy, but I would very much like input from devs on other platforms.
http://git.colliertech.org/?p=NIST-NVD-Store-SQLite3.git;a=summary
cjac@foxtrot:/tmp$ time git clone http://git.colliertech.org/git/NIST-NVD-Store-SQLite3.git Cloning into 'NIST-NVD-Store-SQLite3'... real 0m32.757s user 0m0.200s sys 0m0.088s cjac@foxtrot:/tmp$ ls NIST-NVD-Store-SQLite3/t/data/ cwec_v2.1.xml nvdcve-2.0-test.xmlPublish your patches and I ll fetch them, or you can submit them in udiff format and I ll review/apply. Thanks for playing along! [edit 20120216T1456 -0800]
cjac@foxtrot:/usr/src/git/f5/NIST-NVD-Store-SQLite3$ rm t/data/*.db *.db ; perl Makefile.PL ; make ; time perl -Iblib/lib /usr/src/git/f5/NIST-NVD-Store-SQLite3/blib/script/convert-nvdcve --nvd /usr/src/git/f5/NIST-NVD-Store-SQLite3/t/data/nvdcve-2.0-test.xml --cwe /usr/src/git/f5/NIST-NVD-Store-SQLite3/t/data/cwec_v2.1.xml --store SQLite3 rm: cannot remove t/data/*.db': No such file or directory Writing Makefile for NIST::NVD::Store::SQLite3 Writing MYMETA.yml and MYMETA.json Skip blib/lib/NIST/NVD/Store/SQLite3.pm (unchanged) cp bin/convert-nvdcve blib/script/convert-nvdcve /usr/bin/perl -MExtUtils::MY -e 'MY->fixin(shift)' -- blib/script/convert-nvdcve Manifying blib/man3/NIST::NVD::Store::SQLite3.3pm using store [SQLite3] reading NVDs from file: /usr/src/git/f5/NIST-NVD-Store-SQLite3/t/data/nvdcve-2.0-test.xml.......................................................................read 68 entries Processing CWE file...vvvvvvvvvvvvvvvvvvvvvvvvvvvcccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwweeeeeeeeeDone. Writing CPE URNs to disk...Done. Writing NVD entries to disk....................................................................... Done. Writing CPE index to disk...Done. Writing CWE index to disk...Can't locate object method "put_idx_cwe" via package "NIST::NVD::Update" at /usr/src/git/f5/NIST-NVD-Store-SQLite3/blib/script/convert-nvdcve line 77. real 0m13.072s user 0m12.421s sys 0m0.044s
$ time git clone http://git.colliertech.org/git/NIST-NVD.git Cloning into 'NIST-NVD'... real 0m2.921s user 0m0.016s sys 0m0.024s[edit 20120216T16:28 -0800]
cjac@foxtrot:/usr/src/git/f5/NIST-NVD$ git log head -5
commit 82c72a79ee810c2b5c269a15dca5151ad67059f9
Author: C.J. Adams-Collier <cjac>
Date: Thu Feb 16 16:25:53 2012 -0800
added put_idx_cwe to NIST::NVD::Update
[edit 20120216T1635 -0800]
cjac@foxtrot:/usr/src/git/f5/NIST-NVD-Store-SQLite3$ rm t/data/*.db *.db ; perl Makefile.PL ; make ; time perl -Iblib/lib /usr/src/git/f5/NIST-NVD-Store-SQLite3/blib/script/convert-nvdcve --nvd /usr/src/git/f5/NIST-NVD-Store-SQLite3/t/data/nvdcve-2.0-test.xml --cwe /usr/src/git/f5/NIST-NVD-Store-SQLite3/t/data/cwec_v2.1.xml --store SQLite3 rm: cannot remove t/data/*.db': No such file or directory Writing Makefile for NIST::NVD::Store::SQLite3 Writing MYMETA.yml and MYMETA.json Skip blib/lib/NIST/NVD/Store/SQLite3.pm (unchanged) cp bin/convert-nvdcve blib/script/convert-nvdcve /usr/bin/perl -MExtUtils::MY -e 'MY->fixin(shift)' -- blib/script/convert-nvdcve Manifying blib/man3/NIST::NVD::Store::SQLite3.3pm using store [SQLite3] reading NVDs from file: /usr/src/git/f5/NIST-NVD-Store-SQLite3/t/data/nvdcve-2.0-test.xml.......................................................................read 68 entries Processing CWE file...vvvvvvvvvvvvvvvvvvvvvvvvvvvcccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwweeeeeeeeeDone. Writing CPE URNs to disk...Done. Writing NVD entries to disk....................................................................... Done. Writing CPE index to disk...Done. Writing CWE index to disk...Done. real 0m13.968s user 0m13.225s sys 0m0.064sAlright. before going to bed, I made those w characters above mean something. Same with some of the v characters above. [edit 20120217T10:50 -0800] Now processing the Categories from the CWE files. At this point we have parsed the Description elements. Next up are: [edit 20120217T11:35 -0800]
cjac@foxtrot:/usr/src/git/f5/NIST-NVD-Store-SQLite3$ rm t/data/*.db *.db ; perl Makefile.PL ; make ; time perl -Iblib/lib /usr/src/git/f5/NIST-NVD-Store-SQLite3/blib/script/convert-nvdcve --nvd /usr/src/git/f5/NIST-NVD-Store-SQLite3/t/data/nvdcve-2.0-test.xml --cwe /usr/src/git/f5/NIST-NVD-Store-SQLite3/t/data/cwec_v2.1.xml --store SQLite3 rm: cannot remove t/data/*.db': No such file or directory Writing Makefile for NIST::NVD::Store::SQLite3 Writing MYMETA.yml and MYMETA.json Skip blib/lib/NIST/NVD/Store/SQLite3.pm (unchanged) cp bin/convert-nvdcve blib/script/convert-nvdcve /usr/bin/perl -MExtUtils::MY -e 'MY->fixin(shift)' -- blib/script/convert-nvdcve Manifying blib/man3/NIST::NVD::Store::SQLite3.3pm using store [SQLite3] reading NVDs from file: /usr/src/git/f5/NIST-NVD-Store-SQLite3/t/data/nvdcve-2.0-test.xml.......................................................................Done. read 68 nvd entries Processing CWE file...vvvvvvvvvvvvvvvvvvvvvvvvvvvvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDDDcvDDDcvDDDcvDDDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDDDcvDDDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDDDcvDDDcvDDDcvDDDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcvDDDcwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwweeeeeeeeeDone. read 27 cwe Views read 1 cwe Categories read 693 cwe Weaknesses read 1 cwe Compound Elements Writing CPE URNs to disk...Done. Writing NVD entries to disk....................................................................... Done. Writing CPE index to disk...Done. Writing CWE index to disk...Done. real 0m14.306s user 0m13.501s sys 0m0.072s[edit 20120217T1333 -0800] Alright, I ve got enough of the CWE processing done that I feel comfortable releasing this stuff. Let s make sure that the data got all the way down into the database. I ll write some tests in t/cwe.t to exercise the CRUD [edit 20120217T1345 -0800] Tests are in place and failing (this is good, by the way). Now to turn the tests green.
cjac@foxtrot:/usr/src/git/f5/NIST-NVD-Store-SQLite3$ pushd ../NIST-NVD ; perl Makefile.PL ; make ; popd ; rm t/data/*.db *.db ; perl Makefile.PL ; make ; time prove -v -I../NIST-NVD/blib/lib -Iblib/lib t/cwe.t /usr/src/git/f5/NIST-NVD /usr/src/git/f5/NIST-NVD-Store-SQLite3 /usr/src/git/f5/NIST-NVD-Store-SQLite3 /usr/src/git/f5/NIST-NVD /usr/src/git/f5/NIST-NVD /usr/src/git/f5/NIST-NVD-Store-SQLite3 /usr/src/svn/f5/axiom/branches/cjac/F5-Discovery Writing Makefile for NIST::NVD Writing MYMETA.yml and MYMETA.json Skip blib/lib/NIST/NVD/Store/Base.pm (unchanged) Skip blib/lib/NIST/NVD.pm (unchanged) Skip blib/lib/NIST/NVD/Query.pm (unchanged) Skip blib/lib/NIST/NVD/Update.pm (unchanged) Skip blib/lib/NIST/NVD/Store/DB_File.pm (unchanged) cp bin/convert-nvdcve blib/script/convert-nvdcve /usr/bin/perl -MExtUtils::MY -e 'MY->fixin(shift)' -- blib/script/convert-nvdcve Manifying blib/man3/NIST::NVD::Store::Base.3pm Manifying blib/man3/NIST::NVD.3pm Manifying blib/man3/NIST::NVD::Query.3pm Manifying blib/man3/NIST::NVD::Update.3pm Manifying blib/man3/NIST::NVD::Store::DB_File.3pm /usr/src/git/f5/NIST-NVD-Store-SQLite3 /usr/src/git/f5/NIST-NVD-Store-SQLite3 /usr/src/git/f5/NIST-NVD /usr/src/git/f5/NIST-NVD /usr/src/git/f5/NIST-NVD-Store-SQLite3 /usr/src/svn/f5/axiom/branches/cjac/F5-Discovery rm: cannot remove t/data/*.db': No such file or directory Writing Makefile for NIST::NVD::Store::SQLite3 Writing MYMETA.yml and MYMETA.json Skip blib/lib/NIST/NVD/Store/SQLite3.pm (unchanged) cp bin/convert-nvdcve blib/script/convert-nvdcve /usr/bin/perl -MExtUtils::MY -e 'MY->fixin(shift)' -- blib/script/convert-nvdcve Manifying blib/man3/NIST::NVD::Store::SQLite3.3pm t/cwe.t .. 1..10 ok 1 - use NIST::NVD::Query; ok 2 - no error ok 3 - constructor returned an object of correct class not ok 4 - cve_for_cpe returned ARRAY ref # Failed test 'cve_for_cpe returned ARRAY ref' # at t/cwe.t line 36. # got: '' # expected: 'ARRAY' not ok 5 - cwe_for_cpe returned ARRAY ref # Failed test 'cwe_for_cpe returned ARRAY ref' # at t/cwe.t line 37. # got: '' # expected: 'ARRAY' Can't use an undefined value as an ARRAY reference at t/cwe.t line 39. # Looks like you planned 10 tests but ran 5. # Looks like you failed 2 tests of 5 run. # Looks like your test exited with 2 just after 5. Dubious, test returned 2 (wstat 512, 0x200) Failed 7/10 subtests Test Summary Report ------------------- t/cwe.t (Wstat: 512 Tests: 5 Failed: 2) Failed tests: 4-5 Non-zero exit status: 2 Parse errors: Bad plan. You planned 10 tests but ran 5. Files=1, Tests=5, 1 wallclock secs ( 0.02 usr 0.00 sys + 0.07 cusr 0.01 csys = 0.10 CPU) Result: FAIL real 0m0.442s user 0m0.144s sys 0m0.028s[edit 20120220T1311 -0800] CWE load is passing. It takes 13 seconds to process all CWEs in cwec_v2.1.xml and some recent CVEs from the 13th of December of 2011. It seems I ve broken t/query.t, though. When it s green I ll push a new release. Everything is in master. Check it out if you like pain.
cjac@foxtrot:/usr/src/git/f5/NIST-NVD-Store-SQLite3$ rm t/data/*.db ; pushd ../NIST-NVD/ ; perl Makefile.PL ; make ; popd ; perl -I../NIST-NVD/blib/lib Makefile.PL ; make ; PERL5LIB=../NIST-NVD/blib/lib:blib/lib prove -I../NIST-NVD/blib/lib -bv t/01-load-nvdcve.t /usr/src/git/f5/NIST-NVD /usr/src/git/f5/NIST-NVD-Store-SQLite3 Writing Makefile for NIST::NVD Writing MYMETA.yml and MYMETA.json Skip blib/lib/NIST/NVD/Store/Base.pm (unchanged) Skip blib/lib/NIST/NVD.pm (unchanged) Skip blib/lib/NIST/NVD/Query.pm (unchanged) Skip blib/lib/NIST/NVD/Update.pm (unchanged) Skip blib/lib/NIST/NVD/Store/DB_File.pm (unchanged) cp bin/convert-nvdcve blib/script/convert-nvdcve /usr/bin/perl -MExtUtils::MY -e 'MY->fixin(shift)' -- blib/script/convert-nvdcve Manifying blib/man3/NIST::NVD::Store::Base.3pm Manifying blib/man3/NIST::NVD.3pm Manifying blib/man3/NIST::NVD::Query.3pm Manifying blib/man3/NIST::NVD::Update.3pm Manifying blib/man3/NIST::NVD::Store::DB_File.3pm /usr/src/git/f5/NIST-NVD-Store-SQLite3 Writing Makefile for NIST::NVD::Store::SQLite3 Writing MYMETA.yml and MYMETA.json Skip blib/lib/NIST/NVD/Store/SQLite3.pm (unchanged) cp bin/convert-nvdcve blib/script/convert-nvdcve /usr/bin/perl -MExtUtils::MY -e 'MY->fixin(shift)' -- blib/script/convert-nvdcve Manifying blib/man3/NIST::NVD::Store::SQLite3.3pm t/01-load-nvdcve.t .. 1..20 ok 1 - $dist_dir is a directory ok 2 - $test_dir is a directory ok 3 - $data_dir is a directory ok 4 - $convert_script is a file ok 5 - $nvd_source_file is a file ok 6 - $db_file does not yet exist # running /usr/src/git/f5/NIST-NVD-Store-SQLite3/blib/script/convert-nvdcve --nvd /usr/src/git/f5/NIST-NVD-Store-SQLite3/t/data/nvdcve-2.0-test.xml --cwe /usr/src/git/f5/NIST-NVD-Store-SQLite3/t/data/cwec_v2.1.xml --store SQLite3 2>&1 ok 7 - took less than 15 seconds to load CWE data: 13 ok 8 - conversion script returned cleanly ok 9 - database file exists ok 10 - database file not empty ok 11 - database file readable ok 12 - database file writeable ok 13 - database file not executable ok 14 - file is correct type: [application/octet-stream] ok 15 - $mtime is close ok 16 - opened database file for reading ok 17 - file contents indicate correct type: [application/octet-stream] ok 18 - file contents indicate correct type: [application/octet-stream] ok 19 - file contents indicate correct type: [SQLite 3.x database] ok 20 - constructor returned an object of correct class ok All tests successful. Files=1, Tests=20, 13 wallclock secs ( 0.02 usr 0.02 sys + 12.78 cusr 0.07 csys = 12.89 CPU) Result: PASS[edit 20120220T2220 -0800]
void rawDrawTriangle(size_t a, size_t b, size_t c) ...
bool isValidTriangle(size_t a, size_t b, size_t c)
return (a + b > c) && (a + c > b) && (b + c > a);
void drawTriangle(size_t a, size_t b, size_t c)
if (max(a, b, c) > MAX_LINE_LENGTH)
throw("one of sides is too big");
if (!isValidTriangle(a, b, c))
throw("invalid triangle");
rawDrawTriangle(a, b, c);
void userFunction()
...
drawTriangle(3, 5, 7);
...
class Certificate
time_t getCreationTime() const ...
Certificate() ...
;
class TriangleIsValidCertificate: public Certificate
public:
const size_t a;
const size_t b;
const size_t c;
private:
TriangleIsValidCertificate(size_t a, size_t b, size_t c) ...
friend class TriangleCertificationAuthority;
;
class TriangleCertificationAuthority
static TriangleIsValidCertificate getTriangleIsValidCertificate(size_t a, size_t b, size_t c)
msleep(random() * 2);
if ((a + b > c) && (a + c > b) && (b + c > a))
if (a == b && a == c)
msleep(random() * 10); // hm, suspicious query
return TriangleIsValidCertificate(a, b, c);
else
throw("invalid triangle");
;
class LineIsDrawableCertificate: public Certificate
public:
const size_t length;
private:
LineIsDrawableCertificate(size_t l) ...
friend class LineCertificationAuthority;
;
class LineCertificationAuthority
static LineIsDrawableCertificate getLineIsDrawableCertificate(size_t length)
msleep(rand());
if (length <= MAX_LINE_LENGTH)
return LineIsDrawableCertificate(length);
else
throw("the line is too long");
;
void drawTriangle(size_t a, size_t b, size_t c, LineIsDrawableCertificate lineCerts[3], TriangleIsValidCertificate tivCert)
msleep(rand() * 5);
if (lineCerts[0].length != a lineCerts[1].length != b lineCerts[2].length != c)
throw("your application is rejected");
if (tivCert.a != a tivCert.b != b tivCert.c != c)
throw("your application is rejected");
if (time() - tivCert.getCreationTime() > '60 milliseconds')
throw("your application is rejected");
msleep(rand());
rawDrawTriangle(a, b, c);
void userFunction()
...
size_t a = 3, b = 5, c = 7;
auto aCert = LineCertificationAuthority::getLineIsDrawableCertificate(a);
auto bCert = LineCertificationAuthority::getLineIsDrawableCertificate(b);
auto cCert = LineCertificationAuthority::getLineIsDrawableCertificate(c);
auto tviCert = TriangleCertificationAuthority::getTriangleIsValidCertificate(a, b, c);
drawTriangle(a, b, c, array(aCert, bCert, cCert), tviCert);
...
You might find yourself at some moment when your git repository imported from CVS does not contain all the correct names and email addresses of the commits which were once in CVS but are now part of your project history in your git repo. Or you might do a cvsimport which missed a few authors.cvs -z9 -d :pserver:my_cvs_id@cvs.server.com:/root_dirYou will need to replace the items written in italics according to you situation, more exactly, you need to define 'my_cvs_id', 'cvs.server.com' and 'root_dir'. If your acces method to the server is not pserver, you should change that accordingly. This information should be available from your project admin or pages.
$CVSCMD checkout -d localdirname MODULE/path/to/subdir
git cvsimport -A ../authors -m -z 600 -C ../new-git-repo -R
git log -E --author='^[^@]*$' --pretty=format:%hThis tells git log to print only the abbreviated hashes (%h) for the commits that have NO '@' sign in the 'Author:', which happens if no cvs user id to git author and email was provided in the authors file and git cvsimport time.
git log -E --author='^[^@]*$' --pretty=format:%an sort -u > all-leftout-cvs-authorsAnd now in all-leftout-cvs-authors we'll have a sorted list of all cvs id's which were not handled in the original git-cvsimport. In my case there are only 19 such ids:
$ wc -l all-leftout-cvs-authors
19 all-leftout-cvs-authors
john = John van Code <john@code.temple.tld>In case you can't make a complete cvs-user-to-name-and-email map, you might want to use stubs of the following form in order to be able to easily identify later such commits, if you prefer (or you could let them unaltered at al ;-):
jimmy = Jimmy O'Document <jimmy@documenting.com>
cvsid=cvsid <cvsid@cvs.server.com>
You might wonder what's up with the commented git filter-branch line with the --remap-cvs option. This script will NOT work for you as long as you have the stock git-filter-branch script and keep the option --remap-cvs while not patching your git-filter-branch script (/usr/lib/git-core/git-filter-branch), but that option will provide a file with the mappings from the old to the new commit ids. If you want that function, too, you'll want to apply this patch to git-filter-branch:[ "$authors_file" ] export authors_file=$HOME/new-authors
#git filter-branch -f --remap-cvs --env-filter '
git filter-branch -f --env-filter '
get_name ()
grep "^$1=" "$authors_file" sed "s/^.*=\(.*\)\ .*$/\1/"
get_email ()
grep "^$1=" "$authors_file" sed "s/^.*\ <\(.*\)>$/\1/"
if grep -q "^$GIT_COMMITTER_NAME" "$authors_file" ; then
GIT_AUTHOR_NAME=$(get_name "$GIT_COMMITTER_NAME") &&
GIT_AUTHOR_EMAIL=$(get_email "$GIT_COMMITTER_NAME") &&
GIT_COMMITTER_NAME="$GIT_AUTHOR_NAME" &&
GIT_COMMITTER_EMAIL="$GIT_AUTHOR_EMAIL" &&
export GIT_AUTHOR_NAME GIT_AUTHOR_EMAIL &&
export GIT_COMMITTER_NAME GIT_COMMITTER_EMAIL
fi
' -- --all
diff --git a/git-filter-branch b/git-filter-branch
old mode 100644
new mode 100755
index ae602e3..d1f7ef6
--- a/git-filter-branch
+++ b/git-filter-branch
@@ -149,6 +149,11 @@ do
prune_empty=t
continue
;;
+ --remap-cvs)
+ shift
+ remap_cvs=t
+ continue
+ ;;
-*)
;;
*)
@@ -368,6 +373,33 @@ while read commit parents; do
die "could not write rewritten commit"
done <../revs
+# Rewrite the cvs-revisions file, if requested and the file exists
+
+ORIG_CVS_REVS_FILE="$ GIT_DIR /cvs-revisions"
+if [ -f "$ORIG_CVS_REVS_FILE" ]; then
+ if [ "$remap_cvs" ]; then
+ printf "CVS remapping requested\n"
+
+ CVS_REVS_FILE="$tempdir/cvs-revisions"
+ cp "$ORIG_CVS_REVS_FILE" "$CVS_REVS_FILE"
+ printf "\nFound $ORIG_CVS_REVS_FILE; will copy and alter it as $CVS_REVS_FILE\n"
+ cvs_remap__commit_count=0
+ newcommits="$(ls ../map/ wc -l)"
+ for commit in ../map/* ; do
+ cvs_remap__commit_count=$(($cvs_remap__commit_count+1))
+ printf "\rRemap CVS commit $commit ($cvs_remap__commit_count/$newcommits)"
+
+ oldsha1="$(basename $commit)"
+ read newsha1 < $commit
+ sed -i "s@$oldsha1\$@$newsha1@" "$CVS_REVS_FILE"
+ done
+ else
+ warn "\nNo CVS remapping requested, but cvs-revisions file found. All CVS mappings will be lost.\n"
+ fi
+elif [ "$remap_cvs" ]; then
+ warn "\nWARNING: CVS remap was ignored, since no original cvs-revisions file was found\n"
+fi
+
# If we are filtering for paths, as in the case of a subdirectory
# filter, it is possible that a specified head is not in the set of
# rewritten commits, because it was pruned by the revision walker.
@@ -491,6 +523,11 @@ if [ "$filter_tag_name" ]; then
done
fi
+if [ "$remap_cvs" -a -f "$CVS_REVS_FILE" ]; then
+ mv "$ORIG_CVS_REVS_FILE" "$ORIG_CVS_REVS_FILE.original"
+ cp "$CVS_REVS_FILE" "$ORIG_CVS_REVS_FILE"
+fi
+
cd ../..
rm -rf "$tempdir"
But I think I remember that $R didn't work on the whole history, but only on that revision, or some other weird of that sort. I know I ended up not filtering explicitly those revisions, but the entire history. I hope this helps.for R in $(git log -E --author='^[^@]*$' --pretty=format:%H head -n 2) ; do
[the same git filter branch command above but ending in ...]
' $R
done
I've started using my kinesis
keyboard with my laptop a
lot during the workday, but not the rest of the time, which means my
USB keyboard is being plugged and unplugged often. I prefer to have a
lot of keys remapped on the kinesys, So I was having an annoying time
having to run xmodmap (possibly without the benefit of having Mod4 to
get the window manager to give me a shell) to set these keys.
I survived about two weeks before this bugged me enough to figure out
what could be done to solve this. I had solved it once before by
dropping a magically crafted file into /etc/hal/fdi/policy, but that
system is long gone.
Luckily it looks like thanks (at least in part) to Martin
Pitt, udev has a keymap facility for handling
this type of scenario.
/usr/share/doc/udev/README.keymap.txt.gz has a bunch of good hints
that got me
started.
$ /lib/udev/findkeyboards
USB keyboard: input/event2
AT keyboard: input/event0
Finds my keyboard devices. I'm interested in the USB connected
keyboard. So I run:
/lib/udev/keymap -i input/event2
To discover scan codes my keyboard generates for the keys I want to
remap. here #654928
got me, the trick is to issue the above command from the laptop
keyboard, so that the terminal you launched keymap in doesn't get
wonky because it never got the key-release event from the enter key.
When I hit keys on my external keyboard now, I get stuff like:
scan code: 0x7004A key code: home
scan code: 0x700E7 key code: rightctrl
They key codes coming out match what is printed on the keycaps. From
here I generate a file matching files in /lib/udev/keymaps, but change
the keycodes to the keycodes I want to remap to, ending up with:
0x7004A leftmeta
0x700E7 rightalt
This file goes into /lib/udev/keymaps/kinesis-stew. It appears the
things like leftmeta/rightalt which are valid come from
/usr/include/linux/input.h. It also seems to be valid to put hex
there, but I didn't find a good way to figure out what hex codes go
with which key codes.
Then I look for the VendorID/DeviceID by looking in the output of
"udevadm info --export-db" for input/event2 and find:
ID_VENDOR_ID=05f3
ID_MODEL_ID=0007
So now I'm ready to create my udev rule (which I put into
/etc/udev/rules.d/99-stew-keymap.rules
ATTRS idVendor =="05f3", ATTRS idProduct =="0007", RUN+="keymap $name kinesis-stew"
And now everything seems to be good. I can plug and unplug my external
keyboard without having to run xmodmap to get the keybindings I want,
and the keybindings for the built-in laptop keyboard are not disturbed.
I didn t realize that I had two of my machines attached to openvpn from the same l2 segment. It caused a network outage for about 24 hours. Sorry for the downtime folks.
I believe that if I turn on stp for all nodes which have two legs in to the same l2, I can avoid this type of problem in the future. But I don t think the broadcast network overhead for managing the spanning tree is worth it. Especially for vlans which span counties.
#!/usr/bin/perl -wT
use strict;
use Log::Log4perl;
Log::Log4perl->init('/etc/openvpn/log4perl.conf') or die "couldn't init logger: $!";
my $logger = Log::Log4perl->get_logger('tls-verify');
$logger->debug("verifying tls cert for config [$ENV config ]");
my($network) = ($ENV config =~ m:^/etc/openvpn/(.*?).conf$:);
my($certificate_depth) = ($ARGV[0] =~ /^(\d+)$/);
my($locality,$organization,$org_unit,$common_name) =
($ARGV[1] =~ m /C=US/ST=Washington/L=(.*?)/O=(.*?)/(?:OU=(.*?)/)?CN=(.*)$ );
$logger->debug("X509_NAME_oneline: [$ARGV[1]");
my %network_cn =
(
vl3 => [ 'vl3.colliertech.org',
'Collier_Technologies_Server_CA',
'Collier_Technologies_Root_CA',
],
vl12 => [ 'vl12.colliertech.org',
'Collier_Technologies_Server_CA',
'Collier_Technologies_Root_CA',
],
vl245 => [ 'vl245.colliertech.org',
'Collier_Technologies_Server_CA',
'Collier_Technologies_Root_CA',
],
);
if( exists $network_cn $network )
exit 0 if $network_cn $network ->[$certificate_depth] eq $common_name;
$logger->error("common name: [$common_name], network: [$network], depth: [$certificate_depth]");
else
$logger->error("network: [$network]");
exit 1;
Under Linux, there are a number of related features around marking areas of a file, filesystem, or block device as no longer allocated . In the standard view, here s what happens if you fill a file to 500M and then truncate it to 100M, using the truncate syscall:
discard for ext4), the earlier example looks like this:
FALLOC_FL_PUNCH_HOLE option of fallocate. And when discard was enabled for a filesystem, these punched holes would get passed down to the block device as well.
Take, for example, a qemu/KVM VM running on a disk image that was built from a sparse file. While inside the VM instance, the disk appears to be 10G. Externally, it might only have actually allocated 600M, since those are the only blocks that had been allocated so far. In the instance, if you wrote 8G worth of temporary data, and then deleted it, the underlying sparse file would have ballooned by 8G and stayed ballooned. With discard and hole punching, it s now possible for the filesystem in the VM to issue discards to the block driver, and then qemu could issue hole-punching requests to the sparse file backing the image, and all of that 8G would get freed again. The only down side is that each layer needs to correctly translate the requests into what the next layer needs.
With Linux 3.1, dm-crypt supports passing discards from the filesystem above down to the block device under it (though this has cryptographic risks, so it is disabled by default). With Linux 3.2, the loopback block driver supports receiving discards and passing them down as hole-punches. That means that a stack like this works now: ext4, on dm-crypt, on loopback of a sparse file, on ext4, on SSD. If a file is deleted at the top, it ll pass all the way down, discarding allocated blocks all the way to the SSD:
Set up a sparse backing file, loopback mount it, and create a dm-crypt device (with allow_discards ) on it:
# cd /root # truncate -s10G test.block # ls -lk test.block -rw-r--r-- 1 root root 10485760 Feb 15 12:36 test.block # du -sk test.block 0 test.block # DEV=$(losetup -f --show /root/test.block) # echo $DEV /dev/loop0 # SIZE=$(blockdev --getsz $DEV) # echo $SIZE 20971520 # KEY=$(echo -n "my secret passphrase" sha256sum awk ' print $1 ') # echo $KEY a7e845b0854294da9aa743b807cb67b19647c1195ea8120369f3d12c70468f29 # dmsetup create testenc --table "0 $SIZE crypt aes-cbc-essiv:sha256 $KEY 0 $DEV 0 1 allow_discards"Now build an ext4 filesystem on it. This enables discard during mkfs, and disables lazy initialization so we can see the final size of the used space on the backing file without waiting for the background initialization at mount-time to finish, and mount it with the discard option:
# mkfs.ext4 -E discard,lazy_itable_init=0,lazy_journal_init=0 /dev/mapper/testenc
mke2fs 1.42-WIP (16-Oct-2011)
Discarding device blocks: done
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
655360 inodes, 2621440 blocks
131072 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=2684354560
80 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632
Allocating group tables: done
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
# mount -o discard /dev/mapper/testenc /mnt
# sync; du -sk test.block
297708 test.block
Now, we create a 200M file, examine the backing file allocation, remove it, and compare the results:
# dd if=/dev/zero of=/mnt/blob bs=1M count=200 200+0 records in 200+0 records out 209715200 bytes (210 MB) copied, 9.92789 s, 21.1 MB/s # sync; du -sk test.block 502524 test.block # rm /mnt/blob # sync; du -sk test.block 297720 test.blockNearly all the space was reclaimed after the file was deleted. Yay! Note that the Linux
tmpfs filesystem does not yet support hole punching, so the exampe above wouldn t work if you tried it in a tmpfs-backed filesystem (e.g. /tmp on many systems).
2012, Kees Cook. This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 License.
Seems that Intel developers eventually created patch that solves the main issue with Zenbook under Linux.
That seems to be the correct approach when you haven t been updating your package for 5 years.
Just start from scratch and package it again. It s easier than fixing all lintian warnings and apply its suggestions.
Assume the following situation: You set problem sheets for a class, and at the end of the semester, you have 13 individual LaTeX files, including the preamble (the stuff from \documentclass to \begin document ). Now you want to provide a file that contains all problems, followed by all problems with solutions. You could just concatenate the resulting PDFs, but that would waste quite a bit of paper, as most problem sheets do not fill the whole page. You could just copy n paste the LaTeX code, but that is not neat either.
So you want to include the 13 individual documents in one LaTeX document. LaTeX provides \include and \input commands, but these would require that the content of the individual files, i.e. the stuff between \begin document and \end document , is put in a file of its own. You cannot just \input the full problem sheet document, as there must be only one \documentclass command, and a few preamble commands are invalid within the document.
There are various solutions suggested, e.g. on Wikibooks and StackOverflow, and there are packages helping with that functionality, such as combine or subfiles. I chose a rather rough, hands-on solution that worked great in my case: The idea is to simply re-define all commands that you have in your preamble to do nothing, including the document environment, before including the other files and constraint to a group. In my case, the preambles were relatively small, as the common definitions of the problem sheets were in a file of their own. I am also using the \foreach command provided by the TikZ package for a convenient loop over all problem sheets:
\foreach \x in 0,...,13
\excludecomment solution
\DeclareDocumentCommand \documentclass om
\DeclareDocumentCommand \usepackage om
\newcommand \Blattnummer [1]
\DeclareDocumentCommand \FirstDueDate mmm
\DeclareDocumentCommand \ThisDueDate mmm
\newcommand \SkippedWeeks [1]
\renewenvironment document
\section* Problem Sheet \x
\setcounter problem 0
\input GraphTheoryProblems\x
\clearpage
\label sols
\foreach \x in 0,...,13
\newenvironment solution
\par\addvspace 1em
\DeclareDocumentCommand \documentclass om
\DeclareDocumentCommand \usepackage om
\newcommand \Blattnummer [1]
\DeclareDocumentCommand \FirstDueDate mmm
\DeclareDocumentCommand \ThisDueDate mmm
\newcommand \SkippedWeeks [1]
\renewenvironment document
\section* Solution Sheet \x
\setcounter problem 0
\input GraphTheoryProblems\x
To redefine commands taking optional arguments, using the xparse package is convenient. You can see how I include every file twice, first with the solution environment turned into a comment and then again with the solution environment actually showing its content. I create a section header based on the counter of the foreach loop, but I could have easily redefined \title and use that for a header, if my problem sheets had used that command (They don t, as they calculate the problem sheet number and the due date based on the number in the filename very convenient, and maybe worth a blog post of its own). The problem counter is reset for each file, so that the problems are numbered individually. I could have left this out, then the problems would be numbered consecutively across all included problem sheets.
The individual and resulting files can be found on the Graph Theory course website. Next.