[pacman-dev] [PATCH] Restore trimming of db and pkg extensions
Dan McGee
dpmcgee at gmail.com
Tue Sep 7 10:32:22 EDT 2010
On Tue, Sep 7, 2010 at 9:11 AM, Allan McRae <allan at archlinux.org> wrote:
> On 07/09/10 23:25, Dan McGee wrote:
>>
>> These keep having to change because we are getting really good at changing
>> the downloaded filename. Shorten the match sequences to just .db and .pkg
>> and trim everything after and including these strings.
>>
>> Signed-off-by: Dan McGee<dan at archlinux.org>
>> ---
>> src/pacman/callback.c | 2 +-
>> 1 files changed, 1 insertions(+), 1 deletions(-)
>>
>> diff --git a/src/pacman/callback.c b/src/pacman/callback.c
>> index 3696d3c..32dafb5 100644
>> --- a/src/pacman/callback.c
>> +++ b/src/pacman/callback.c
>> @@ -575,7 +575,7 @@ void cb_dl_progress(const char *filename, off_t
>> file_xfered, off_t file_total)
>>
>> fname = strdup(filename);
>> /* strip package or DB extension for cleaner look */
>> - if((p = strstr(fname, ".pkg.tar.")) || (p = strstr(fname,
>> ".db.tar."))) {
>> + if((p = strstr(fname, ".pkg")) || (p = strstr(fname, ".db"))) {
>> *p = '\0';
>> }
>> /* In order to deal with characters from all locales, we have to
>> worry
>
>
> I just had an interesting thought. Would a pkgname with ".pkg" or ".db" in
> it cause havoc? pkgname="i.am.a.pkg" is valid...
It would make the download progress bar look a bit odd, but nothing
more than that. The same would have currently happened had ".pkg.tar."
been in the package name. We could try to find the last occurrence to
be a bit more safe I suppose...
If we wanted to "do the right thing" here, it probably involves
passing some sort of nice displayable name from the backend up, but
that seems a bit silly.
-Dan
More information about the pacman-dev
mailing list