Page MenuHomePhorge

Bug: Unhandled Exception ("Exception") - Diff Parse Exception: Expected '\ No newline at end of file'.
Closed, ObsoletePublic

Asked by szotsaki on Jun 30 2023, 07:57.

Details

It seems I don't have permission to report bugs, so I place it here.

When browsing my repository hosted inside Phorge, I see the following exception showing up:

Diff Parse Exception: Expected '\ No newline at end of file'.

            342    
            343    [… diff content]
            344    [… diff content]
            345    [… diff content]
            346    [… diff content]
   >>>      347   \ Nincs új sor a fájl végén

Backtrace:

arcanist(head=master, ref.master=8426ebc053b3), phorge(head=master, ref.master=0a17287e08cd)
  #0 <#2> ArcanistDiffParser::didFailParse(string) called at [<arcanist>/src/parser/ArcanistDiffParser.php:959]
  #1 <#2> ArcanistDiffParser::parseChangeset(ArcanistDiffChange) called at [<arcanist>/src/parser/ArcanistDiffParser.php:350]
  #2 <#2> ArcanistDiffParser::parseDiff(string) called at [<phorge>/src/infrastructure/diff/PhabricatorDifferenceEngine.php:143]
  #3 <#2> PhabricatorDifferenceEngine::generateChangesetFromFileContent(string, string) called at [<phorge>/src/applications/differential/parser/DifferentialChangesetParser.php:1481]
  #4 <#2> DifferentialChangesetParser::realignDiff(DifferentialChangeset, DifferentialHunkParser) called at [<phorge>/src/applications/differential/parser/DifferentialChangesetParser.php:637]
  #5 <#2> DifferentialChangesetParser::process() called at [<phorge>/src/applications/differential/parser/DifferentialChangesetParser.php:624]
  #6 <#2> DifferentialChangesetParser::tryCacheStuff() called at [<phorge>/src/applications/differential/parser/DifferentialChangesetParser.php:791]
  #7 <#2> DifferentialChangesetParser::render(NULL, NULL, array) called at [<phorge>/src/applications/differential/parser/DifferentialChangesetParser.php:76]
  #8 <#2> DifferentialChangesetParser::renderChangeset() called at [<phorge>/src/applications/differential/parser/DifferentialChangesetParser.php:1902]
  #9 <#2> DifferentialChangesetParser::newChangesetResponse() called at [<phorge>/src/applications/diffusion/controller/DiffusionDiffController.php:141]
  #10 <#2> DiffusionDiffController::handleRequest(AphrontRequest) called at [<phorge>/src/aphront/configuration/AphrontApplicationConfiguration.php:284]
  #11 phlog(Exception) called at [<phorge>/src/aphront/handler/PhabricatorDefaultRequestExceptionHandler.php:41]
  #12 PhabricatorDefaultRequestExceptionHandler::handleRequestThrowable(AphrontRequest, Exception) called at [<phorge>/src/aphront/configuration/AphrontApplicationConfiguration.php:751]
  #13 AphrontApplicationConfiguration::handleThrowable(Exception) called at [<phorge>/src/aphront/configuration/AphrontApplicationConfiguration.php:296]
  #14 AphrontApplicationConfiguration::processRequest(AphrontRequest, PhutilDeferredLog, AphrontPHPHTTPSink, MultimeterControl) called at [<phorge>/src/aphront/configuration/AphrontApplicationConfiguration.php:204]
  #15 AphrontApplicationConfiguration::runHTTPRequest(AphrontPHPHTTPSink) called at [<phorge>/webroot/index.php:35]

My locale is Hungarian and at the end it says exactly "No newline at end of file" just in another language.

Reproducer:

echo A > a.txt
echo -n A > b.txt
diff a.txt b.txt
LC_ALL=C diff a.txt b.txt 
--- a.txt       2023-06-30 16:57:35.309109363 +0200
+++ b.txt       2023-06-30 16:57:40.837179111 +0200
@@ -1 +1 @@
-A
+A
\ No newline at end of file
LC_ALL=hu_HU.UTF-8 diff a.txt b.txt 
--- a.txt       2023-06-30 16:57:35.309109363 +0200
+++ b.txt       2023-06-30 16:57:40.837179111 +0200
@@ -1 +1 @@
-A
+A
\ Nincs új sor a fájl végén

Answers

valerio.bozzolan
Updated 304 Days Ago

NOTE: Thanks for your question! Now it's a Task: T15533

Thanks for this question. I think this is a legitimate bug report. It seems that the environment variable LC_ALL somehow reaches the command. But that should not happen usually. This is a really unexpected situation to me, since some months ago I had the completely contrary problem here, where I was needing some environment variables in an underlying command but none was set by design: T15281

Feel free to copy-paste this question into a Task (now you can create that), maybe under Diffusion but maybe also under Arcanist. So we can continue the discussion there.

New Answer

Answer

This question has been marked as closed, but you can still leave a new answer.