Package: popt / 1.16-12

Metadata

Package Version Patches format
popt 1.16-12 3.0 (quilt)

Patch series

view the series file
Patch File delta Description
318833 incorrect handling of leftovers with poptStuffArgs.patch | (download)

popt.c | 24 22 + 2 - 0 !
poptint.h | 1 1 + 0 - 0 !
2 files changed, 23 insertions(+), 2 deletions(-)

---
278402 manpage typos.patch | (download)

popt.3 | 7 4 + 3 - 0 !
1 file changed, 4 insertions(+), 3 deletions(-)

---
217602 remove useless alignment checks.patch | (download)

popt.c | 10 10 + 0 - 0 !
1 file changed, 10 insertions(+)

---
356669 add catalan translation.patch | (download)

configure | 2 1 + 1 - 0 !
po/ca.po | 116 116 + 0 - 0 !
2 files changed, 117 insertions(+), 1 deletion(-)

---
728596 secure getenv.patch | (download)

configure.ac | 2 1 + 1 - 0 !
system.h | 6 5 + 1 - 0 !
2 files changed, 6 insertions(+), 2 deletions(-)

 libpopt-dev: __secure_getenv() function renamed to secure_getenv()

Use secure_getenv if it is available.
Fall back to __secure_getenv if it is not.
In glibc 2.17, __secure_getenv was renamed to secure_getenv.
So check also for it.
Reference:
 http://sourceware.org/glibc/wiki/Tips_and_Tricks/secure_getenv
 http://marc.info/?t=134192618500001&r=1&w=2

757935 autoreconf remove am c prototypes.patch | (download)

Makefile.am | 2 1 + 1 - 0 !
configure.ac | 1 0 + 1 - 0 !
2 files changed, 1 insertion(+), 2 deletions(-)

---
autoreconf libtool.patch | (download)

configure.ac | 2 1 + 1 - 0 !
1 file changed, 1 insertion(+), 1 deletion(-)

---
autoreconf gettext.patch | (download)

configure.ac | 1 1 + 0 - 0 !
1 file changed, 1 insertion(+)

---
popt 1.16 pkgconfig.patch | (download)

Makefile.am | 2 1 + 1 - 0 !
Makefile.in | 2 1 + 1 - 0 !
2 files changed, 2 insertions(+), 2 deletions(-)

---
popt 1.16 execfail.patch | (download)

popt.c | 17 14 + 3 - 0 !
poptint.h | 1 1 + 0 - 0 !
2 files changed, 15 insertions(+), 3 deletions(-)

---
popt 1.16 man page.patch | (download)

popt.3 | 12 6 + 6 - 0 !
1 file changed, 6 insertions(+), 6 deletions(-)

---
popt 1.16 help.patch | (download)

popthelp.c | 39 26 + 13 - 0 !
1 file changed, 26 insertions(+), 13 deletions(-)

---
popt 1.16 nextarg memleak.patch | (download)

popt.c | 3 1 + 2 - 0 !
1 file changed, 1 insertion(+), 2 deletions(-)

 [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 1.16 glob error.patch | (download)

poptconfig.c | 6 5 + 1 - 0 !
1 file changed, 5 insertions(+), 1 deletion(-)

---
fix test1 lt.patch | (download)

testit.sh | 4 2 + 2 - 0 !
1 file changed, 2 insertions(+), 2 deletions(-)

---
fix test api checker.patch | (download)

auto/Makefile.am | 6 3 + 3 - 0 !
auto/popt.xml.in | 28 28 + 0 - 0 !
configure.ac | 2 1 + 1 - 0 !
3 files changed, 32 insertions(+), 4 deletions(-)

---