About Archive Tags RSS Feed


So hot, so cold, so far so out of control

19 July 2006 21:50

The cron patch I posted previously attempted to discard any crontab file which contained non-ASCII characters was a flawed approach.

Lots of people told me that this would break scripts with foreign character sets, and that was something I'd not considered.

A real solution would be to read each line and test for :

  • Lines beginning with "#" and containing anything after that.
  • Lines containing "valid" crontabe entries.

Looking at the code for cron is hard because it is written in a "strange" style, so I'm not even going to attempt it this level of validation.

However I have produced an updated patch which should work on ASCII + foreign character sets equally well. Instead of testing for the presense of non-ASCII characts it looks for NULL characters ('\0').

Binary files should contain at least one NULL character - as a string terminator, for example - and text-files should never contain them. So I think this simple test will work for 99% of cases.

Regardless of whether this patch, or another like it, is accepted and applied I do believe strongly that whilst being liberal in what you accept is a good thing being too liberal is asking for trouble.

| No comments