uutils / uutils/coreutils

bug(sort): using --check=diagnose-first with /dev/urandom and /dev/mem and other devices leads to different outputs and slowdown 21x times

Open
#13,149 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

U - sort
Dominant language
Rust
Stars
24.1k
Forks
2k
Avg merge
1d 5h
Merged PRs (30d)
365

Description

Hi, uutils mainteners

we confirmed the uu sort input very small and different than the gnu sort when using --check=diagnose-first, as i confirmed

relunsec@relunsec:~/software/coreutils/target/debug$ sudo gnusort --check=diagnose-first /dev/mem
gnusort: /dev/mem:4: disorder: I*KNM`P �R T 
                                            X *Z N\ `�a�b ��d�e ��g�h �jk -m-n -GpGq G~ ��	�� �-`�
�� �@� 1X (�V 1X Pd@A&0�6� A 0`0*�Q*@0p�4�Q*@�H?@0b�2@@�h[��r�<P�������E����������E��                  д �1l�rQ� n(UĎ!�	�� �"
                                                                                  For Evaluation Use Only.
relunsec@relunsec:~/software/coreutils/target/debug$ sudo ./sort --check=diagnose-first /dev/mem
sort: /dev/mem:2: disorder: ␦*2:-
                                 =Y
relunsec@relunsec:~/software/coreutils/target/debug$ 

and we confirmed also the uu sort slow in that benchmark

relunsec@relunsec:~/software/coreutils/target/debug$ sudo time ./sort --check=diagnose-first /dev/mem
sort: /dev/mem:2: disorder: ␦*2:-
                                 =Y
Command exited with non-zero status 1
0.81user 0.04system 0:00.85elapsed 100%CPU (0avgtext+0avgdata 7076maxresident)k
0inputs+0outputs (0major+659minor)pagefaults 0swaps
relunsec@relunsec:~/software/coreutils/target/debug$ sudo time gnusort --check=diagnose-first /dev/mem
gnusort: /dev/mem:4: disorder: I*KNM`P �R T 
                                            X *Z N\ `�a�b ��d�e ��g�h �jk -m-n -GpGq G~ ��	�� �-`�
�� �@� 1X (�V 1X Pd@A&0�6� A 0`0*�Q*@0p�4�Q*@�H?@0b�2@@�h[��r�<P�������E����������E��                  д �1l�rQ� n(UĎ!�	�� �"
                                                                                  For Evaluation Use Only.
Command exited with non-zero status 1
0.00user 0.03system 0:00.04elapsed 100%CPU (0avgtext+0avgdata 2404maxresident)k
0inputs+0outputs (0major+309minor)pagefaults 0swaps
relunsec@relunsec:~/software/coreutils/target/debug$ 

and also with

relunsec@relunsec:~/software/coreutils/target/debug$ sudo time gnusort --check=diagnose-first /dev/urandom
gnusort: /dev/urandom:3: disorder: �����Ǿ
Command exited with non-zero status 1
0.00user 0.00system 0:00.06elapsed 10%CPU (0avgtext+0avgdata 1612maxresident)k
448inputs+0outputs (2major+158minor)pagefaults 0swaps
relunsec@relunsec:~/software/coreutils/target/debug$ sudo time ./sort --check=diagnose-first /dev/urandom
sort: /dev/urandom:3: disorder: weK5~�Z�9��h�Y�I#��X������)��<�j�Դ����
�@�␦}|́�����.ò`7qf�r�fn)�����x"^V�^�~?wG���Xd�W�␦B��2�H�Ȼ��/S�j��a8uibB�)5)�y/q�Nb���2�����-���I�
                                                                                                k�ߦ��ugwG2rd��0$���4�$g6O%S[�����x$(f�����]�x�X2�2uzɽ�3��u��6���m�$(%���soȋ^`:��8�HC� �5
                                                                                                                                                                                        ���.{H��%��T���?��'4���<�vG׹2�ᝓx/̜.+#��R}"����}N�Y(���4�(�R�g}��V>�܀b��z��I�WW�'�G�/{) 15i~eW'^����`�z�����	�l��K�:�WG`���N�h����]g����1���<␦��������(��K4z�4R炝�? Z%��Y�VK �Gd�(z�K�N6��$�z��ߗ�ɥ 3�y0���Z�
                                                                                                                                                       �Cw��	caL��щl��O��}�c�AZu�4d��*�zuʼnL6sE��d��I,'HIa�?i��
Command exited with non-zero status 1
0.21user 0.00system 0:00.22elapsed 100%CPU (0avgtext+0avgdata 6636maxresident)k
0inputs+0outputs (12major+481minor)pagefaults 0swaps
relunsec@relunsec:~/software/coreutils/target/debug$ sudo time gnusort --check=diagnose-first /dev/urandom
�J�&n"V�cW�&�[��6>dom:2: disorder: ��n������
Command exited with non-zero status 1
0.00user 0.00system 0:00.00elapsed 100%CPU (0avgtext+0avgdata 1768maxresident)k
0inputs+0outputs (0major+158minor)pagefaults 0swaps
relunsec@relunsec:~/software/coreutils/target/debug$ sudo time gnusort --check=diagnose-first /dev/urandom
gnusort: /dev/urandom:3: disorder: �.<i��J7�S�����eB@5&�� vϯ̒�k>n3uC-y�+Y������ŗN=�O)]�)c�t�v��g~�٫\vW*S5	5fĻ���=|rt،�P��M�,��J"^���H�eo
                                                                                                                                               �	W�\J�"�~�
                                                                                                                                                                 ƻ��j6�@#¶f��� ���|;�ࡷ'␦p14��I}�	�Bm̯�K_q�uj��K����yE�j�"1�;��`�pD���|�g���
