.::t3rmin4t0r::.
< July 2008
SuMoTuWeThFrSa
   1 2 3 4 5
6 7 8 9101112
13141516171819
20212223242526
2728293031  

Tue, 22 Jul 2008:

No Rest for the Wicked

What a month! First week spent far far away from my worries in Ladakh, a week of mourning my grandmother's death in Cochin, a week (hardly enough) in Bangalore and now I'm in Portland. Trying to adjust my sleep-cycle with the help of coffee and the lack-there-of. Wasn't too bad though, the CX flight had episodes of Life in Cold Blood, Scrubs and The Ali G Show. A potent combination which mixes all that my mind craves - fun, information and philosophy, though not necessarily in that order.

So, I guess it's time I stopped saying that "I hate travel". I don't quite mind the results.

--
How often I found where I should be going only by setting out for somewhere else.
                -- R. Buckminster Fuller

posted at: 03:10 | path: /travels | permalink | Tags: ,

Fri, 11 Jul 2008:

Back from Ladakh, yet again

I'm back.

Had an awesome time in Ladakh - rented bullets to drive around, went white water rafting, camped out near Tso Moriri, rode 100-odd km in a car without brakes, night vigils on a bridge over the roaring Indus and last but not least bicycling down at 55 kmph from the highest paved road on the planet.

But now, I'm back in b'lore and in process of getting myself back into the same 'ol rut. Already got side swiped on the road by an idiot (or whatever the female equivalent is) and now limping along with a toenail torn off.

Trust me on this, Bangalore roads are more dangerous than anything the himalayas could throw up. More on this later.

--
It is the business of the future to be dangerous.
                -- Hawkwind

posted at: 17:10 | path: /travels | permalink | Tags: , ,

Mon, 07 Jul 2008:

I weep for the living...

There is not one life which does not end. There were days when I was afraid of death, not because mine was next. But to lose a friend, a father or a mentor - to feel the loss that would stay alive. Death does scare me so, because of how ordinary it has always been. For you does not knock, nor toll the bell - but hark, it tolls, but it does not toll for thee.

Hear the bell and I weep for me.
For the one who's lost is really me.

--
Death is beautiful when seen to be a law, and not an accident - It is as common as life.
          -- Henry David Thoreau

posted at: 19:11 | path: /me | permalink | Tags: , ,

Sat, 28 Jun 2008:

Out Hunting Bigfoot...

The Yeti, actually. By the time you're reading this, I'll probably be in the high himalayas, gasping for breath.

Planning to mountain bike around the place, will be back soon. After all I've seen all the sights before.

--
The road to Hades is easy to travel.

posted at: 08:14 | path: /travels | permalink | Tags: ,

Sat, 14 Jun 2008:

Food for thought

Ashamed I'm not to borrow the words of te inimitable Jerome K Jerome.

We are but the veriest, sorriest slaves of our stomach.  Reach not after 
morality and righteousness, my friends; watch vigilantly your stomach, 
and diet it with care and judgment.  Then virtue and contentment will 
come and reign within your heart, unsought by any effort of your own; and 
you will be a good citizen, a loving husband, and a tender father - a 
noble, pious man.

But as someone remarked "nobody starves anyone else".

It is very strange, this domination of our intellect by our digestive 
organs.  We cannot work, we cannot think, unless our stomach wills so.  
It dictates to us our emotions, our passions.  

How good one feels when one is full - how satisfied with ourselves and 
with the world!  People who have tried it, tell me that a clear 
conscience makes you very happy and contented; but a full stomach does 
the business quite as well, and is cheaper, and more easily obtained.  
One feels so forgiving and generous after a substantial and well-digested 
meal - so noble-minded, so kindly-hearted.

I always thought it was just me...

--
Man doth not live on bread alone;
but philosophy baketh no bread.

posted at: 02:47 | path: /philosophy | permalink | Tags: , ,

Mon, 26 May 2008:

APC 3.0.19 Released !

That annoying file descriptor leak that snuck into 3.0.17 has finally been laid to rest. A few double free issues were fixed as I spent quite a long time staring at the same code, till enlightenment hit me like a clue bat. Along with that, there are a bunch of quickfixes for 5.3 quirks. I'm not happy with those, but this is the 3_0 stable branch and by the time 5.3 is popular enough the HEAD should be taking care of those problems. The build is broken in VC++ in this release, but excluding apc_pool.c from the build should work.

Expect more changes... as soon as I get back home.

--
Delay always breeds danger and to protract a great design is often to ruin it.
              -- Miguel De Cervantes

posted at: 04:27 | path: /php | permalink | Tags: , ,

Thu, 22 May 2008:

^Z/0x1A/11010

Another day passes, so what if it was my birthday?

Maybe tomorrow's yours and the world won't care either way.

^Z ^z^z^z ...

--
Who will take care of the world after you're gone?

posted at: 08:31 | path: /me | permalink | Tags: ,

Tue, 06 May 2008:

The 'Bird has Flown the Nest

For most of April, I've been on the road. Late night rides all around town, through inner ring road and cubbon, chugging along on my new bike. The weather's been brilliant and I was out, just cruising along the roads, like in a dream.

Yup, I went and splurged on a brand spanking new Royal Enfield Thunderbird. Full 350 cc, 18 BHP of raw petrol power, purring along like a kitten at full throttle, but whisper quiet in idle. For such a heavy bike, it is surprisingly easy to handle, taking bottom heavy curves on turns and excellent stability at speeds. The bike's behaved pretty well so far, the first full tank of petrol lasted me for around 600 Kms. And for once, I'm actually riding a bike made for someone six feet plus. In short, I love it.

The nights are long and the roads are empty
The world's sleeping and nobody's watching
And the wind whispered to me; keep on driving.

--
If you worried about falling off the bike, you’d never get on.
         -- Lance Armstrong

posted at: 20:20 | path: /hardware | permalink | Tags: ,

Running Infinite Loops quickly - Part II

There's a certain cultural bankruptcy which shows itself in sequels. It indicates, that you're reduced to imitating yourself. But this isn't that kind of a sequel. No, not the kind where there are T Rexes in the city, trying to make a living drawing cartoons or Arnie switching from ammo boxes to ballots. This is the kind which gives a New Hope.

Yesterday, I had an outpouring of hate against the linux capability model. But the problem turned out to be that setuid resets all the capabilites. In hindsight that makes a lot of sense, but didn't even strike until the kernel people (y! has those too) got involved (and I didn't RTFM).

Enter Prctl: The solution was to use the prctl() call with PR_SET_KEEPCAPS to ensure that the capabilities are not discarded when the effective user-id of a process is changed. But, even then, only the CAP_PERMITTED flags are retained and the CAP_EFFECTIVE are masked to zeros.

So, with the prctl call and another cap_set_proc to reset CAP_EFFECTIVE, it was on a roll. Here's the patch on top of unnice.c.

 #include <sys/resource.h>
