Page MenuHomePhabricator

Unhandled Exception When Trying to View Diff in Phriction
Closed, DuplicatePublic

Description

User edited document. Trying to view a diff at URL at our site
phriction/diff/8/?l=2&r=3

gives following error message:

Diff Parse Exception: Expected '\ No newline at end of file'.
 43
 .
 . < actual diff here >
 .
 47
 >>> 48 \ Kein Zeilenumbruch am Dateiende.

Note that I removed the actual diff content. I think the relevant issue is the last line, where some software seems to expect a string in English that has been generated in German.
Checking environment variables show that LANG is set to de_DE.UTF-8

I believe that looking at diffs in phriction worked before on this machine, but I might be wrong.

Event Timeline

timor raised the priority of this task from to Needs Triage.
timor updated the task description. (Show Details)
timor added a subscriber: timor.

Can you reproduce on this install?

Ah, I think I understand your question a big better. Your server is runs as de_DE.UTF-8? Is this a consistent repro for you?

chad triaged this task as Low priority.Oct 21 2014, 2:15 PM

Yes, it is consistent.

This is really becoming a problem. Is there a known workaround?

In case anyone is interested: I hacked around this by inserting another check (for the german version) in arcanist/src/parser/ArcanistDiffParser.php in parseChangeset.

It seems that the same code is being used for the view in Diffusion, but there no error was generated, only in Phriction.

Hello timor,
I have the same issue than you so I am very interested by your solution.
Could you show me what you have modified in parseChangeset method please?
Thks.

This comment was removed by csarre.

Hi csarre,

Here is the workaround. It is just a hardcoded exception for the German language string.

diff --git a/src/parser/ArcanistDiffParser.php b/src/parser/ArcanistDiffParser.php
index 711edb6..59e738e 100644
--- a/src/parser/ArcanistDiffParser.php
+++ b/src/parser/ArcanistDiffParser.php
@@ -947,7 +947,8 @@ final class ArcanistDiffParser extends Phobject {
         }
         switch ($char) {
           case '\\':
-            if (!preg_match('@\\ No newline at end of file@', $line)) {
+            if (!(preg_match('@\\ No newline at end of file@', $line) or
+                  preg_match('@\\ Kein Zeilenumbruch am Dateiende@', $line))) {
               $this->didFailParse(
                 pht("Expected '\ No newline at end of file'."));
             }

I got the same problem :

"/tmp/edit.9lf3nbfetkgsgwwg/new-commit" 25L, 458C 已写入
Linting...
No lint engine configured for this project.
Running unit tests...
No unit test engine is configured for this project.
Exception
Diff Parse Exception: Expected '\ No newline at end of file'.

Raw input file was written to: /tmp/1u8d8zhe2lmskosk/6733-rZ7dxp

         180            } else {
         181                $("."+branch_class).hide().find("input[type='checkbox']").addClass("hidden-input").attr("checked",false);
         182            }
         183        });
         184   -}
>>>      185   \ 文件尾没有 newline 字符
         186   +}

(Run with --trace for a full exception trace.)