update to 1.18

This commit is contained in:
yixiangzhike 2020-07-25 17:32:52 +08:00
parent 9406598294
commit d0c5f2f470
12 changed files with 43 additions and 253 deletions

View File

@ -1,39 +0,0 @@
From 14fbe53b773ef0baed3f3e13fa02c246a98e29b2 Mon Sep 17 00:00:00 2001
From: openEuler Buildteam <buildteam@openeuler.org>
Date: Tue, 31 Dec 2019 22:27:16 +0800
Subject: [PATCH] change pkgconfigdir from lib to lib64
---
Makefile.am | 2 +-
Makefile.in | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/Makefile.am b/Makefile.am
index d7aec9e..50ad731 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -47,7 +47,7 @@ usrlib_LTLIBRARIES = libpopt.la
libpopt_la_SOURCES = popt.c poptparse.c poptconfig.c popthelp.c poptint.c
libpopt_la_LDFLAGS = -no-undefined @LTLIBINTL@ @LTLIBICONV@
-pkgconfigdir = $(prefix)/lib/pkgconfig
+pkgconfigdir = $(prefix)/lib64/pkgconfig
pkgconfig_DATA = popt.pc
if HAVE_LD_VERSION_SCRIPT
diff --git a/Makefile.in b/Makefile.in
index 2e6890d..2620636 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -370,7 +370,7 @@ usrlib_LTLIBRARIES = libpopt.la
libpopt_la_SOURCES = popt.c poptparse.c poptconfig.c popthelp.c poptint.c
libpopt_la_LDFLAGS = -no-undefined @LTLIBINTL@ @LTLIBICONV@ \
$(am__append_1)
-pkgconfigdir = $(prefix)/lib/pkgconfig
+pkgconfigdir = $(prefix)/lib64/pkgconfig
pkgconfig_DATA = popt.pc
man_MANS = popt.3
BUILT_SOURCES = popt.pc # popt.lcd
--
1.8.3.1

View File

@ -5,13 +5,13 @@ Subject: [PATCH 141/157] fix coverity CID 1057440: Unused pointer value
(UNUSED_VALUE) (UNUSED_VALUE)
--- ---
popt.c | 2 +- src/popt.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-) 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/popt.c b/popt.c diff --git a/src/popt.c b/src/popt.c
index adb70b5..5dc6812 100644 index adb70b5..5dc6812 100644
--- a/popt.c --- a/src/popt.c
+++ b/popt.c +++ b/src/popt.c
@@ -1692,7 +1692,7 @@ assert(s); /* XXX can't happen */ @@ -1692,7 +1692,7 @@ assert(s); /* XXX can't happen */
if (opt->longName) { if (opt->longName) {
if (!F_ISSET(opt, ONEDASH)) if (!F_ISSET(opt, ONEDASH))

View File

@ -5,14 +5,14 @@ Subject: [PATCH 123/157] - fix: handle newly added asset(...) call like
elsewhere. elsewhere.
--- ---
poptconfig.c | 8 +++++++- src/poptconfig.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-) 1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/poptconfig.c b/poptconfig.c diff --git a/src/poptconfig.c b/src/poptconfig.c
index 0a9a50d..fad03c5 100644 index 9d97ccd..f780974 100644
--- a/poptconfig.c --- a/src/poptconfig.c
+++ b/poptconfig.c +++ b/src/poptconfig.c
@@ -74,6 +74,12 @@ glob_pattern_p (const char * pattern, int quote) @@ -52,6 +52,12 @@ glob_pattern_p (const char * pattern, int quote)
} }
#endif /* !defined(__GLIBC__) */ #endif /* !defined(__GLIBC__) */
@ -22,10 +22,10 @@ index 0a9a50d..fad03c5 100644
+#define assert(_x) +#define assert(_x)
+#endif +#endif
+ +
/*@unchecked@*/
static int poptGlobFlags = 0; static int poptGlobFlags = 0;
@@ -332,7 +338,7 @@ static int poptConfigLine(poptContext con, char * line) static int poptGlob_error(UNUSED(const char * epath),
@@ -286,7 +292,7 @@ static int poptConfigLine(poptContext con, char * line)
longName++; longName++;
else else
longName = fn; longName = fn;
@ -35,5 +35,5 @@ index 0a9a50d..fad03c5 100644
/* Single character basenames are treated as short options. */ /* Single character basenames are treated as short options. */
if (longName[1] != '\0') if (longName[1] != '\0')
-- --
2.19.1 1.8.3.1

View File

@ -5,13 +5,13 @@ Subject: [PATCH 051/157] - fix: obscure iconv mis-call error path could lead
to strdup(NULL) (coverity). to strdup(NULL) (coverity).
--- ---
poptint.c | 2 +- src/poptint.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-) 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/poptint.c b/poptint.c diff --git a/src/poptint.c b/src/poptint.c
index 5e09fa4..67f0051 100644 index 5e09fa4..67f0051 100644
--- a/poptint.c --- a/src/poptint.c
+++ b/poptint.c +++ b/src/poptint.c
@@ -145,7 +145,7 @@ assert(dstr); /* XXX can't happen */ @@ -145,7 +145,7 @@ assert(dstr); /* XXX can't happen */
} }
(void) iconv_close(cd); (void) iconv_close(cd);