��J��1�6'���HT��$�JM��@V~P���؈T��!����=�"��eL6���A�;�b��O��C¿��&fM�	����W.�\V�X���`E8�G>�N�=�.�Y����(9�qZ���Z���`l��°z�"9W^)P"�XN$��n4�
                                                                                                                                           �/M��K␦���q��q�^E�>�.d�jWg2�:j=��M���g?�U}�9�Q�we�}4��A�Z�bƎ0Ǵ�`[ޝY^����p��I��t�q~{�1ۮ/��+$�Ŧ��\�g�+s�Uv���Ni�$d%X	Ɲ��␦sx�V�򖏦��+��<X��NB�帊}�:ܒN_���g�&$������"z<䲌��&6p���BL������[�
Command exited with non-zero status 1
0.00user 0.00system 0:00.00elapsed 100%CPU (0avgtext+0avgdata 1752maxresident)k
0inputs+0outputs (0major+159minor)pagefaults 0swaps
relunsec@relunsec:~/software/coreutils/target/debug$ sudo time gnusort --check=diagnose-first /dev/urandom
gnusort: /dev/urandom:3: disorder: |���5W�C����E*l���d����y85=K#��n�j7�lj6O�s���EDd��O�eW����:k �z
_yt0����                                                                                         ���n��XT͡iX[Q��|������P�ϔ�T�����ji6L�aݤ��g(���{\��ui.������<H�*#L�q��ؐ����mi��Ѕ���
Command exited with non-zero status 1
0.00user 0.00system 0:00.00elapsed 100%CPU (0avgtext+0avgdata 1656maxresident)k
0inputs+0outputs (1major+157minor)pagefaults 0swaps
relunsec@relunsec:~/software/coreutils/target/debug$ sudo time gnusort --check=diagnose-first /dev/urandom
gnusort: /dev/urandom:3: disorder: �␦ ^�{I�oͧ��!h��O��M�ٸ��uP�ƣx+��"��A-ꧽ��=Kg�,�%
                                                                                 _�<�F�IT�[��}�B�Hȁ�6��v̱���yR�wܢ6␦�ͩ�y��^e�S&�PU�4��Ј܃�e2a�k�{�ƾ�R^�LK]Nw
                                                                                                                                                        �xc���m�ᎍ�D�␦�J|�
                                                                                                                                                                         ���EsS�M��S��zB�J_��EÀ�C����%��3��ShW#z]4fq��`�����;3f�k6�����m𲛛�������g�^�gaO�INn�>]���t��{jP�6���3$��Po<��Z␦�8�K���b���܋e%6VRƑy]�g�m�<CP<��+f�(Y11�m�(���� �0��Y<PU��6���Ʀ!G:��՘��op2r�G�m}���e&
                                                                                                                               🺩<���HX�3K@`5�������y��/�`�P=rw��t�=K�[���~M�Sk�����S�)$��pGk�K�z�}]9��8R�Bzxg#�ã܋�x#����ߥ��H�N�?\j���iJ����Sj�~6;4�Y95�d{
