Detect non-unix newlines

Arancaytar - November 11, 2008 - 15:49
Project:Project Issue File Review
Version:6.x-2.x-dev
Component:Code
Category:task
Priority:critical
Assigned:boombatower
Status:closed
Description

The TestBot has marked #207475: Add a script to run cron on multisite installations as CNW for failing PHP syntax - but the attached patch changes a bash script. Perhaps the syntax checker should be filtered to .module, .php and .inc extensions?

#1

boombatower - November 11, 2008 - 22:49
Project:Test driven development infrastructure» Project Issue File Review
Version:<none>» 6.x-1.x-dev
Category:bug report» task
Assigned to:Anonymous» boombatower

This was debated, but it seems necessary now.

#2

boombatower - November 11, 2008 - 22:50
Title:Shell script fails test: Invalid PHP syntax» Filter files to check for PHP syntax errors

#3

boombatower - November 11, 2008 - 23:31

Interestingly if I apply the patch locally and run

php -l ./scripts/cron-lynx.sh

I get the expected:

No syntax errors detected in ./scripts/cron-lynx.sh

#4

boombatower - November 11, 2008 - 23:47

I had this problem while developing the system.

I can run the commands in command line or from drupal index.php and get the $output and $status to come out great, but not from inside my code. Instead I get $output always equall to nothing and the status apparently is being 1.

<?php
exec
('php -l ./scripts/cron-lynx.sh', $output, $status);
print_r($output);
var_dump($status);
$output = shell_exec('php -l ./scripts/cron-lynx.sh');
echo
$output;
?>

#5

boombatower - November 13, 2008 - 22:50
Title:Filter files to check for PHP syntax errors» PHP syntax errors reported when none found while running locally

#6

boombatower - December 9, 2008 - 05:09

#7

plach - January 8, 2009 - 22:46

I had the same problem and converting the patch newline delimiter from CR+LF to LF did the trick (see #338630: Locale is unable to rebuild lost Javascript translation files and #347288: Locale uninstall hook broken).

#8

Heine - January 9, 2009 - 14:03

Both jsomers and I confirmed with some CR+LF -> LF conversions that the same patch then passes the syntax check.

#9

boombatower - January 12, 2009 - 06:20

So this is unix vs. windows newline standard?

If so do we have an official standard? If not we either need one of the bots need to be able to convert (handle) both. I would vote for creating a standard if we don't.

#10

catch - January 16, 2009 - 14:04

Pretty sure this is a windows line endings issue as well. I'd be in favour of adding something to patch/create to document this.

#11

boombatower - January 16, 2009 - 17:35

@catch: please do. I'll try and detect this in the next version.

#12

boombatower - January 19, 2009 - 08:11
Title:PHP syntax errors reported when none found while running locally» Detect non-unix newlines
Priority:normal» critical

#13

boombatower - January 19, 2009 - 08:11
Version:6.x-1.x-dev» 6.x-2.x-dev

#14

boombatower - February 5, 2009 - 08:44

Added client confirmation test patch for this.

#15

boombatower - February 12, 2009 - 02:39
Status:active» fixed

This is now included in the review.

#16

neochief - February 24, 2009 - 21:24
Status:fixed» active

Sorry, just clarify, is it already implemented? I have few patches (1, 2) which blocked by this error and it's not gone even now (Feb 24).

#17

boombatower - February 25, 2009 - 01:33
Status:active» fixed

This is implemented in PIFR 2.x which I hope to deploy in the next few weeks. That is to say that it is not deployed on the active testing.drupal.org, but the patches are incorrect if they contain non-unix newlines, per http://drupal.org/patch.

#18

neochief - February 25, 2009 - 01:54

Okay, thanks.

#19

System Message - March 11, 2009 - 02:00
Status:fixed» closed

Automatically closed -- issue fixed for 2 weeks with no activity.

 
 

Drupal is a registered trademark of Dries Buytaert.