pacman/lib/libalpm
Nagy Gabor 31d95b8679 Print error message when to-be-downloaded file cannot be created
It can happen that the to-be-downloaded file cannot be created in cachedir.
For example, I am an -Sup user, and it is comfortable to set --cachedir to
/mnt/pendrive, which is a FAT filesystem, so files like
capseo-1:0.3-2-i686.pkg.tar.xz cannot be downloaded to there.

Before this patch, pacman didn't give clear output about what happens when
the download code could not create the necessary file. This can be confusing
with -Su. An example output:
***
$ sudo pacman -S capseo bochs --cachedir /c/TEMP

resolving dependencies...
looking for inter-conflicts...

Targets (2): bochs-2.4.6-1  capseo-1:0.3-2

Total Download Size:    0.61 MiB
Total Installed Size:   2.61 MiB

Proceed with installation? [Y/n]
:: Retrieving packages from extra...
warning: failed to retrieve some files from extra
 bochs-2.4.6-1-i686       611.5 KiB   118K/s 00:05 [------------------]  97%
error: failed to commit transaction (unexpected error)
Errors occurred, no packages were upgraded.
***

After the patch, pacman will give more informative error message (and
pm_errno is set properly):
***
error: could not open file '/c/TEMP/capseo-1:0.3-2-i686.pkg.tar.xz.part': Invalid argument
error: failed to commit transaction (failed to retrieve some files)
***

Unfortunately, the "could not open file" error message is printed for
every mirror (that can be dozens of lines), which is ugly, but at least
informative... Without modifying the download logic (for example, by
introducing -2 return value for _alpm_download() to indicate giving up),
this ugliness cannot be eliminated.

Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-02-20 16:51:55 -06:00
..
po Translation updates from Transifex, mostly scripts 2012-02-06 21:59:12 -06:00
.gitignore Remove unnecessary entries from .gitignore files 2007-07-16 16:49:28 -04:00
Makefile.am include config.h via Makefiles 2011-12-21 18:13:17 -06:00
add.c Clean up <inttypes.h> header inclusions 2012-01-07 11:28:37 -06:00
add.h Rename pmhandle_t to alpm_handle_t 2011-06-28 14:04:00 +10:00
alpm.c ALPM API adjustments for sanity and consistency 2012-02-06 05:49:52 -06:00
alpm.h Merge branch 'maint' 2012-02-13 10:14:06 -06:00
alpm_list.c Merge branch 'maint' 2012-02-06 05:50:48 -06:00
alpm_list.h Remove alpm_list_getdata wrapper function 2011-10-12 14:22:49 -05:00
backup.c include config.h via Makefiles 2011-12-21 18:13:17 -06:00
backup.h Allow fileconflict if unowned file moving into backup array 2011-07-14 15:34:04 -05:00
base64.c Use 32-bit wide integer type in PolarSSL code 2012-01-07 11:27:41 -06:00
base64.h base64: don't compile base64_encode() function 2011-10-17 12:03:02 -05:00
be_local.c ALPM API adjustments for sanity and consistency 2012-02-06 05:49:52 -06:00
be_package.c use _alpm_access in a few more places for increased debugging info 2012-02-13 10:02:02 -06:00
be_sync.c use _alpm_access in a few more places for increased debugging info 2012-02-13 10:02:02 -06:00
conflict.c include config.h via Makefiles 2011-12-21 18:13:17 -06:00
conflict.h Convert package filelists to an array instead of linked list 2011-07-21 15:04:30 -05:00
db.c ALPM API adjustments for sanity and consistency 2012-02-06 05:49:52 -06:00
db.h Introduce alpm_time_t type 2011-10-12 14:01:25 -05:00
delta.c Allow UseDelta option to specify a delta ratio 2012-01-18 22:10:06 -06:00
delta.h Allow UseDelta option to specify a delta ratio 2012-01-18 22:10:06 -06:00
deps.c libalpm/deps.c: access trans flags directly 2012-01-23 12:21:05 -06:00
deps.h Be more robust when copying package data 2011-08-19 11:09:57 -05:00
diskspace.c Remove last explicit include of config.h 2012-02-06 05:49:40 -06:00
diskspace.h diskspace: add _alpm_check_downloadspace() 2011-10-17 08:39:04 -05:00
dload.c Print error message when to-be-downloaded file cannot be created 2012-02-20 16:51:55 -06:00
dload.h sync: extract build_payload() method from find_dl_candidates 2011-10-21 19:29:31 -05:00
error.c include config.h via Makefiles 2011-12-21 18:13:17 -06:00
graph.c include config.h via Makefiles 2011-12-21 18:13:17 -06:00
graph.h include config.h via Makefiles 2011-12-21 18:13:17 -06:00
group.c include config.h via Makefiles 2011-12-21 18:13:17 -06:00
group.h Rename internal functions with grp in their name 2011-06-29 15:52:33 +10:00
handle.c ALPM API adjustments for sanity and consistency 2012-02-06 05:49:52 -06:00
handle.h Allow UseDelta option to specify a delta ratio 2012-01-18 22:10:06 -06:00
log.c include config.h via Makefiles 2011-12-21 18:13:17 -06:00
log.h Rename pmloglevel_t to alpm_loglevel_t 2011-06-28 23:28:24 +10:00
md5.c Use 32-bit wide integer type in PolarSSL code 2012-01-07 11:27:41 -06:00
md5.h Update MD5 routines with changes from PolarSSL 2011-08-11 20:17:21 -05:00
package.c include config.h via Makefiles 2011-12-21 18:13:17 -06:00
package.h include config.h via Makefiles 2011-12-21 18:13:17 -06:00
pkghash.c pkghash improvements/modifications 2012-01-02 19:41:42 -06:00
pkghash.h pkghash improvements/modifications 2012-01-02 19:41:42 -06:00
rawstr.c include util.h in rawstr.c 2011-07-05 22:36:40 -05:00
remove.c Merge branch 'maint' 2012-01-23 12:20:52 -06:00
remove.h Be smarter about running ldconfig during removal transactions 2011-09-19 13:18:42 -05:00
sha2.c Use 32-bit wide integer type in PolarSSL code 2012-01-07 11:27:41 -06:00
sha2.h Add sha2 (sha256) routines from PolarSSL 2011-08-15 07:07:13 -05:00
signing.c Merge branch 'maint' 2012-01-23 12:20:52 -06:00
signing.h signing: add a process and retry loop for database signatures 2011-09-20 10:23:11 -05:00
sync.c Merge branch 'maint' 2012-02-13 10:14:06 -06:00
sync.h Rename pmhandle_t to alpm_handle_t 2011-06-28 14:04:00 +10:00
trans.c Allow specifying shell for running scriptlets 2012-02-13 10:02:35 -06:00
trans.h Refactor _alpm_runscriptlet() 2011-09-30 10:55:58 -05:00
util.c Reset errno before opening archive 2012-02-13 10:03:05 -06:00
util.h Remove rmrf implementation from backend 2012-01-23 12:21:11 -06:00
version.c include config.h via Makefiles 2011-12-21 18:13:17 -06:00