Trepan-Debuggers / zshdb

gdb-like "trepan" debugger for zsh
GNU General Public License v3.0
295 stars 23 forks source link

Tests fail under some locales #8

Closed irl closed 7 years ago

irl commented 8 years ago

This bug is forwarded from Debian #841342.

zshdb fails to build from source in unstable/amd64 under some locales (eg. LANG="fr_CH.UTF-8").

The code already tries to work around this:

  54 # set the constants readonly
  55 shunit_constants_=`set |grep '^__SHUNIT_' |cut -d= -f1`
  56 echo "${shunit_constants_}" |grep '^Binary file' >/dev/null && \
  57     shunit_constants_=`set |grep -a '^__SHUNIT_' |cut -d= -f1`

… but this doesn't work if the "Binary file" message is in, say, French :)

Changing this:

  - shunit_constants_=`set |grep '^__SHUNIT_' |cut -d= -f1`
  + shunit_constants_=`set |LC_ALL=C grep '^__SHUNIT_' |cut -d= -f1`

… makes this appear to work, but then you get other errors:

--- /tmp/setshow-filtered.check 2016-10-19 18:22:06.324491603 +0200
+++ zshdb-0.92/test/data/setshow.right  2016-07-06 18:47:42.000000000 +0200
@@ -1,4 +1,3 @@
-** pas un tty is not reputed to be a tty.
 (dbg-test2.sh:6):
 fn1 () { echo "fn1 here" x=5 fn3 }

etc. etc.

It would be possible to run the tests with the locales set to C, but this would really just be masking the problem.

rocky commented 8 years ago

The code you cite is part of the test framework, shunit2 not the tests themselves. So perhaps you can open an issue a ticket there and describe the problem.

As for

It would be possible to run the tests with the locales set to C, but this would really just be masking the problem.

Masking what problem? That some sets of tests fail because shunit2 is confused by certain locales? I would be much more concerned about a failure that say that this confusion causes zshdb to malfunction in debugging a zsh program. Is there any evidence it is?

I'm a bit busy right now. And given this rough assessment, I won't be able to get to it in the near future. If you can, would you please see if a more recent shunit2 has this problem? If a newer shunit2 is desirable, can it be slotted in here or will there need to be adjustments to the tests?

And as you hear a lot in open-source github projects: merge requests are always most welcome.

irl commented 8 years ago

Thanks for the information @rocky. I shall investigate.

The shunit2 repo looks not very friendly, but the version there seems to be newer than the latest version in Debian.

irl commented 7 years ago

This was fixed in Debian by forcing locale to C. You're entirely correct, the problem lies with shunit2.

rocky commented 7 years ago

Forcing a locale to C in tests seems to me to be perfectly reasonable thing to do for testing. Would pass along the change so that is used more pervasively?

~Nevermind. I see it it shunit2.~

Change that again. You said that this wouldn't work. Please send a patch.