News for hackers. Stuff that matters.
Re:A disk so full, it couldn't be restored by matja on Thursday April 04, 2024 @07:48AM (#39929118)
Simple to verify with strace -f bash -c "> file":

    openat(AT_FDCWD, "file", O_WRONLY|O_CREAT|O_TRUNC, 0666) = 3
man 2 openat:

    O_TRUNC
        If the file already exists and is a regular file and the
        access mode allows writing (i.e., is O_RDWR or O_WRONLY) it
        will be truncated to length 0.
        ...
Re:A disk so full, it couldn't be restored by pdimitar on Thursday April 04, 2024 @07:55AM (#39929203)
Sure, but I just get an interactive prompt when I type `> file` and I honestly don't care to troubleshoot. ¯\_(ツ)_/¯
Re:A disk so full, it couldn't be restored by matja on Thursday April 04, 2024 @08:20AM (#39929474)
Ok, we'll leave that a mystery then!
Re:A disk so full, it couldn't be restored by matja on Friday April 05, 2024 @10:05AM (#39942520)
Probably you are using zsh and need:

    MULTIOS=1 > file
- zsh isn't POSIX compatible by default
Re:A disk so full, it couldn't be restored by pdimitar on Friday April 05, 2024 @10:25AM (#39942744)
I see. But in this case it's best to just memorize `truncate -s0` which is shell-neutral.