Linux

sortコマンドのバグ?

More than 3 years have passed since last update.

何の変哲もないテキストファイル

$ cat a.txt
012
-012
-123
123
124

ソートしてみます

$ sort a.txt
012
-012
123
-123
124

えっ??

環境は以下です。

$ sort --version
sort (GNU coreutils) 8.21
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by Mike Haertel and Paul Eggert.
$ cat /proc/version
Linux version 3.13.0-49-generic (buildd@akateko) (gcc version 4.8.2 (Ubuntu 4.8.2-19ubuntu1) ) #83-Ubuntu SMP Fri Apr 10 20:11:33 UTC 2015