Created
April 7, 2016 19:34
-
-
Save mweitzel/67f69e7d1f9af34ff06aa0e50ed341d0 to your computer and use it in GitHub Desktop.
bug in `ls` while using "-h" flag on files of bytesize between 1023487 and 1024000
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-rw-r--r-- 1 matthew staff 1023487 Apr 7 15:34 tmpfile | |
-rw-r--r-- 1 matthew staff 999K Apr 7 15:34 tmpfile | |
-rw-r--r-- 1 matthew staff 1023488 Apr 7 15:34 tmpfile | |
-rw-r--r-- 1 matthew staff 1000 Apr 7 15:34 tmpfile | |
-rw-r--r-- 1 matthew staff 1023999 Apr 7 15:34 tmpfile | |
-rw-r--r-- 1 matthew staff 1000 Apr 7 15:34 tmpfile | |
-rw-r--r-- 1 matthew staff 1024000 Apr 7 15:34 tmpfile | |
-rw-r--r-- 1 matthew staff 1.0M Apr 7 15:34 tmpfile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
ls_test_on_file_w_bs() { | |
dd if=/dev/zero of=tmpfile bs=$1 count=1 > /dev/null 2>&1 | |
ls -l tmpfile | |
ls -hl tmpfile | |
} | |
ls_test_on_file_w_bs 1023487 | |
echo | |
ls_test_on_file_w_bs 1023488 | |
# and all sizes in between | |
ls_test_on_file_w_bs 1023999 | |
echo | |
ls_test_on_file_w_bs 1024000 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment