Skip to content

Wipes the file and settings.json if disk is full.  #3196

@v972501

Description

@v972501

If disk is out of space and opening a file, micro wipes the file's content and it's settings.json file. Files still remain but their size is zero. No backups are created.

I have little disk space frequently so as a work-around I now launch micro through a small check script:

#!/bin/bash
echo "Checking disk space available..."
THRESHOLD_BYTES=$((50 * 1024 * 1024))
available_space=$(df --output=avail -B1 / | tail -n 1)

if [ "$available_space" -lt "$THRESHOLD_BYTES" ]; then
    echo "Error: Not enough disk space available. Aborting."
    exit 1
fi
echo "OK"
micro "$@"

OS: Debian
Terminal: xfce4-terminal

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions