FS#5887 - Pacman: Error checking when removing packages
Attached to Project:
Pacman
Opened by Chris Mortimore (chrismortimore) - Friday, 24 November 2006, 22:11 GMT
Last edited by Aaron Griffin (phrakture) - Thursday, 08 February 2007, 08:10 GMT
Opened by Chris Mortimore (chrismortimore) - Friday, 24 November 2006, 22:11 GMT
Last edited by Aaron Griffin (phrakture) - Thursday, 08 February 2007, 08:10 GMT
|
Details
Request: Error checking when removing packages. Problems
occur when the filesystems are mounted read only, and
"pacman -R [package]" is ran. Pacman tries to remove
[package], errors about a read only filesystem are thrown to
the screen, but pacman still removes the package from the
database. This means that the files remain orphaned on the
system. I consider this a bug, but tomk considers it a
feature request.
Discussed in this thread: http://bbs.archlinux.org/viewtopic.php?t=27233&highlight= |
This task depends upon
Closed by Dan McGee (toofishes)
Monday, 12 February 2007, 00:38 GMT
Reason for closing: Fixed
Additional comments about closing: Fixed in pacman CVS.
Monday, 12 February 2007, 00:38 GMT
Reason for closing: Fixed
Additional comments about closing: Fixed in pacman CVS.
access (path, W_OK);
you could simply check if the filesystem in this path is writable (even the file), doing this for all files in the list before starting to remove (even one) file of the package:
for (lp = alpm_list_last(info->files; lp; lp = lp->prev) {
if (access(lp->data)) { // don't know if lp->data holds the full path...
return (1); // error case - file not writable, can't delete
}
}
for(lp = alpm_list_last(info->files); lp; lp = lp->prev) {
unlink_file(info, lp, targ, trans, filenum, &position);
}
A bit sad you have to go trough the list twice, but the only way in my eyes.
Kind regards,
Georg
of course, sometimes a bit of a brainless fast-writer.