Skip to content

Commit

Permalink
Parse packages sizes >=1GB
Browse files Browse the repository at this point in the history
Some packages have now become too big. The kernel-source package is
1.1GB installed. When installed with pkgtools, its size is now stated as
"1.1G" in the UNCOMPRESSED SIZE field in the respective
/var/lib/pkgtools/packages file.

There's also another issue that this change doesn't handle. In some
languages the decimal point is a "," instead of a "." and that's what
the numfmt tool, which is used by pkgtools, uses. So the size is stated
as "1,1G" instead. The C sscanf function we're using here doesn't parse
that correctly, leaving the decimal part out. So a package of size
"1,9G" would end up showing as 1024M. Same issue with packages of size
>1MB and <10MB, they would show up as "1,1M" for example. This doesn't
create any actual problems with installing/removing/upgrading packages
through. The discrepancy is only showed when running spkg --list. I'll
leave it like this for now.
  • Loading branch information
gapan committed Jan 21, 2022
1 parent c71d555 commit 3a660ee
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/pkgdb.c
Original file line number Diff line number Diff line change
Expand Up @@ -651,6 +651,8 @@ static gint _parse_size(const char* str, guint* size)
*size = (guint)v;
else if (strchr(str, 'M'))
*size = (guint)(v * 1024);
else if (strchr(str, 'G'))
*size = (guint)(v * 1024 * 1024);
else
return 0;

Expand Down

0 comments on commit 3a660ee

Please sign in to comment.