Re: [Rpm-maint] [rpm-software-management/rpm] build: error: line 73: unclosed macro or bad line continuation (broken spectool) (#175)

2017-03-13 Thread Gleb Fotengauer-Malinovskiy
Looks like `spectool` doesn't add a newline in the end of file.
Current fgetc approach expects '\n' in the end of every line.

I propose to switch to `getline(3)`.

-- 
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/issues/175#issuecomment-286158741___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


[Rpm-maint] [PATCH] parseSpec: use getline instead of fgetc

2017-03-13 Thread Gleb Fotengauer-Malinovskiy
Replace home-grown buggy imitation of getline(3) with use of getline(3).

Fixes: 92a8babf1b46 ("Remove hopefully the last static buffer in rpm spec 
reading")
Closes: https://github.com/rpm-software-management/rpm/issues/175
Signed-off-by: Gleb Fotengauer-Malinovskiy 
---
 build/parseSpec.c | 19 ++-
 1 file changed, 2 insertions(+), 17 deletions(-)

diff --git a/build/parseSpec.c b/build/parseSpec.c
index 20c4555..2928e85 100644
--- a/build/parseSpec.c
+++ b/build/parseSpec.c
@@ -32,7 +32,7 @@ typedef struct OpenFileInfo {
 FILE *fp;
 int lineNum;
 char *readBuf;
-int readBufLen;
+size_t readBufLen;
 const char * readPtr;
 struct OpenFileInfo * next;
 } OFI_t;
@@ -323,22 +323,7 @@ retry:
 
 /* Make sure we have something in the read buffer */
 if (!(ofi->readPtr && *(ofi->readPtr))) {
-   int c;
-   int i = 0;
-
-   while ((c = fgetc(ofi->fp)) != EOF) {
-   if (i >= ofi->readBufLen - 1) {
-   ofi->readBufLen += BUFSIZ;
-   ofi->readBuf = xrealloc(ofi->readBuf, ofi->readBufLen);
-   }
-   ofi->readBuf[i++] = c;
-   if (c == '\n') {
-   ofi->readBuf[i] = '\0';
-   break;
-   }
-   }
-
-   if (!i) {
+   if (getline(>readBuf, >readBufLen, ofi->fp) <= 0) {
/* EOF, remove this file from the stack */
ofi = popOFI(spec);
 

-- 
glebfm
___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


[Rpm-maint] [rpm-software-management/rpm] Add macros to generate --enable-/disable- arguments (#176)

2017-03-13 Thread steelman
Signed-off-by: Ɓukasz Stelmach 
You can view, comment on, or merge this pull request online at:

  https://github.com/rpm-software-management/rpm/pull/176

-- Commit Summary --

  * Add macros to generate --enable-/disable- arguments

-- File Changes --

M macros.in (3)

-- Patch Links --

https://github.com/rpm-software-management/rpm/pull/176.patch
https://github.com/rpm-software-management/rpm/pull/176.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/176
___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint