Sometimes small problems really upset me. I have a test harness that nests shell scripts deeply. Why not—that is why fork() and exec() exist after all. I was getting odd failures deep down in the bowels of the harness that were a bit tricky to track down.
This particular test harness was failing with Segmentation fault on SuSE SLES 9 and Memory fault on Red Hat Enterprise Linux RHEL4. Same problem just different error text. When I found the problem I started to look into it on another test system that happened to be Fedora Core 5. I was frustrated to find that the problem did not happen on Fedora, but did on 32 and 64 bit releases of both RHEL4 and SLES9. Ugh.
The problem rested in the first 2 lines of a simple shell script. What was the offending code? Get this:
#!/bin/bash
time
Wow, frightening stuff! In the first line of some stupid shell script I happened to execute the shell built-in time without timing anything, which was a goof on my part. But really, bash seg faults because the time built-in doesn’t have an arg and only when that is the first line of the script? As long as time is the first command in the script it causes bash to freak out—regardless of what follows. Notice in the following screen shot how simply putting the shell built-in : as the first line of code—after forcing bash—alleviates the problem. Notice also that the problem didn’t happen on Fedora.
Balkanization
Oh how I hate problems like this—simple, stupid little shell scripts behaving differently on one Linux distro than on another. Yes, I know it isn’t the shell script that is technically behaving differently—it’s the implementation of bash. And if there were symbols in /bin/bash (it’s stripped) I’d tunnel-rat my way through gdb to see why it is freaking out, however, with limited information I can only determine the routine, which is called execute_command_internal().
I also know this is not technically a Linux issue since bash is just GNU stuff. To that end, some googling reveals that this bug has been reported in the Solaris camp in Open Solaris Bug 6328339 which was opened back in 2005. Even though this is technically a GNU issue I still get varying behavior from different Linux distributions which I believe is a by-product of balkanization.
I thought Linux was going to save us from all the balkanization we supposedly suffered under Unix rule. This is just a simple example of balkanization. We endured much worse side-affects of Linux balkanization with the pre-2.6 Kernel virtual memory fiasco. Some my recall the ill-fated clash of the virtual memory titans featuring the Archangelites opposing the Van Rielians—a war with a large number of customer casualties. Going back further, I recall plenty of workloads (most notably The Tens) that would completely crush one Linux distribution but function just fine with the other. Indeed, during that project we tested both RH2.1 and SLES7 and stayed with the one that could hold up under pressure—and if you read the paper you can envision the pressure!
How many Linux distributions are there now? Does Linux balkanization make life better for the average Oracle IT shop?
I’m happy to report
“no worries”, with bash in aix 5.3:
aix-01$ cat foo.sh
#!/bin/bash
time
echo ‘batch program’
aix-01$ ./foo.sh
real 0m0.000s
user 0m0.000s
sys 0m0.000s
batch program
aix-01$ bash foo.sh
real 0m0.000s
user 0m0.000s
sys 0m0.000s
!!! ¦>)
Being from Balkan region I must replay to this.
You use the term balkanization. Did you ever been there ? Do you really know the history of that region ?
1. Division of one political entity is not something specific to Balkan. Roman empire has split, Austro-Hungarian empire has been divided into several countries, USSR has dissolved, hack even USA is composed from several states
2. If you refer to recent split of former Yugoslavia I must inform you that there lived separate nationalities (Slovenians, Croatians, Serbians, Macedonians, etc. yous like Germans, Dutch, Italian). And those nationalities have had their own states centuries ago. Some of these states falled under Turkish empire, other under Austro-Hungarian empire. After WW1 they united under 1st Yugoslavia (yes, the country that recently splited was 2nd Yougoslavia, formed after WW2).
3. Yes, there was war there 10+ years ago, but I do not see that as specific to Balkan. Sadly, there are wars and disputes among nations around the globe.
Please do not refer to some region on our planet in negative context. Your country/region probably has it’s own negative spots in history.
Regards, Petar
Petar,
I almost don’t know how to respond to your comment. No, wait, I actually do. Of course I know about that region of the world. What I don’t think you know is that the term balkanization is in fact a pejorative. The etymology of the word balkanization has nothing to do with the recent strife (1990s) of that region. The term is not pop-culture. It is not slang and is certainly not vulgar. Its origin is rooted in the seemingly arbitrary carving up of those lands after the Balkan wars of the early 20th century–which in turn lead to WW1. Therefore, using the word balkanization to describe what is happening to Linux insinuates that little good will come of it. I presume, by your reply, that you feel the periodic, occasional, intermittent, sporadic and seemingly arbitrary carving up of that region of the world (an act known as balkanization) leads to no good just the same. I suspect what has happened is that the only term that brought you to my blog post was in fact the term balkanization. If you understood the technical content vis a vis Linux, you would better understand why I used the term. That is unless you actually think any word with root word “balkan” in it is verboten at face value.
As for your comment about my country/region having its own negative spots in history, well, I’ve just about hit the floor. Yeah, I’d say my country has made some significantly bone-headed, idiotic moves. Yes, indeed. However, committing the lives of some 300,000 Americans to WW1–a war resulting from balkanization–during a period of American isolationism should remind people of the meaning of the word largess.
All the regular readers of this list know that its content is governed by popularity. If we see a rush of negative feedback due to the use of the word, I’ll replace it with a synonym.
The wikipedia definition of balkanization is quite good, including a reference to Finlandization, which in the context of this blog leads back to a Finnish engineer who created linux, and might be offended by that term, or more likely, would find some cutting humor in it.
So what I’m wondering is, what percentage of Oracle shops are linux? A brief google finds projections of it becoming the majority this year or 2009, but nothing recent… the average of the shops I’ve been in would be zero care (though I’ve turned down some work because it looked like people were oversold on RAC, and there seem to be a number of places suffering judging from job ads)…
I’d say the US entrance to WWI was more opportunism than largesse, but we can put that discussion off for another day.
Joel,
Thanks for your participation. As for Oracle on Linux, the numbers are fuzzy. According to the following http://www.oracle.com information, 2005 had Windows license revenue at 29% of total and Linux only 20%.
http://tinyurl.com/2mvsxv
Of course the US was isolationist. What you need to review is:
What was Teddy Roosevelt’s involvement.
The economics of munitions suppliers.
Why German troops fell apart when attacked frontally.
Who benefitted from the Zimmerman note being made public.
Why Wilson suddenly decided to support entering the war, “the world must be made safe for democracy.”
What were the feelings of US military proponents about the prospects of Japan and Mexico waring with the US.
Was the war truly lost without US entry, or did the US just see an opportunity to swoop in at the end and take the glory without much cost?
Not much Oracle there, unless you want to compare their march to world domination with manifest destiny or something 🙂
You’re right, Joel. We are way off topic.
Was the war truly lost without US entry
LOL. For me it’s even funny to hear that. 🙂