Page MenuHomePhorge

Fix Arcanist unit test ArcanistBundleTestCase->testNonlocalTrailingNewline() on non-English terminal
Closed, ResolvedPublic

Description

Steps to reproduce.

Have a terminal in a non-english language, like Italian, and:

arc unit src/parser/__tests__/ArcanistBundleTestCase.php

What happens:

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

             26    v
             27    w
             28    x
             29    y
             30    z
   >>>       31   \ Manca newline alla fine del file

What should happen instead:

$ LC_ALL=C arc unit src/parser/__tests__/ArcanistBundleTestCase.php
   PASS    5ms★  ArcanistBundleTestCase::testTrailingContext
   PASS    4ms★  ArcanistBundleTestCase::testMergeHunks
   PASS    2ms★  ArcanistBundleTestCase::testNonlocalTrailingNewline
   PASS    1ms★  ArcanistBundleTestCase::testEncodeBase85
   PASS   1.1s   ArcanistBundleTestCase::testGitRepository
   PASS    3ms★  ArcanistBundleTestCase::testDisjointHunks
   PASS   <1ms★  ArcanistBundleTestCase::testTabEncoding

Event Timeline

valerio.bozzolan renamed this task from Fix Arcanist unit test - Diff Parse Exception: Expected '\ No newline at end of file' to Fix Arcanist unit test ArcanistBundleTestCase->testNonlocalTrailingNewline() on non-English terminal.Aug 23 2024, 13:40
valerio.bozzolan triaged this task as Wishlist priority.
valerio.bozzolan updated the task description. (Show Details)

Has anybody a terminal with non-English environment and that obtains a non-English output with this command?

diff --help
...
Confronta i file riga per riga.

In my environment (Debian stable) it's in Italian. So I reproduce the issue. Note that Italian localization GNU Gettext files are provided as default in Debian.

https://packages.debian.org/bookworm/amd64/diffutils/filelist

And so it seems in Fedora

https://packages.fedoraproject.org/pkgs/diffutils/diffutils/fedora-41.html#files

So I think the proposed patch has sense, since it only does this:

LC_ALL=C diff --help
...
Compare FILES line by line.

I can reproduce this (KDE on Debian 12, everything set to Dutch: LC_ALL evaluates to nl_NL.UTF-8). diff returns localized output, but doesn't when using LC_ALL=C.

Thanks, little cute Phorge kitten in profile picture <3