Mageia Bugzilla – Attachment 8537 Details for
Bug 19571
overflow when querying for size with urpmq
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
New Account
|
Forgot Password
[patch]
add support for querying >4gb package size
URPM-size.patch (text/plain), 1.63 KB, created by
Thierry Vignaud
on 2016-10-15 05:30:36 CEST
(
hide
)
Description:
add support for querying >4gb package size
Filename:
MIME Type:
Creator:
Thierry Vignaud
Created:
2016-10-15 05:30:36 CEST
Size:
1.63 KB
patch
obsolete
>(get_int2) try new 64bit tag else old 32bit tag > >thus enabling to report size of >4Gb packages (however insane this is) > >diff -up ./URPM.xs.tv ./URPM.xs >--- ./URPM.xs.tv 2016-10-15 03:29:51.555548914 +0200 >+++ ./URPM.xs 2016-10-15 03:32:31.973240843 +0200 >@@ -210,4 +210,13 @@ > } > >+static uint64_t >+get_int2(const Header header, rpmTag newtag, rpmTag oldtag) { >+ struct rpmtd_s val; >+ >+ if (!headerGet(header, newtag, &val, HEADERGET_DEFAULT)) >+ headerGet(header, oldtag, &val, HEADERGET_DEFAULT); >+ return rpmtdGetNumber(&val); >+} >+ > static size_t > get_filesize(const Header h) { >@@ -757,7 +766,7 @@ > const char *nvr = headerGetAsString(pkg->h, RPMTAG_NVR); > const char *arch = get_arch(pkg->h); > p += 1 + snprintf(buff, sizeof(buff), "%s.%s@%llu@%llu@%s", nvr, arch, >- get_int(pkg->h, RPMTAG_EPOCH), get_int(pkg->h, RPMTAG_SIZE), >+ get_int(pkg->h, RPMTAG_EPOCH), get_int2(pkg->h, RPMTAG_LONGSIZE, RPMTAG_SIZE), > get_name(pkg->h, RPMTAG_GROUP)); > pkg->info = memcpy(malloc(p-buff), buff, p-buff); > } >@@ -1754,7 +1763,7 @@ > OUTPUT: > RETVAL > >-int >+long > Pkg_size(pkg) > URPM::Package pkg > CODE: >@@ -1764,12 +1773,12 @@ > if ((s = strchr(pkg->info, '@')) != NULL && (s = strchr(s+1, '@')) != NULL) { > if ((eos = strchr(s+1, '@')) != NULL) > *eos = 0; /* mark end of string to enable searching backwards */ >- RETVAL = atoi(s+1); >+ RETVAL = atoll(s+1); > if (eos != NULL) *eos = '@'; > } else > RETVAL = 0; > } else if (pkg->h) >- RETVAL = get_int(pkg->h, RPMTAG_SIZE); >+ RETVAL = get_int2(pkg->h, RPMTAG_LONGSIZE, RPMTAG_SIZE); > else > RETVAL = 0; > OUTPUT:
(get_int2) try new 64bit tag else old 32bit tag thus enabling to report size of >4Gb packages (however insane this is) diff -up ./URPM.xs.tv ./URPM.xs --- ./URPM.xs.tv 2016-10-15 03:29:51.555548914 +0200 +++ ./URPM.xs 2016-10-15 03:32:31.973240843 +0200 @@ -210,4 +210,13 @@ } +static uint64_t +get_int2(const Header header, rpmTag newtag, rpmTag oldtag) { + struct rpmtd_s val; + + if (!headerGet(header, newtag, &val, HEADERGET_DEFAULT)) + headerGet(header, oldtag, &val, HEADERGET_DEFAULT); + return rpmtdGetNumber(&val); +} + static size_t get_filesize(const Header h) { @@ -757,7 +766,7 @@ const char *nvr = headerGetAsString(pkg->h, RPMTAG_NVR); const char *arch = get_arch(pkg->h); p += 1 + snprintf(buff, sizeof(buff), "%s.%s@%llu@%llu@%s", nvr, arch, - get_int(pkg->h, RPMTAG_EPOCH), get_int(pkg->h, RPMTAG_SIZE), + get_int(pkg->h, RPMTAG_EPOCH), get_int2(pkg->h, RPMTAG_LONGSIZE, RPMTAG_SIZE), get_name(pkg->h, RPMTAG_GROUP)); pkg->info = memcpy(malloc(p-buff), buff, p-buff); } @@ -1754,7 +1763,7 @@ OUTPUT: RETVAL -int +long Pkg_size(pkg) URPM::Package pkg CODE: @@ -1764,12 +1773,12 @@ if ((s = strchr(pkg->info, '@')) != NULL && (s = strchr(s+1, '@')) != NULL) { if ((eos = strchr(s+1, '@')) != NULL) *eos = 0; /* mark end of string to enable searching backwards */ - RETVAL = atoi(s+1); + RETVAL = atoll(s+1); if (eos != NULL) *eos = '@'; } else RETVAL = 0; } else if (pkg->h) - RETVAL = get_int(pkg->h, RPMTAG_SIZE); + RETVAL = get_int2(pkg->h, RPMTAG_LONGSIZE, RPMTAG_SIZE); else RETVAL = 0; OUTPUT:
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 19571
:
8522
|
8523
|
8525
|
8528
|
8529
|
8530
|
8531
|
8537
|
8538
|
8539
|
8541
|
8542
|
8543
|
8547
|
8548
|
8549
|
8563
|
8564
|
8565
|
8566