Our Emperor Sponsors

  • InternetNZ
  • Google
  • IBM
  • HP

<-- Back to schedule

No medium found: when it's time to stop trying to read strerror's mind.

Time:15:45 - 16:30
Day:Wednesday 20 January 2010
Location:Renouf 2 (MFC)
Project: libexplain

You are supposed to be level infinity tech support, and you never, ever have to talk to users. So why is it that there is a constant stream of people asking you to decipher yet another error message?

$ dd if=/dev/cdrom of=fred.iso
dd: opening `/dev/cdrom': No medium found

Quite apart from the fact that huge numbers of native English speakers are not even aware the "media" is a plural, let alone that "medium" is its singular, the strerror output for ENOMEDIUM is pretty skimpy on the detail. Some useful and informative alternatives could be

dd: opening `/dev/cdrom': there is no disc in the CD-ROM drive
dd: opening `/dev/nst0': there is no tape in the SCSI tape drive
dd: opening `/dev/fd0': there is no disk in the 3.5" floppy drive

Wouldn't it be nice if first level tech support didn't need to find a psychic medium? Wouldn't it be nice to have error messages that users could understand without tech support?

As a coder, just how do you go about producing tailored error messages like the ones above? How much kernel source spelunking is needed? This presentation is the story of ENOMEDIUM and other errors handled by libexplain, a library of system call specific strerror replacements.

Peter Miller

Peter Miller has been writing software for over 30 years, and releasing GPL licensed software for over 20 years. He is interested in graphics, compilers, languages, build systems, TDD, version control, embedded systems, and camping. He also keeps his bugs in cages.