+#include <sys/prctl.h>;
@@ -26,12 +27,14 @@

    if(!fork())
    {
+       prctl(PR_SET_KEEPCAPS, 1, 0, 0, 0);

        /* child */
        if(setuid(nobody_uid) < 0)
        {
            perror("setuid");
        }
+       cap_set_proc(lcap);

        if(setpriority(PRIO_PROCESS, 0, getpriority(PRIO_PROCESS, 0) - 1) < 0)

Thus concludes this adventure and hope that this blog entry serves as warning of things to come. Watch this space for more Tales! Of! INTEREST!.

--
Only great masters of style can succeed in being obtuse.

posted at: 18:34 | path: /php | permalink | Tags: , ,

Mon, 05 May 2008:

Running Infinite Loops quickly?

Running infinte loops is a tricky challenge. What happens to a process when a programmer writes an infinite loop, should be familiar to all. But the challenge is to not let that affect the *other* processes. There seemed to be a perfect solution to it - setrlimit().

The function lets you set soft and hard limits on CPU, so that if a process does exceed the soft limit CPU usage, a SIGXCPU is raised. The process can catch the signal and do something sensible. Basically, all that was required was for the process to call setpriority and let the linux process scheduler slow it down to a trickle.

But a process can lower its priority, but not raise it - if it is a non-privileged process. But linux capabilities allows you to grant CAP_SYS_NICE to the process which essentially lets a non-privileged process muck around with priority - down and up.

To begin with /proc/sys/kernel/cap-bound is unbelievably confusing to use. It is a 32 wide bit-mask on which the 23rd bit apparently seems to be the CAP_SYS_NICE value. After much mucking around, I came to the conclusion that "-257" would be 0xFFFFFEFF which only disables CAP_SETPCAP. But even then the setpriority call kept failing. Here's my test code.

cap_t lcap;
const unsigned cap_size = 1;
cap_value_t cap_list[] = {CAP_SYS_NICE};

lcap=cap_get_proc();
cap_set_flag(lcap, CAP_EFFECTIVE, cap_size, cap_list, CAP_SET);
cap_set_flag(lcap, CAP_PERMITTED, cap_size, cap_list, CAP_SET);

cap_set_proc(lcap);

if(setuid(nobody_uid) < 0) 
	perror("setuid");

if(setpriority(PRIO_PROCESS, 0, getpriority(PRIO_PROCESS, 0) - 1) < 0) 
	perror("setpriority");

Here's a link to the test case in a more compileable condition. Build it with gcc -lcap and run with sudo to test it. Right now, my ubuntu (2.6.22) errors out with this message.

bash$ gcc -lcap -o unnice unnice.c
bash$ sudo ./unnice 
0: =ep cap_setpcap-ep
setpriority: Permission denied

The core issue has to do with apache child-process lifetimes. The only recourse for me is to kill the errant process after the bad infinite loop and have the parent process spawn a new process with a normal priority. But which means blowing off nearly all the local process cache, causing memory churn and more than that, the annoyance of a documented feature not working.

This story currently has no ending, but if any kernel hackers are reading this and should happen to know an answer, please email gopalv shift+2 php noshift+> net. And thus we prepare for a sequel (hopefully).

--
I use technology in order to hate it more properly.
                -- Nam June Paik

posted at: 22:03 | path: /php | permalink | Tags: , ,

Sun, 04 May 2008:

Watch These Men!

Flaws are inherent in the makings of a hero. For a perfect canditate for heroic tasks would be a man made out of stone - cruel, rational and unemotional. But only cruel to be kind, rational to the core and unstirred by emotional pulls. But who would want to call him a hero?

Over the last two days, I slowly trawled my way through the twelve issue paperback of Watchmen. It has proven to be an interesting comic to peruse.

The book is a continous dismantling of the word "hero". More appropriately, of the super-hero genre - the take-no-lives, nobody-got-hurt-but-the-criminals world of the original heroes. But having accepted collateral damage as a way of life, for the super hero, the question remains - how far will you go to save humanity?.

For your own good: More interesting is the dissection of the purpose of authority. The question hangs in the air - "Who are we protecting them from?". And only the comedian dares answer, but with mirth - "From themselves". Is a nice concept, that few will suffer for the good of many. But that line having been crossed, decisions get mired in a subjective quagmire of the value of a life against another. And it evades the other question - what happens to those who dispense with justice?

quis custodiet ipsos custodes: Ah, but who will watch the watchmen. And even if benevolent they be, what if they take the path piled with corpses. The entire book is a critque on the hypocrisy of authority, the few who are not accountable to any. After all, as I've noticed, in a fair world intentions do not matter.

The book leaves you doubtful how to interpret the shades of grey in people. But at least that's why Rorschach has only black or white - never any gray, on his face. Perhaps to him, it's all black'nwhite.

Perhaps, the real hero is a monster who's cruel to be kind. Amen.

--
God instructs the heart, not by ideas, but by pains and contradictions.
                -- De Caussade

posted at: 00:01 | path: /books | permalink | Tags: ,

Wed, 30 Apr 2008:

Feel the wind in your ...

It's a very liberating sensation. But for those who have become accustomed to seeing me with long and curly hair, this must come as a shock. The summer was getting to me and my other reasons to keep my hair uncut have long since disappeared. And so has my hair.

After having survived countless threats by several (near & dear to me) to have it cut during my sleep, my current crop of hair has been reaped. I've come to realize how much of a hassle it had been. Except for the bright April sun beating down on my head or the newly acquired intimate knowledge of A/C vent locations in office, everything else seems to be going according to plan.

And after all, it'll grow back. It's not like this is the first time I've doen this.

--
Worry about your hair too much and soon you won't need to.

posted at: 20:39 | path: /me | permalink | Tags: , ,

Mon, 14 Apr 2008:

Part-time Lover and a Full-time Friend

Conflict is the essence of drama. Conflict between people is easy enough to construct - the villain, the hero and the heroine. Put a face on each and the characters play themselves out. Evil shall rule, but it shall be short-lived. Good shall win at the end and order shall be restored.

But occasionally something comes along which distills drama out of nothing but circumstances. No evil, merely ordinary people, their thoughts and cognitive dissonances echoing off each other. That's how I felt at the end of watching Juno.

Unlike other movies I write about, I have no spoilers for this one. But the soundtrack haunts me. Definitely something to go back and listen to - not just for the melody, but for the lyrics.

You're such a good friend   
I haveta break your heart.  
Tell you that I love you    
then tear your world apart.

Listen - and hum along ... ~~ you're a part time lover and a full time friend ~~.

--
I thought drama was when actors cried.
But drama is when the audience cries.
       -- Frank Capra

posted at: 15:12 | path: /movies | permalink | Tags: ,

Wed, 26 Mar 2008:

APC 3.0.17: Undo, Undo, Undo

In response to CVE-2008-1488, APC 3.0.17 has just been pushed out with the requisite security fixes. But in the process of producing a php4 compatible release, a significant amount of code has been reverted in the merge into an APC_3_0 branch for future bugfixes.

I've spent a couple of hours unmerging my "bye bye php4" cleanups with the help of Kompare. And my sanity is simply due to the fact that I can "cvs diff -u | kompare -" to look at the resulting huge patch. But it is not unpossible that the new code merged from HEAD has regressions, so you could also apply the unofficial patch onto 3.0.16.

--
I took your advice and did my own thing. Now I've got to undo it.

posted at: 22:03 | path: /php | permalink | Tags: , ,

Fri, 21 Mar 2008:

Python 90210

I'm sorry, I just received a late update (at great cost) from Anthony Baxter.

The last keynote from Linux.conf.au was about the upcoming Python "We'll break all your code" 3k. Perhaps not quite keynote material, but it covered a gamut of issues which will break old code when the move happens - and he did work for a colorful company. The set & dict comprehensions, function annotations and dictionary views are probably worth the terrible loss of reduce(), my favourite companion to map(). And obviously old style classes & string exceptions were excess fat to be trimmed anyway. But there was more interesting code to test.

>>  from __future__ import braces
  File "<stdin>", line 1
SyntaxError: not a chance

>>  import this 

And check the output twice.

--
I believe a little incompatibility is the spice of life, particularly if he has income and she is pattable.
                -- Ogden Nash

posted at: 04:13 | path: /conferences | permalink | Tags: , , ,

Mon, 17 Mar 2008:

Freed.in 2008

I was there, but I didn't talk. Didn't sit around either.

Yes... I stood behind people.

And then, I came back. With a somewhat odd feeling at the back of my mind. Somehow, unlike all the other years, this year it felt more like a JNU event, rather than an ILUG-D event. What with the focus shifting off software into the rather vague (for me) realms of freedom. Maybe it was the conclave or the dinners, it didn't scream out ILUG-D like it used to - but that may not be a bad thing, per se.

Shall just have to wait and watch.

--
In this country we enjoy many freedoms; freedom of speech, freedom of thought and indeed, the freedom to do neither.

posted at: 03:13 | path: /conferences | permalink | Tags: , ,