Front page
Archive
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

Email
bigwig AT nc.rr.com

Friends of Hraka
InstaPundit
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
ColdFury
Oceanguy
Fragments from Floyd
VodkaPundit
Allah
The Feces Flinging Monkey
the skwib
Dean's World
Little Tiny Lies
The Redsugar Muse
Sperari
Natalie Solent
From the Mrs.
ErosBlog
The Anti-Idiotarian Rottweiler
On the Third Hand
Public Nuisance
Not a Fish
Rantburg
AMCGLTD
WeckUpToThees!
Electric Venom
Skippy, The Bush Kangaroo
Common Sense and Wonder
Neither Here Nor There
Wizbang!
Bogieblog
ObscuroRant
RocketJones
The Greatest Jeneration
Ravenwolf
Ipse Dixit
TarHeelPundit
Blog On the Run
blogatron
Redwood Dragon
Notables
Greeblie Blog
Have A Cuppa Tea
A Dog's Life
IMAO
Zonitics.com
Iberian Notes
Midwest Conservative Journal
A Voyage to Arcturus
HokiePundit
Trojan Horseshoes
In Context
dcthornton.blog
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
IsraPundit
Freedom Lives
Where Worlds Collide
Knot by Numbers
How Appealing
South Knox Bubba
Heretical Ideas
The Kitchen Cabinet
Dustbury.com
tonecluster
Bo Cowgill
mtpolitics.net
Raving Atheist
The Short Strange Trip
Shark Blog
Hoplites
Jimspot
Ron Bailey's Weblog
Cornfield Commentary
Testify!
Northwest Notes
pseudorandom
The Blog from the Core
Ain'tNoBadDude
CroMagnon
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
Pdawwg
The Rant
The Johnny Bacardi Show
The Head Heeb
Viking Pundit
Mercurial
Oscar Jr. Was Here
Just Some Poor Schmuck
Katy & Bruce Loebrich
But How's The Coffee?
Roscoe Ellis
Foolsblog
Sasha Castel
Dodgeblogium
Susskins Central Dispatch
DoggerelPundit
Josh Heit
Attaboy
Aaron's Rantblog
MojoMark
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
Velociblog
I was thinking
Judicious Asininity
This Woman's Work
Fragrant Lotus
DaGoddess
Single Southern Guy
Caerdroia
GrahamLester.Com
Jay Solo's Verbosity
TacJammer
Snooze Button Dreams
Horologium
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
Aimless
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
Moxie.nu
Eccentricity
Say What?
Blown Fuse
Wait 'til Next Year
The Pryhills
The Whomping Willow
The National Debate
The Skeptician
Zach Everson
MonkeyWatch
Geekward Ho
Argghhh!!!
Life in New Orleans
Rotten Miracles
Fringe
The Biomes Blog
illinigirl
See What You Share
Truthprobe
Blog d’Elisson
Your Philosophy Sucks
Watauga Rambler
Socialized Medicine
Consternations
Verging on Pertinence
Read My Lips
ambivablog
Soccerdad
The Flannel Avenger
Butch Howard's WebLog
Castle Argghhh!
Andrew Hofer
kschlenker.com
Moron Abroad
White Pebble
Darn Floor
Wizblog
tweedler
Pajama Pundits
BabyTrollBlog
Cadmusings
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.

#!/afs/isis/pkg/php/bin/php^M
^M
< html>^M
< head>^M
< title> Untitled Document</title>^M
< meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" >^M
</head>^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 furryteens.com 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 help.unc.edu 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
Postscript:
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.
Comments
Post a comment Note: Comments with more than two dashes per line will be blocked as spam.









Remember personal info?