Make WordPress Core

Opened 5 months ago

Closed 7 weeks ago

#63709 closed defect (bug) (duplicate)

Twenty Twelve: version 4.6 adds CRLF line endings on every file

Reported by: pfg's profile pfg Owned by: monikarao's profile monikarao
Milestone: Priority: normal
Severity: minor Version: 6.8.2
Component: Bundled Theme Keywords: has-test-info
Focuses: Cc:

Description

We tried to update to version 4.6 of the Twenty Twelve theme today on a site where the codebase is versioned in a Git repository. After replacing the folder with the latest version of the theme, the diff shows that every file in the repository shows that every line has changed, but with no visible differences except for the small “actual” changes that were introduced in this release.

Running git diff | cat -v as suggested at https://stackoverflow.com/a/39502438 seems to indicate that all of the line endings in the files have been converted from Unix-style LF to DOS-style CRLF

Here is an example of that diff output for the 404.php file:

diff --git a/wp-content/themes/twentytwelve/404.php b/wp-content/themes/twentytwelve/404.php
index 8b039ecee..2433d6184 100644
--- a/wp-content/themes/twentytwelve/404.php
+++ b/wp-content/themes/twentytwelve/404.php
@@ -1,29 +1,29 @@
-<?php
-/**
- * The template for displaying 404 pages (Not Found)
- *
- * @package WordPress
- * @subpackage Twenty_Twelve
- * @since Twenty Twelve 1.0
- */
-
-get_header(); ?>
-
-	<div id="primary" class="site-content">
-		<div id="content" role="main">
-
-			<article id="post-0" class="post error404 no-results not-found">
-				<header class="entry-header">
-					<h1 class="entry-title"><?php _e( 'This is somewhat embarrassing, isn&rsquo;t it?', 'twentytwelve' ); ?></h1>
-				</header>
-
-				<div class="entry-content">
-					<p><?php _e( 'It seems we can&rsquo;t find what you&rsquo;re looking for. Perhaps searching can help.', 'twentytwelve' ); ?></p>
-					<?php get_search_form(); ?>
-				</div><!-- .entry-content -->
-			</article><!-- #post-0 -->
-
-		</div><!-- #content -->
-	</div><!-- #primary -->
-
-<?php get_footer(); ?>
+<?php^M
+/**^M
+ * The template for displaying 404 pages (Not Found)^M
+ *^M
+ * @package WordPress^M
+ * @subpackage Twenty_Twelve^M
+ * @since Twenty Twelve 1.0^M
+ */^M
+^M
+get_header(); ?>^M
+^M
+	<div id="primary" class="site-content">^M
+		<div id="content" role="main">^M
+^M
+			<article id="post-0" class="post error404 no-results not-found">^M
+				<header class="entry-header">^M
+					<h1 class="entry-title"><?php _e( 'This is somewhat embarrassing, isn&rsquo;t it?', 'twentytwelve' ); ?></h1>^M
+				</header>^M
+^M
+				<div class="entry-content">^M
+					<p><?php _e( 'It seems we can&rsquo;t find what you&rsquo;re looking for. Perhaps searching can help.', 'twentytwelve' ); ?></p>^M
+					<?php get_search_form(); ?>^M
+				</div><!-- .entry-content -->^M
+			</article><!-- #post-0 -->^M
+^M
+		</div><!-- #content -->^M
+	</div><!-- #primary -->^M
+^M
+<?php get_footer(); ?>^M

We were able to replicate this by updating the theme both via wp cli theme update and by downloading the ZIP from wp.org.

Attachments (1)

63709.diff (2.3 KB) - added by sabernhardt 5 months ago.
updating files for potential 4.7 (filling in date with July 17 or 20250717)

Download all attachments as: .zip

Change History (17)

#1 @audrasjb
5 months ago

  • Milestone changed from Awaiting Review to 6.8.3

Hello and welcome to WordPress Core Trac,

Moving to milestone 6.8.3 pending detailed review.

@pfg do you experience the same issue with the version bundled into WordPress Core? You can download the ZIP file containing all bundled themes file from the GitHub repository: https://github.com/WordPress/WordPress/archive/refs/heads/6.8-branch.zip

Pinging @poena for info.

#2 @pfg
5 months ago

@audrasjb Nope, copying over the twentytwelve folder from that download into our site repo only shows the four expected files with diffs in the new version of the theme: style.css, functions.php, css/editor-blocks.css, and readme.txt

You can also see from looking at the Last Commit Date column for that folder in the GitHub repo that none of the other files in the folder for twentytwelve have changed recently, other than the four mentioned above.

https://github.com/WordPress/WordPress/tree/master/wp-content/themes/twentytwelve

Last edited 5 months ago by pfg (previous) (diff)

#3 @audrasjb
5 months ago

Ok thanks, then it means that it's the process of publishing the last release of the theme that failed. I'll circle back to the theme committers on Slack so we can update the files asap.

