Front page
Silflay Hraka?

Bigwig is a systems administrator at a public university
Hrairoo is the proprietor of a quality used bookstore
Kehaar is.
Woundwort is a professor of counseling at a private university

The Hraka RSS feed

bigwig AT

Friends of Hraka
Daily Pundit
cut on the bias
Meryl Yourish
This Blog Is Full Of Crap
Winds of Change
A Small Victory
Silent Running
Dr. Weevil
Little Green Footballs
Fragments from Floyd
The Feces Flinging Monkey
the skwib
Dean's World
Little Tiny Lies
The Redsugar Muse
Natalie Solent
From the Mrs.
The Anti-Idiotarian Rottweiler
On the Third Hand
Public Nuisance
Not a Fish
Electric Venom
Skippy, The Bush Kangaroo
Common Sense and Wonder
Neither Here Nor There
The Greatest Jeneration
Ipse Dixit
Blog On the Run
Redwood Dragon
Greeblie Blog
Have A Cuppa Tea
A Dog's Life
Iberian Notes
Midwest Conservative Journal
A Voyage to Arcturus
Trojan Horseshoes
In Context
The People's Republic of Seabrook
Country Store
Blog Critics
Chicago Boyz
Hippy Hill News
Kyle Still Free Press
The Devil's Excrement
The Fat Guy
War Liberal
Assume the Position
Balloon Juice
Iron Pen In A Velvet Glove
Freedom Lives
Where Worlds Collide
Knot by Numbers
How Appealing
South Knox Bubba
Heretical Ideas
The Kitchen Cabinet
Bo Cowgill
Raving Atheist
The Short Strange Trip
Shark Blog
Ron Bailey's Weblog
Cornfield Commentary
Northwest Notes
The Blog from the Core
The Talking Dog
WTF Is It Now??
Blue Streak
Smarter Harper's Index
nikita demosthenes
Bloviating Inanities
Sneakeasy's Joint
Ravenwood's Universe
The Eleven Day Empire
World Wide Rant
All American
The Rant
The Johnny Bacardi Show
The Head Heeb
Viking Pundit
Oscar Jr. Was Here
Just Some Poor Schmuck
Katy & Bruce Loebrich
But How's The Coffee?
Roscoe Ellis
Sasha Castel
Susskins Central Dispatch
Josh Heit
Aaron's Rantblog
As I was saying...
Blog O' Dob
Dr. Frank's Blogs Of War
Betsy's Page
A Knob for Brightness
Fresh Bilge
The Politburo Diktat
Drumwaster's rants
Curt's Page
The Razor
An Unsealed Room
The Legal Bean
Helloooo chapter two!
As I Was Saying...
SkeptiLog AGOG!
Tong family blog
Vox Beth
I was thinking
Judicious Asininity
This Woman's Work
Fragrant Lotus
Single Southern Guy
Jay Solo's Verbosity
Snooze Button Dreams
You Big Mouth, You!
From the Inside looking Out
Night of the Lepus
No Watermelons Allowed
From The Inside Looking Out
Lies, Damn Lies, and Statistics
Suburban Blight
The SmarterCop
Dog of Flanders
From Behind the Wall of Sleep
Beaker's Corner
Bad State of Gruntledness
Who Tends The Fires
Granny Rant
Elegance Against Ignorance
Say What?
Blown Fuse
Wait 'til Next Year
The Pryhills
The Whomping Willow
The National Debate
The Skeptician
Zach Everson
Geekward Ho
Life in New Orleans
Rotten Miracles
The Biomes Blog
See What You Share
Blog d’Elisson
Your Philosophy Sucks
Watauga Rambler
Socialized Medicine
Verging on Pertinence
Read My Lips
The Flannel Avenger
Butch Howard's WebLog
Castle Argghhh!
Andrew Hofer
Moron Abroad
White Pebble
Darn Floor
Pajama Pundits
Goddess Training 101
A & W
Medical Madhouse
Slowly Going Sane
The Oubliette
American Future
Right Side Redux
See The Donkey
Newbie Trucker
The Right Scale
Running Scared
Ramblings Journal
Focus On Reality
Wyatt's Torch

June 10, 2003

Killing Two Birds With One Post

A couple of the projects I am tangentially involved in right now is the offering of personalized cgi-bins for the students and faculty at UNC. Everyone has a public html folder that they can use for static html, but people are growing steadily more sophisticated with each passing year, and so there's been a growing demand for something like the above.

A personal cgi-bin allows the user to run php or Perl scripts that they have written, to submit forms to a database or host a Movable Type blog, among other things. There's something of a slight security risk in allowing any Tom, Dick or Sheila to run whatever jury-rigged code they manage to type up on the campus web servers, but we've gotten around that by running all the scripts within the context of a cgi wrapper that one of the more able department developers wrote.

So, problem solved, mostly. But, just because the faculty and students have gotten sophisticated enough to want to write scripts doesn't mean they actually know how to write scripts, nor are the willing to write such scripts in anything other than Microsoft Word, Wordpad, or Notepad.

This is a problem. The main campus servers run Solaris, or Linux, and when they run across a Perl or php script that's been composed on a PC and then transferred to a Unix filesystem this is what they see.

< html>^M
< head>^M
< title> Untitled Document</title>^M
< meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" >^M

Those "^M"s are how Unix translates the ASCII character that Windows uses to indicate a carriage return. In a static html file this doesn't normally matter. In that case the web server just hands the file to the browser, and the browser parses it. But in the case of a script, the web server must run it, then return something to the browser.

For the snippet of php code above to work, the web server has to find the campus php binary (think "program" when you see "binary". You'll sleep better at night.) that we installed and submit the code to it. The first line in any cgi-bin script, in this case the "#!/afs/isis/pkg/php/bin/php" line, tells the server where to go to submit the code. To us technical types, this is known as the "path."

The web server sees the "^M" at the end of the path and assumes that is part of the directions it has to follow. There is no such path, so the server returns an error code, the bespectacled freshman at the other end curses, then opens up a ticket with the help desk to tell us our php is broken. In order to fix it, one of the sysadmins has to spend valuable coffee drinking time finding the code, opening it up to verify that yes, Johnny is trying to crack the password system with code he wrote in MS word, and then track him down and tell him how to fix it.

Oddly enough, this is duty considered less than enjoyable, so it is passed down to the most junior of the sysadmins.

Guess who that might be.

Now, there are a number of ways to avoid the ^M bug that we know of, or to ameliorate it afterwards. The first is to use one to the native Unix editors like vi or Emacs to compose one's code. Sadly, most do not choose this path, for Unix editors scare the pants off your average user. One could also compose the file in Windows, then open it up in vi and run a command like ":1,$s/^M//g" to rid one's code of the unwanted characters.

Told you it was scary. Most people don't like doing this either, even though they tend to force themselves to once we tell them that we won't do it for them.

The ^M problem, though still limited in scope at the moment, is growing, so we're in the process of developing a tutorial on how to deal with the problem for the site. Once again, this is a job for the junior sysadmins. The alternatives listed above will be part of it; there's also a Perl script we've written that a user can call to strip out the ^M from the end of each line. I think some shareware code editors like Ultraedit can be set to prevent this as well, but don't know for sure.

The mantra around the office is "Surely someone has had to deal with this before." Before I submit the help doc, I thought I'd ask. Has anyone else run into this? How do you work around it?

This is you chance to earn everlasting fame as part of a rarely accessed document in the UNC help system, so don't be shy.

Update: If your solution is a particular program, it needs to be able to run under AIX, which is what the UNC login nodes are running.

Posted by Bigwig at June 10, 2003 10:37 AM | TrackBack
First time visitor to House Hraka? Wondering if everything we produce could possibly be as brilliant/stupid/evil/pedantic/insipid/inspired as the post you just read? Check out the Hraka Essentials, the (mostly) reader-selected guide to Hraka's best posts, and decide for yourself.
Post a comment Note: Comments with more than two dashes per line will be blocked as spam.

Remember personal info?