Skip to content
Snippets Groups Projects
  • Simon Rose's avatar
    ac5611be
    Small fix for weird buffering issue · ac5611be
    Simon Rose authored
    This seems to be a very specific, limited issue, affecting virtualbox VMs only. There appears to
    be an issue with how append data is buffered and written to disk. You can see this with the
    following commands:
    
    ```console
    $ rm -f out.tmp && seq 1569 >> out.tmp && ls -l out.tmp
    -rw-r--r-- 1 simonrose vagrant 8188 Feb 14 12:12 se.tmp
    $ rm -f out.tmp && seq 1560 >> out.tmp && ls -l out.tmp
    -rw-r--r-- 1 simonrose vagrant 8192 Feb 14 12:12 se.tmp
    $ rm -f out.tmp && seq 9999 >> out.tmp && ls -l out.tmp
    -rw-r--r-- 1 simonrose vagrant 8192 Feb 14 12:12 se.tmp
    ```
    Note that the last two files are the same size, when they should clearly be quite different. If we
    remove the `>>` and replace it with a `>`, then all works correctly:
    ```console
    $ rm -f out.tmp && seq 9999 > out.tmp && ls -l out.tmp
    -rw-r--r-- 1 simonrose vagrant 48888 Feb 14 13:14 out.tmp
    ```
    Note the file size in this case.
    ac5611be
    History
    Small fix for weird buffering issue
    Simon Rose authored
    This seems to be a very specific, limited issue, affecting virtualbox VMs only. There appears to
    be an issue with how append data is buffered and written to disk. You can see this with the
    following commands:
    
    ```console
    $ rm -f out.tmp && seq 1569 >> out.tmp && ls -l out.tmp
    -rw-r--r-- 1 simonrose vagrant 8188 Feb 14 12:12 se.tmp
    $ rm -f out.tmp && seq 1560 >> out.tmp && ls -l out.tmp
    -rw-r--r-- 1 simonrose vagrant 8192 Feb 14 12:12 se.tmp
    $ rm -f out.tmp && seq 9999 >> out.tmp && ls -l out.tmp
    -rw-r--r-- 1 simonrose vagrant 8192 Feb 14 12:12 se.tmp
    ```
    Note that the last two files are the same size, when they should clearly be quite different. If we
    remove the `>>` and replace it with a `>`, then all works correctly:
    ```console
    $ rm -f out.tmp && seq 9999 > out.tmp && ls -l out.tmp
    -rw-r--r-- 1 simonrose vagrant 48888 Feb 14 13:14 out.tmp
    ```
    Note the file size in this case.
Code owners
Assign users and groups as approvers for specific file changes. Learn more.