#4 @audrasjb
5 months ago

  • Component changed from Themes to Bundled Theme

#5 @sabernhardt
5 months ago

  • Version set to 6.8.2

I uploaded new packages to #63681 since Twenty Twelve was updated, and they should be reviewed.

Twenty Twelve probably needs a version 4.7 now.

Also, the handbook page needs updating to include --native-eol LF in the svn export command.

@sabernhardt
5 months ago

updating files for potential 4.7 (filling in date with July 17 or 20250717)

#6 follow-up: @sabernhardt
5 months ago

  • Summary changed from Version 4.6 of twentytwelve theme adds CRLF line endings on every file to Twenty Twelve: version 4.6 adds CRLF line endings on every file

I hope the package can be updated without a new version, but the attached patch is available in case that is important.

#7 in reply to: ↑ 6 @sabernhardt
5 months ago

  • Keywords has-patch added

I hope the package can be updated without a new version...

The new version is necessary:
"Not updating the version number means a new version of the theme can’t be uploaded to the theme directory."

#8 @SirLouen
4 months ago

  • Keywords needs-testing added

This ticket was mentioned in Slack in #core-test by sirlouen. View the logs.


4 months ago

#10 @monikarao
4 months ago

  • Keywords has-test-info added; has-patch needs-testing removed
  • Owner set to monikarao
  • Status changed from new to reviewing

Test Report

Description

This report validates whether the indicated patch works as expected.

Patch tested: 63709.diff

Environment

WordPress: wordpress-develop (latest clone)

PHP: 8.2.29

Server: nginx/1.29.0

Database: mysqli (Server: 8.4 / Client: mysqlnd 8.2.29)

Browser: Chrome 138.0.0.0

OS: macOS

Theme: Twenty Twelve 4.7

MU Plugins: None activated

Plugins: Test Reports 1.2.0

Actual Results

✅ Patch applied successfully using Git. (git diff | cat -v)

✅ Theme version updated to 4.7 (style.css and readme.txt).
✅ Stylesheet version updated in functions.php (20250715 → 20250717). - https://prnt.sc/QmIG6MA65gQF

✅ Frontend loads correctly; no visible errors. - https://prnt.sc/lBlxRvl4rgy8

✅ Theme displays version 4.7 in Appearance → Themes - https://prnt.sc/9slunkdwsfzE

Additional Notes

Patch only updates version metadata; no functional changes.

#11 @monikarao
4 months ago

  • Resolution set to fixed
  • Status changed from reviewing to closed

#12 @monikarao
4 months ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

#13 @jorbin
2 months ago

  • Milestone changed from 6.8.3 to 6.8.4

6.8.3 was a security only release. Punting though 6.8.4 is not planned as a release

#14 @sabernhardt
2 months ago

  • Keywords close 2nd-opinion added
  • Severity changed from normal to minor

The patch would need a new date.

This update has not been done for more than two months, and another Twenty Twelve release is already planned for December 2 with additional changes. I do not consider version 4.6 'broken' with the wrong line endings, so 4.7 could be the December release (#64069).

Last edited 2 months ago by sabernhardt (previous) (diff)

#15 @riccardodicurti
2 months ago

I noticed the full diff across all files between versions:

--- twentytwelve-4.5/twentytwelve
+++ twentytwelve-4.6/twentytwelve

After applying the patch 63709.diff to 4.6 and comparing again with version 4.5, I still see all the differences caused by the conversion from Unix-style LF to DOS-style CRLF.

Here are my steps for reference:

diff -ru wordpress-develop/src/wp-content/themes/twentytwelve twentytwelve-4.5/twentytwelve > diff4.txt
# → Diff on every file

diff -ru wordpress-develop/src/wp-content/themes/twentytwelve twentytwelve-4.6/twentytwelve > diff5.txt
# → No diff

patch < 63709.diff

diff -ru wordpress-develop/src/wp-content/themes/twentytwelve twentytwelve-4.6/twentytwelve > diff6.txt
# → Version diff as expected from the patch

However, comparing again with 4.5:

diff -ru wordpress-develop/src/wp-content/themes/twentytwelve twentytwelve-4.5/twentytwelve > diff7.txt

I still get all the line-ending differences.

@monikarao could you please confirm if I’m missing a step?

I was expecting the patch to revert the CRLF conversion, restoring the original LF endings and leaving only the intended version changes.

#16 @sabernhardt
7 weeks ago

  • Keywords close 2nd-opinion removed
  • Milestone 6.8.4 deleted
  • Resolution set to duplicate
  • Status changed from reopened to closed

Duplicate of #64069.

The patch does not change the line endings; it added the necessary changes to create a new version of the theme.

With the planned update in five weeks, I'll close this ticket. If a committer wants to fix only the line endings before then, feel free to reopen and create a pull request with that day's date. Then the zipped archive copy in the GitHub actions should have the LF endings.

Note: See TracTickets for help on using tickets.