Command exited with non-zero status 1
0.00user 0.00system 0:00.00elapsed 100%CPU (0avgtext+0avgdata 1864maxresident)k
0inputs+0outputs (2major+157minor)pagefaults 0swaps
relunsec@relunsec:~/software/coreutils/target/debug$ sudo time gnusort --check=diagnose-first /dev/urandom
gnusort: /dev/urandom:5: disorder: V�x>^���Nu��B���m�Q0uZ%��2
Command exited with non-zero status 1
0.00user 0.00system 0:00.00elapsed 50%CPU (0avgtext+0avgdata 1764maxresident)k
0inputs+0outputs (0major+160minor)pagefaults 0swaps
relunsec@relunsec:~/software/coreutils/target/debug$ sudo time gnusort --check=diagnose-first /dev/urandom
gnusort: /dev/urandom:5: disorder: =$��Ӽ������OB�[��)�
                                                      �@C6;�=rV/��S�̝���⨙�N�k��L�b�Y*D�)r>t��L��Nd��3���c[�y%��0)�)��]�o��N���m��#�[����r�	�W1�z�,ʣ���`�o�c�0�Z���r�ճ%Z�}�Z�2�PL*ҝ��D3�4��3	b-�r���=��␦c�A5X�'��|!�u�ZGJ����Y6v�Q�ϫ{V~C��2$2Ю��U�7�E�Q�nD�߱���u�{��OJu����o����,�p<���R ���:؛7
       ^�7���!�t��)�L����g#bH
                             ��
                               ��"4�!�p�����x�l�oP��o�W�3�������n���(��#:����<�6o��\D_ڀE�V�)���6[�����N�򗄆��4�&r�p�vJ�h%7��S�sx��R�k�F�Z-qa��/�c:}�|���	ʪ�w�����^MC�i��� F1��$�����-!��4�Q�1�v␦�im	q)Ď�A,��7=&�pŃ��g7�␦�[�7���Fk��I���0x1��{(�L�*��'��t[��}J<#�Ġ=/��(���(��*6`~�t��K̤HgQrGƑ��xYЁ�o�3�Z
                                                             �O���%�!���Z���Ա�@P����`�. ޿�s�'@0|���]a��:QT��T'�.�%Pi�83�V���6��ޮ4�!�#_{c?�0az��QWߣ���:�c�j�␦���1��j�3�?�G���k/[�ː���������6�sgb閁�Mj�ߓ���Q���)Txeoz'㷏�h��'#)*#h��v�Ġ�[��p�|�vp6�?j-N�y�ն�����
Command exited with non-zero status 1
0.00user 0.00system 0:00.00elapsed 33%CPU (0avgtext+0avgdata 1768maxresident)k
0inputs+0outputs (1major+160minor)pagefaults 0swaps
relunsec@relunsec:~/software/coreutils/target/debug$ sudo time gnusort --check=diagnose-first /dev/urandom
gnusort: /dev/urandom:3: disorder: ���ƉJ��jEұ	P>�h��$w�I�mp��
                                                               ���6�F�vP�G�3�$�,�=�t�&rm|k�8�Ph<�
��<!��:�z                                                                                        �ZF5��E�K�sR/�@�s,�����&�絩��nZ��<�eR��[��N7��)�~��r^.ڃ�t���=>��"W���+x 9x��f/_%�%�*���Y�ش�K��o�.)�U��#���V6߂��x~@�=�T�o��؛�0{Z�&���
Command exited with non-zero status 1
0.00user 0.00system 0:00.00elapsed 83%CPU (0avgtext+0avgdata 1776maxresident)k
0inputs+0outputs (2major+162minor)pagefaults 0swaps
relunsec@relunsec:~/software/coreutils/target/debug$ sudo time gnusort --check=diagnose-first /dev/urandom
n���d�]��+Q��W��l��ό�@BA�E�f�{&�st������N�E�P��1e&s4����N���(�h^*����$f�[�~�-x!�\9�Ę��%֯1�ސ9;BvAi�������k�K�<�e�ռP>��\#��+�C���D��v���۔uC���6tJSJ�k���E`��^�7���eڼ0J��<<����+	<����E4�N�G���,`
                                                                                                                                            �/�����)���0~���dZ� D��O�:3���%� `�
Command exited with non-zero status 1
0.00user 0.00system 0:00.00elapsed 100%CPU (0avgtext+0avgdata 1724maxresident)k
0inputs+0outputs (0major+159minor)pagefaults 0swaps
relunsec@relunsec:~/software/coreutils/target/debug$ sudo time ./sort --check=diagnose-first /dev/urandom
sort: /dev/urandom:3: disorder: j��,��YaW�#�y��?�S�qC�C�L���␦�ᦃ�'v���n��R�䐉��/c�����y������3���O�솰�������ϴ8
�U��h,�%4#�����{x�*����y��~j��	��5�1�[V��Q,
���L,�����Yӊ��è�� �bMW�g$*-oJK�7�l3s������)��
Command exited with non-zero status 1
0.20user 0.01system 0:00.21elapsed 99%CPU (0avgtext+0avgdata 6652maxresident)k
0inputs+0outputs (0major+477minor)pagefaults 0swaps
relunsec@relunsec:~/software/coreutils/target/debug$ 

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the reported commands with uutils sort and GNU sort using --check=diagnose-first on /dev/mem and /dev/urandom. Compare the first disorder report, output, and elapsed time across repeated runs. Done means the differing behavior and slowdown are explained and the sort implementation has matching, tested behavior for these device inputs.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
cli, performance
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.