[theme-reviewers] Broken Theme Uploads (soon to be broken again)
Otto
otto at ottodestruct.com
Thu Jun 2 20:10:18 UTC 2011
Okay, so, a while back we had a problem where some themes were not
being uploaded correctly to the Theme system. The symptom of this was
that a ticket was created, but the theme itself didn't appear to get
loaded into the SVN repository. I corrected this problem temporarily,
via a revert of a code change. That was only temporary, today I'll be
undoing that change and theme uploads will once again break. However,
this time, they'll break with a warning and explanation.
The underlying problem is one of DOS and UNIX style line endings. The
change made to the WordPress SVN systems was made across the board,
and it was to automatically set the svn:eol-style flag to "native".
What this means is that text files will get their line ending styles
converted between DOS and UNIX styles correctly, when they're
retrieved from the SVN systems.
The problem with this occurs when you have a single file that has BOTH
types of line ending styles in it. SVN can't handle that, because it
doesn't know which way to convert it. This frequently happens when
you're using editors that aren't smart enough to do this sort of
conversion for you when you are copy and pasting code between files.
For example, if you have a file open with UNIX style endings and copy
part of it into a file with DOS style endings, then some editors don't
convert the line endings even though they display the paste normally.
Result: weirdness.
Now, PHP is like the honey-badger, and it just doesn't care which line
ending style you use. Either way it's all whitespace to PHP. But SVN
does care, so we have to care.
To this end, I've added a new module to the Theme Check plugin, and
will be releasing a new Theme Check version shortly. It will notify
you which of your files, if any, have both types of line endings in
them.
To correct the problem in these files, various text editing programs
have options to pick a line ending style in their Save functionality.
In TextPad, for example, you just go to Save As, then choose the "File
format" as either PC or UNIX. It honestly doesn't matter which you
choose, as long as the file itself is consistent. I've tested this,
and it does solve the problem. Notepad++ has a similar feature. On
Linux or other unix-based systems, you can install the dos2unix
command line program and it will correct these types of files as well.
The reason I'm putting this on the theme author instead of just
automatically having the dos2unix program run on themes automatically
is because I can't be certain that themes won't get broken in some
manner by automatically running programs over them and changing their
contents as they upload. I want theme authors to be able to correct
the problem and then to test their themes to make sure nothing is
affected, before trying to upload them.
Also note that this line ending problem only applies to text files.
PHP, CSS, JS, TXT, that sort of thing. Images and such shouldn't be
affected, as they are binary files.
Anyway, this change will go into effect in a few hours, after I finish
making the modifications. I'll release the updated theme check plugin
shortly. I've tested it on the problem themes sent to me, and it seems
to reliably detect the problem (and fail the theme check accordingly).
-Otto
More information about the theme-reviewers
mailing list