Skip to content
This repository has been archived by the owner on Apr 15, 2024. It is now read-only.

Unexpected sorting of underscores in ubuntu-gcc-release #29

Open
jdblischak opened this issue Apr 20, 2018 · 0 comments
Open

Unexpected sorting of underscores in ubuntu-gcc-release #29

jdblischak opened this issue Apr 20, 2018 · 0 comments

Comments

@jdblischak
Copy link

I had some unit tests fail only on the Ubuntu r-hub image. The error was due to how sort functioned in that image.

What I expected

I expect that strings starting with an underscore will be sorted alphanumerically before strings starting with standard letters of the alphabet:

> sort(c("a", "_b", "c"))
[1] "_b" "a"  "c"

What I observed

On every machine I have local access to (Ubuntu, macOS, Windows), the sorting is performed this way. Additionally the remote machines I have access to also perform the same (Travis-CI, AppVeyor, winbuilder), including most of the r-hub images. For example:

# r-hub ubuntu-gcc-devel
$ sudo docker run --rm -ti rhub/ubuntu-gcc-devel /opt/R-devel/bin/Rscript -e 'sort(c("a", "_b", "c"))'
[1] "_b" "a"  "c"
# r-hub debian-gcc-devel
$ sudo docker run --rm -ti rhub/debian-gcc-devel /opt/R-devel/bin/Rscript -e 'sort(c("a", "_b", "c"))'
[1] "_b" "a"  "c"
# r-hub debian-gcc-release
$ sudo docker run --rm -ti rhub/debian-gcc-release Rscript -e 'sort(c("a", "_b", "c"))'
[1] "_b" "a"  "c"
# r-hub fedora-clang-devel
$ sudo docker run --rm -ti rhub/fedora-clang-devel /opt/R-devel/bin/Rscript -e 'sort(c("a", "_b", "c"))'
[1] "_b" "a"  "c"
# Rocker (Debian)
$ sudo docker run --rm -ti rocker/r-base Rscript -e 'sort(c("a", "_b", "c"))'
[1] "_b" "a"  "c" 

However, in ubuntu-gcc-release, a leading underscore appears to be ignored when sorting:

$ sudo docker run --rm -ti rhub/ubuntu-gcc-release Rscript -e 'sort(c("a", "_b", "c"))'
[1] "a"  "_b" "c"
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant