xbps-install: abort transaction if there's insufficient disk space on rootdir.
The free disk space wasn't computed correctly and xbps-install(8) wasn't handling ENOSPC rval in xbps_transaction_prepare().
This commit is contained in:
parent
20326738ed
commit
f52eea34d4
3
NEWS
3
NEWS
@ -1,5 +1,8 @@
|
|||||||
xbps-0.40 (???):
|
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
|
* xbps-query(8): -S/--show mode no longer prints ANSI escape codes if stdout
|
||||||
is not a tty; suggested by @chneukirchen.
|
is not a tty; suggested by @chneukirchen.
|
||||||
|
|
||||||
|
@ -322,6 +322,9 @@ exec_transaction(struct xbps_handle *xhp, int maxcols, bool yes, bool drun)
|
|||||||
array = xbps_dictionary_get(xhp->transd, "conflicts");
|
array = xbps_dictionary_get(xhp->transd, "conflicts");
|
||||||
print_array(array);
|
print_array(array);
|
||||||
fprintf(stderr, "Transaction aborted due to conflicting packages.\n");
|
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 {
|
} else {
|
||||||
xbps_dbg_printf(xhp, "Empty transaction dictionary: %s\n",
|
xbps_dbg_printf(xhp, "Empty transaction dictionary: %s\n",
|
||||||
strerror(errno));
|
strerror(errno));
|
||||||
|
@ -173,7 +173,7 @@ compute_transaction_stats(struct xbps_handle *xhp)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
/* compute free space on disk */
|
/* 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,
|
if (!xbps_dictionary_set_uint64(xhp->transd,
|
||||||
"disk-free-size", rootdir_free_size))
|
"disk-free-size", rootdir_free_size))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user