diff --git a/NEWS b/NEWS index 9dc0441c..729a225b 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,8 @@ xbps-0.40 (???): + * xbps-install(8): handle xbps_transaction_prepare() returning ENOSPC, to + abort a transaction when there's insufficient disk space on rootdir. + * xbps-query(8): -S/--show mode no longer prints ANSI escape codes if stdout is not a tty; suggested by @chneukirchen. diff --git a/bin/xbps-install/transaction.c b/bin/xbps-install/transaction.c index 8a9a3441..efd964a2 100644 --- a/bin/xbps-install/transaction.c +++ b/bin/xbps-install/transaction.c @@ -322,6 +322,9 @@ exec_transaction(struct xbps_handle *xhp, int maxcols, bool yes, bool drun) array = xbps_dictionary_get(xhp->transd, "conflicts"); print_array(array); fprintf(stderr, "Transaction aborted due to conflicting packages.\n"); + } else if (rv == ENOSPC) { + /* not enough free space */ + fprintf(stderr, "Transaction aborted due to insufficient disk space.\n"); } else { xbps_dbg_printf(xhp, "Empty transaction dictionary: %s\n", strerror(errno)); diff --git a/lib/transaction_dictionary.c b/lib/transaction_dictionary.c index e8157cb2..9abcc81a 100644 --- a/lib/transaction_dictionary.c +++ b/lib/transaction_dictionary.c @@ -173,7 +173,7 @@ compute_transaction_stats(struct xbps_handle *xhp) return 0; } /* compute free space on disk */ - rootdir_free_size = svfs.f_bavail * svfs.f_bsize - instsize; + rootdir_free_size = svfs.f_bfree * svfs.f_bsize; if (!xbps_dictionary_set_uint64(xhp->transd, "disk-free-size", rootdir_free_size))