2

I develop on F24 and my tests pass, but when I try them in Travis CI, they fail. AFAIK, they (Travis CI) use Ubuntu 12.04 VMs. The test compares the output of a run with previously gathered "gold" output and flags any differences as failures.

In this particular case, the difference arises because a cp command is called on a non-existent file which produces an error message, but the error message is slightly different between the two systems. On Fedora 24, I get:

$ cp foo bar
cp: cannot stat 'foo': No such file or directory

On an Ubuntu 12.04 VM (set up to simulate the Travis CI environment), I get:

$ cp foo bar
cp: cannot stat `foo': No such file or directory

N.B. the backtick in the Ubuntu output, as opposed to the single quote in the F24 output.

I tried export LC_ALL=C, but that does not do anything to either output. F24 has version 8.25 of coreutils (which contains the infamous quoted filename changes in ls output, but afaict this has nothing to do with my problem). Ubuntu 12.04 has version 8.13.

My questions:

1) Is this a change in coreutils between 8.13 and 8.25? Or did Fedora and Ubuntu compile coreutils differently somehow?

2) Do more recent Ubuntu versions use a backtick in this (and presumably other) error messages?

3) Is there any way to set the quotes that are used in error messages? On either system?

4) I'm probably going to munge the output of the command and change any backticks to single quotes before comparing with the "gold" output. Any suggestions for a better method?

EDIT: I have been informed that I can run a more recent version of ubuntu in the Travis CI environment (add "dist: trusty" to .travis.yml). That version (16.04) uses Unicode single quotes (codepoint #x2018) in the en_US.UTF-8 environment for both opening and closing quotes in the error message; it uses ASCII apostrophes in the C locale - that's good enough for my purposes.

  • To make this even more fun: I get yet different output on RHEL. It uses ‘foo’ — that is, left-single quotation mark and right-single quotation-mark. (That's in en_US.UTF-8; in C, it uses two apostrophes, as Fedora does in apparently all cases.) – mattdm May 9 '17 at 21:02
  • 1
    What's the output of locale -a on both systems? – dirkt May 10 '17 at 6:44
  • Did you mean just locale? locale -a just gives me a (long) list of locales installed on each machine. The F24 has everything under the sun; the Ubuntu one has only en-* locales. Both machines are running en_US.UTF-8 by default, but as I mentioned I also tried setting LC_ALL=C (and also LANG=C now) on both, but these settings don't make any difference in the output. – NickD May 11 '17 at 16:09
0

[Edited the question to add this information but adding it as an answer just to close it out. It's still not clear to me why 12.04 uses a backtick, but with the more recent version being available, that question seems moot.]

I have been informed that I can run a more recent version of ubuntu in the Travis CI environment (add "dist: trusty" to .travis.yml). That version (16.04) uses Unicode single quotes (codepoint #x2018) in the en_US.UTF-8 environment for both opening and closing quotes in the error message; it uses ASCII apostrophes in the C locale - that's good enough for my purposes.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.