View File

@ -5,14 +5,14 @@ Subject: [PATCH 135/157] - fix: permit reading aliases, remove left over "goto
exit" replacing by assert. exit" replacing by assert.
--- ---
poptconfig.c | 1 - src/poptconfig.c | 1 -
1 file changed, 1 deletion(-) 1 file changed, 1 deletion(-)
diff --git a/poptconfig.c b/poptconfig.c diff --git a/src/poptconfig.c b/src/poptconfig.c
index fad03c5..b8e1da6 100644 index f780974..73d44e5 100644
--- a/poptconfig.c --- a/src/poptconfig.c
+++ b/poptconfig.c +++ b/src/poptconfig.c
@@ -339,7 +339,6 @@ static int poptConfigLine(poptContext con, char * line) @@ -293,7 +293,6 @@ static int poptConfigLine(poptContext con, char * line)
else else
longName = fn; longName = fn;
assert(longName != NULL); /* XXX can't happen. */ assert(longName != NULL); /* XXX can't happen. */

View File

@ -1,71 +0,0 @@
Patch by Panu Matilainen <pmatilai@redhat.com> for popt <= 1.16 which kludges
poptBadOption() to return something semi-meaningful on exec alias fail:
- poptBadOption() is totally unaware of exec alias failures, and will return
either the first argument or last option, giving wonderfully misleading error
messages (#697435, #710267).
- Remember execvp() first argument on failure and return that from
poptBadOption() if present to give the user a reasonable clue what exactly
went wrong.
This patch was proposed to upstream: http://rpm5.org/community/popt-devel/0264.html
--- popt-1.16/popt.c 2010-01-19 01:39:10.000000000 +0100
+++ popt-1.16/popt.c.execfail 2013-11-24 15:50:06.000000000 +0100
@@ -192,6 +192,7 @@
con->flags = flags;
con->execs = NULL;
con->numExecs = 0;
+ con->execFail = NULL;
con->finalArgvAlloced = argc * 2;
con->finalArgv = calloc( (size_t)con->finalArgvAlloced, sizeof(*con->finalArgv) );
con->execAbsolute = 1;
@@ -236,6 +237,7 @@
con->nextLeftover = 0;
con->restLeftover = 0;
con->doExec = NULL;
+ con->execFail = _free(con->execFail);
if (con->finalArgv != NULL)
for (i = 0; i < con->finalArgvCount; i++) {
@@ -564,6 +566,7 @@
/*@-nullstate@*/
rc = execvp(argv[0], (char *const *)argv);
/*@=nullstate@*/
+ con->execFail = xstrdup(argv[0]);
exit:
if (argv) {
@@ -1697,11 +1700,19 @@
const char * poptBadOption(poptContext con, unsigned int flags)
{
struct optionStackEntry * os = NULL;
+ const char *badOpt = NULL;
- if (con != NULL)
- os = (flags & POPT_BADOPTION_NOALIAS) ? con->optionStack : con->os;
+ if (con != NULL) {
+ /* Stupid hack to return something semi-meaningful from exec failure */
+ if (con->execFail) {
+ badOpt = con->execFail;
+ } else {
+ os = (flags & POPT_BADOPTION_NOALIAS) ? con->optionStack : con->os;
+ badOpt = os->argv[os->next - 1];
+ }
+ }
- return (os != NULL && os->argv != NULL ? os->argv[os->next - 1] : NULL);
+ return badOpt;
}
const char * poptStrerror(const int error)
--- popt-1.16/poptint.h 2010-01-19 01:39:10.000000000 +0100
+++ popt-1.16/poptint.h.execfail 2013-11-24 15:50:38.000000000 +0100
@@ -132,6 +132,7 @@
/*@owned@*/ /*@null@*/
poptItem execs;
int numExecs;
+ char * execFail;
/*@only@*/ /*@null@*/
poptArgv finalArgv;
int finalArgvCount;

View File

@ -1,24 +0,0 @@
Backport of upstream http://rpm5.org/cvs/chngview?cn=19258
--- popt-1.16/poptconfig.c 2009-05-20 15:18:07.000000000 +0200
+++ popt-1.16/poptconfig.c.glob-error 2017-10-12 23:33:28.868435647 +0200
@@ -108,7 +108,7 @@
if (glob_pattern_p(pat, 0)) {
glob_t _g, *pglob = &_g;
- if (!glob(pat, poptGlobFlags, poptGlob_error, pglob)) {
+ if (!(rc = glob(pat, poptGlobFlags, poptGlob_error, pglob))) {
if (acp) {
*acp = (int) pglob->gl_pathc;
pglob->gl_pathc = 0;
@@ -122,6 +122,10 @@
/*@-nullstate@*/
globfree(pglob);
/*@=nullstate@*/
+ } else if (rc == GLOB_NOMATCH) {
+ *avp = NULL;
+ *acp = 0;
+ rc = 0;
} else
rc = POPT_ERROR_ERRNO;
} else

View File

@ -1,79 +0,0 @@
From 6fcb24d785a2c2d626bac6999aee6b3ab368be15 Mon Sep 17 00:00:00 2001
From: Peter Jones <pjones@redhat.com>
Date: Fri, 28 Jul 2017 16:11:40 -0400
Subject: [PATCH] Don't leak the last argument expanded by expandNextArg()
While using POPT_ARG_ARGV, I noticed this in valgrind's leak checker:
==1738== HEAP SUMMARY:
==1738== in use at exit: 8 bytes in 1 blocks
==1738== total heap usage: 94 allocs, 93 frees, 42,319 bytes allocated
==1738==
==1738== 8 bytes in 1 blocks are definitely lost in loss record 1 of 1
==1738== at 0x4C2EB6B: malloc (vg_replace_malloc.c:299)
==1738== by 0x4E3DF47: expandNextArg (popt.c:699)
==1738== by 0x4E3F681: poptGetNextOpt (popt.c:1501)
==1738== by 0x401F72: main (bingrep.c:433)
==1738==
==1738== LEAK SUMMARY:
==1738== definitely lost: 8 bytes in 1 blocks
==1738== indirectly lost: 0 bytes in 0 blocks
==1738== possibly lost: 0 bytes in 0 blocks
==1738== still reachable: 0 bytes in 0 blocks
==1738== suppressed: 0 bytes in 0 blocks
My command line argument is a 7-byte string, and on first glance, it
appears this is because both expandNextArg() and poptSaveString()
duplicate the string. The copy from poptSaveString() is the consuming
program's responsibility to free, but the intermediate pointer is popt's
responsibility.
Upon further examination, it appears popt normally does free this
string, but it only does it on the next entry to poptGetNextOpt(), and
on cleanOSE() in the case if we're not already at the bottom of
con->OptionStack.
This patch modifies poptResetContext() to ensure we'll always attempt to
free con->os->nextArg regardless of our position in the OptionStack, and
removes the duplicate free of con->os->argb in poptFreeContext(), as
it's called unconditionally by the poptResetContext() call on the
previous line.
This ensures that if poptGetNextOpt() isn't re-intered, poptFreeContext()
will free the memory that was allocated. Now valgrind tells me:
==31734== HEAP SUMMARY:
==31734== in use at exit: 0 bytes in 0 blocks
==31734== total heap usage: 94 allocs, 94 frees, 42,319 bytes allocated
==31734==
==31734== All heap blocks were freed -- no leaks are possible
Signed-off-by: Peter Jones <pjones@redhat.com>
---
popt.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/popt.c b/popt.c
index 1a53f40..72fbf5c 100644
--- a/popt.c
+++ b/popt.c
@@ -230,7 +230,7 @@ void poptResetContext(poptContext con)
con->os->argb = PBM_FREE(con->os->argb);
con->os->currAlias = NULL;
con->os->nextCharArg = NULL;
- con->os->nextArg = NULL;
+ con->os->nextArg = _free(con->os->nextArg);
con->os->next = 1; /* skip argv[0] */
con->numLeftovers = 0;
@@ -1617,7 +1617,6 @@ poptContext poptFreeContext(poptContext con)
{
if (con == NULL) return con;
poptResetContext(con);
- con->os->argb = _free(con->os->argb);
con->aliases = poptFreeItems(con->aliases, con->numAliases);
con->numAliases = 0;
--
2.13.3

Binary file not shown.

BIN
popt-1.18.tar.gz Normal file

Binary file not shown.

View File

@ -1,18 +1,15 @@
Name: popt Name: popt
Version: 1.16 Version: 1.18
Release: 17 Release: 1
Summary: C library for parsing command line parameters Summary: C library for parsing command line parameters
License: MIT License: MIT
URL: http://www.rpm5.org URL: https://github.com/rpm-software-management/popt/
Source0: http://www.rpm5.org/files/%{name}/%{name}-%{version}.tar.gz Source0: http://ftp.rpm.org/%{name}/releases/%{name}-1.x/%{name}-%{version}.tar.gz
Patch0: change-pkgconfigdir-from-lib-to-lib64.patch
Patch1: popt-1.16-execfail.patch Patch0: fix-obscure-iconv-mis-call-error-path-could-lead-to-.patch
Patch2: popt-1.16-nextarg-memleak.patch Patch1: fix-handle-newly-added-asset-.-call-like-elsewhere.patch
Patch3: popt-1.16-glob-error.patch Patch2: fix-permit-reading-aliases-remove-left-over-goto-exi.patch
Patch9000: fix-obscure-iconv-mis-call-error-path-could-lead-to-.patch Patch3: fix-coverity-CID-1057440-Unused-pointer-value-UNUSED.patch
Patch9001: fix-handle-newly-added-asset-.-call-like-elsewhere.patch
Patch9002: fix-permit-reading-aliases-remove-left-over-goto-exi.patch
Patch9003: fix-coverity-CID-1057440-Unused-pointer-value-UNUSED.patch
BuildRequires: gcc git gettext BuildRequires: gcc git gettext
@ -82,6 +79,12 @@ make check
%{_mandir}/man3/%{name}.3.gz %{_mandir}/man3/%{name}.3.gz
%changelog %changelog
* Sat Jul 25 2020 zhangxingliang <zhangxingliang3@huawei.com> - 1.18-1
- Type:update
- ID:NA
- SUG:NA
- DESC:update to 1.18
* Tue Dec 31 2019 openEuler Buildteam <buildteam@openeuler.org> - 1.16-17 * Tue Dec 31 2019 openEuler Buildteam <buildteam@openeuler.org> - 1.16-17
- Strenthen spec - Strenthen spec

View File

@ -1,4 +1,4 @@
version_control: github version_control: github
src_repo: rpm-software-namegement/popt src_repo: rpm-software-management/popt
tag_prefix: ^popt- tag_prefix: ^popt-
seperator: "_" seperator: "."