[pacman-dev] idea: PM_LOG_ERROR to stderr? (was: [PATCH 1/3] Give sensible feedback when a repo has no configured servers)

Dan McGee dpmcgee at gmail.com
Sat Jun 6 14:31:59 EDT 2009


On Sat, Jun 6, 2009 at 1:29 PM, Nagy Gabor<ngaba at bibl.u-szeged.hu> wrote:
>> This fixes FS#14899. When running an -Sp operation without servers
>> configured for a repository, we would segfault, so add an assert to
>> the backend method returning the first server preventing a null
>> pointer dereference.
>>
>> In addition, add a new error code to libalpm that indicates we have no
>> servers configured for a repository. This makes -Sy and -S <package>
>> operations fail gracefully and helpfully when a repo is set up with no
>> servers, as the default mirrorlist in Arch is provided this way.
>>
>> Signed-off-by: Dan McGee <dan at archlinux.org>
>
> I like this patch.
>
>>+                      const char *dburl = alpm_db_get_url(db);
>>+                      if(dburl) {
>>+                              printf("%s/%s\n", dburl, alpm_pkg_get_filename(pkg));
>>+                      } else {
>>+                              /* can't use WARNING here, we don't show warnings in -Sp... */
>>+                              pm_fprintf(stderr, PM_LOG_ERROR, _("no database for package: %s\n"),
>>+                                              alpm_pkg_get_name(pkg));
>>+                      }
>
> IMHO we should print all error messages to stderr. (This can be
> done easily in callback functions.) I am sure that it would be better
> with -Sp (-Sp users usually do pacman -Sup > foo.txt), and I don't see
> any drawbacks in other cases. (What about our scripts?) See also:
> FS#12101.
>
> Opinions?

Yeah, I think we should probably get in this habit as well.

However, do we do more than just error messages? For example, the
above would capture the "resolving dependencies..." text on stdout, so
your first line of your text file would be bum.

-Dan


More information about the pacman-dev mailing list