Re: [Rpm-maint] [rpm-software-management/rpm] rpmio.c: In Fread(buf, size, nmemb, FD), require size be 1 (#400)
FWIW, you idiomatic code *never* worked with unmatched RPM4 sources including rpm-4.0 -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/rpm-software-management/rpm/pull/400#issuecomment-368150719___ Rpm-maint mailing list Rpm-maint@lists.rpm.org http://lists.rpm.org/mailman/listinfo/rpm-maint
Re: [Rpm-maint] [rpm-software-management/rpm] rpmio.c: In Fread(buf, size, nmemb, FD), require size be 1 (#400)
Yes, the "clone" of fread/write is imperfect and always returns the no. of bytes rather than nitems. The flaw certainly hasn't stopped Fread/Fwrite from being both used and useful everywhere in rpm this century. There's more needed than just your patch. FYI: RPM5 rpmio returns nitems just as the posix stdio routines do GeForce the last couple years. -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/rpm-software-management/rpm/pull/400#issuecomment-368149370___ Rpm-maint mailing list Rpm-maint@lists.rpm.org http://lists.rpm.org/mailman/listinfo/rpm-maint
[Rpm-maint] [rpm-software-management/rpm] rpmio.c: In Fread(buf, size, nmemb, FD), require size be 1 (#400)
It seems that Fread returns the number of bytes read, as opposed to the number of items, each size bytes long. The relevant comment in rpmio.h says that Fread is "fread(3) clone" (which implies that the number of items should be returned). This breaks the following idiomatic code which used to work with rpm-4.0: ```c char buf[110]; if (Fread(buf, 110, 1, cpio->fd) != 1) die("%s: cannot read cpio header", cpio->rpmbname); ``` The program dies with "cannot read cpio header", while in fact Fread returns 110. It seems that the only way to reconcile the number of bytes and the number of items is to require that size be 1. Indeed, I would much prefer an assertion failure. This change breaks the existing code which calls Fread with nmemb=1 and expects the number of bytes to be returned. You can view, comment on, or merge this pull request online at: https://github.com/rpm-software-management/rpm/pull/400 -- Commit Summary -- * rpmio.c: In Fread(buf,size,nmemb,FD), require size be 1 -- File Changes -- M rpmio/rpmio.c (9) -- Patch Links -- https://github.com/rpm-software-management/rpm/pull/400.patch https://github.com/rpm-software-management/rpm/pull/400.diff -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/rpm-software-management/rpm/pull/400 ___ Rpm-maint mailing list Rpm-maint@lists.rpm.org http://lists.rpm.org/mailman/listinfo/rpm-maint
Re: [Rpm-maint] [rpm-software-management/rpm] legacy.c: Fix headerGetEntry count (#399)
ignatenkobrain approved this pull request. -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/rpm-software-management/rpm/pull/399#pullrequestreview-99049498___ Rpm-maint mailing list Rpm-maint@lists.rpm.org http://lists.rpm.org/mailman/listinfo/rpm-maint
Re: [Rpm-maint] [rpm-software-management/rpm] legacy.c: Fix headerGetEntry count (#399)
The following code used to work with rpm-4.0. ```c static int getFileCount(Header h) { int count; int ret = headerGetEntry(h, RPMTAG_BASENAMES, NULL, NULL, ); return ret == 1 ? count : 0; } ``` -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/rpm-software-management/rpm/pull/399#issuecomment-368131793___ Rpm-maint mailing list Rpm-maint@lists.rpm.org http://lists.rpm.org/mailman/listinfo/rpm-maint
[Rpm-maint] [rpm-software-management/rpm] legacy.c: Fix headerGetEntry count (#399)
rpmtdFreeData resets td.count to 0, so the whole thing never worked. Better late than never, they say. You can view, comment on, or merge this pull request online at: https://github.com/rpm-software-management/rpm/pull/399 -- Commit Summary -- * legacy.c: Fix headerGetEntry count -- File Changes -- M lib/legacy.c (6) -- Patch Links -- https://github.com/rpm-software-management/rpm/pull/399.patch https://github.com/rpm-software-management/rpm/pull/399.diff -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/rpm-software-management/rpm/pull/399 ___ Rpm-maint mailing list Rpm-maint@lists.rpm.org http://lists.rpm.org/mailman/listinfo/rpm-maint