Bug 247529

Summary: devel/popt: Update to 1.18 and add test target
Product: Ports & Packages Reporter: Daniel Engberg <diizzy>
Component: Individual Port(s)Assignee: Josh Paetzel <jpaetzel>
Status: Closed FIXED    
Severity: Affects Only Me CC: vvd
Priority: --- Keywords: needs-patch, needs-qa
Version: LatestFlags: bugzilla: maintainer-feedback? (jpaetzel)
Hardware: Any   
OS: Any   
Bug Depends on:    
Bug Blocks: 245475    
Attachments:
Description Flags
Patch for popt
none
Additional patch for popt 1.18
none
Additional patch for popt 1.18 v2 none

Description Daniel Engberg freebsd_committer freebsd_triage 2020-06-24 22:59:52 UTC
Created attachment 215918 [details]
Patch for popt

Update popt to 1.18
Update MASTER_SITES
Add path to license file
Move USES variable to make portlint happy
Add test target (make test)
Remove unnecessary CPPFLAGS and LIBS variables
Remove unnecessary patches and disable tests #58-#59

As far as I can tell 58 and 59 doesn't seem to test anything crucial.

FreeBSD 13.0-CURRENT r361421 amd64 (make test (w NLS))
FreeBSD 13.0-CURRENT r361660 aarch64 (make test (w NLS))
Poudriere testport OK 12.1-RELEASE (amd64)
Comment 1 commit-hook freebsd_committer freebsd_triage 2020-06-29 23:24:07 UTC
A commit references this bug:

Author: jpaetzel
Date: Mon Jun 29 23:24:04 UTC 2020
New revision: 540843
URL: https://svnweb.freebsd.org/changeset/ports/540843

Log:
  Update popt to 1.18

  https://lwn.net/Articles/824267/

  TL;DR popt upstream has been rebooted
  1.18 is essentially a no-op update that will
    allow developiment to be restarted.

  PR:	247529
  Submitted by:	daniel.engberg.lists@pyret.net

Changes:
  head/devel/popt/Makefile
  head/devel/popt/distinfo
  head/devel/popt/files/patch-Makefile.in
  head/devel/popt/files/patch-popt.c
  head/devel/popt/files/patch-tests_testit.sh
  head/devel/popt/pkg-plist
Comment 2 Tobias Kortkamp freebsd_committer freebsd_triage 2020-07-03 18:25:50 UTC
Reopen. This broke runtime of a couple of ports.

multimedia/nordlicht build is broken by this:
http://package19.nyi.freebsd.org/data/121amd64-default-build-as-user/540919/logs/nordlicht-0.4.5_5.log

I checked some ports and they are broken at runtime too:

audio/flac123:
$ flac123 --help
 flac123 [OPTIONS] FILES...
Segmentation fault (core dumped)

net/echoping:
$ echoping --help
Segmentation fault (core dumped)

$ gdb echoping echoping.core
(gdb) bt
#0  __vfprintf (fp=<optimized out>, locale=0x800811378 <__xlocale_global_locale>,
    fmt0=<optimized out>, ap=<optimized out>) at /usr/src/lib/libc/stdio/vfprintf.c:489
#1  0x000000080079d885 in vasprintf_l (str=0x7ffffffdcdf8,
    locale=0x800811378 <__xlocale_global_locale>,
    fmt=0x2846cd <error: Cannot access memory at address 0x2846cd>, ap=0x7ffffffdce00)
    at /usr/src/lib/libc/stdio/vasprintf.c:61
#2  0x000000080029205f in POPT_fprintf (stream=0x8008128b0,
    format=0x2846cd <error: Cannot access memory at address 0x2846cd>) at poptint.c:146
#3  0x000000080028eb74 in showHelpIntro (con=0x800e19000, fp=0x8008128b0) at popthelp.c:616
#4  0x000000080028f38f in poptPrintUsage (con=0x800e19000, fp=0x8008128b0, flags=0)
    at popthelp.c:863
#5  0x0000000000208b22 in usage ()
#6  0x0000000000206feb in main ()
Comment 3 Vladimir Druzenko freebsd_committer freebsd_triage 2020-07-05 03:50:17 UTC
(In reply to Tobias Kortkamp from comment #2)
> Reopen. This broke runtime of a couple of ports.
smbclient too: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=245475#c8
Comment 4 Vladimir Druzenko freebsd_committer freebsd_triage 2020-07-05 04:35:54 UTC
(In reply to VVD from comment #3)

I did experiment:

1. Get old version of port with popt 1.16.
2. make patch
3. Copied files popt.h lookup3.c poptconfig.c popthelp.c poptint.c poptint.h poptparse.c system.h from 1.18 to build dir of 1.16.
4. Added to popt.c 3 includes just after #include <math.h>:
#include <unistd.h>
#include <limits.h>
#include <errno.h>
5. make install
6. smbclient run without coredumps now

7. pkg delete -yf popt && make clean && make patch
8. Copied all files from #3 + popt.c
9. make install
10. smbclient coredumps now

Bug is in popt.c.
Comment 5 Daniel Engberg freebsd_committer freebsd_triage 2020-07-05 10:20:09 UTC
Created attachment 216212 [details]
Additional patch for popt 1.18

Fix incorrect handling of leftovers with poptStuffArgs

Source:
https://salsa.debian.org/debian/popt/-/blob/debian/sid/debian/patches/318833-incorrect-handling-of-leftovers-with-poptStuffArgs.patch
Comment 6 Daniel Engberg freebsd_committer freebsd_triage 2020-07-05 10:22:11 UTC
This seems to fix all reported issues, please test.
Comment 7 Vladimir Druzenko freebsd_committer freebsd_triage 2020-07-05 12:50:11 UTC
(In reply to daniel.engberg.lists from comment #5)

Didn't fixed smbclient:

(gdb) run
Starting program: /usr/local/bin/smbclient 

Program received signal SIGSEGV, Segmentation fault.
0x0000000802fbc584 in ?? () from /lib/libc.so.7
(gdb) bt -full
#0  0x0000000802fbc584 in ?? () from /lib/libc.so.7
No symbol table info available.
#1  0x0000000802fc3be5 in vasprintf_l () from /lib/libc.so.7
No symbol table info available.
#2  0x000000080282d5df in POPT_fprintf (stream=0x80302fa20, 
    format=0x444a008 <error: Cannot access memory at address 0x444a008>) at poptint.c:146
        b = 0x0
        ob = 0x0
        rc = 8
        ap = {{gp_offset = 16, fp_offset = 48, overflow_arg_area = 0x7fffffffe420, reg_save_area = 0x7fffffffe310}}
#3  0x000000080282a0e4 in showHelpIntro (con=0x803dec000, fp=0x80302fa20) at popthelp.c:616
        len = 6
#4  0x000000080282a8ff in poptPrintUsage (con=0x803dec000, fp=0x80302fa20, flags=0) at popthelp.c:863
        columns = 0x803da6090
        done_buf = {nopts = 1, maxopts = 64, opts = 0x803de2200}
        done = 0x7fffffffe4b8
#5  0x0000000001035985 in main (argc=1, argv=0x7fffffffea58) at ../../source3/client/client.c:6664
Comment 8 Daniel Engberg freebsd_committer freebsd_triage 2020-07-05 16:42:42 UTC
Hmm, looks like it only fixes flac123 :/
Comment 9 Vladimir Druzenko freebsd_committer freebsd_triage 2020-07-05 17:29:52 UTC
This "patch" work for me for smbclient:
--- devel/popt/Makefile.orig
+++ devel/popt/Makefile
@@ -19,6 +19,7 @@
 OPTIONS_DEFINE=        NLS
 
 GNU_CONFIGURE= yes
+CPPFLAGS+=     -I${LOCALBASE}/include   
 INSTALL_TARGET=        install-strip
 USE_LDCONFIG=  yes
 
Diff from "bad" and "good" build log:
-checking libintl.h usability... no
-checking libintl.h presence... no
-checking for libintl.h... no
+checking libintl.h usability... yes
+checking libintl.h presence... yes
+checking for libintl.h... yes

Who can explain this???
Comment 10 Daniel Engberg freebsd_committer freebsd_triage 2020-07-05 18:39:35 UTC
Created attachment 216225 [details]
Additional patch for popt 1.18 v2

Fix incorrect handling of leftovers with poptStuffArgs

Source:
https://salsa.debian.org/debian/popt/-/blob/debian/sid/debian/patches/318833-incorrect-handling-of-leftovers-with-poptStuffArgs.patch

The configure script ignores if it cannot find gettext (libintl.h) if NLS is enabled leading to various issues with users, adding localbase fix the issue.

Thanks to VVD <vvd@unislabs.com> for debugging this issue!
Comment 11 Daniel Engberg freebsd_committer freebsd_triage 2020-07-05 19:00:49 UTC
Also, this should be backported (if accepted) to 2020Q3
Comment 12 Josh Paetzel freebsd_committer freebsd_triage 2020-07-06 14:18:22 UTC
Thanks for chasing this down.  I'll get it committed this morning and get the MFH started.  I see the quarterly branch was *just* cut.
Comment 13 commit-hook freebsd_committer freebsd_triage 2020-07-06 14:46:50 UTC
A commit references this bug:

Author: jpaetzel
Date: Mon Jul  6 14:46:27 UTC 2020
New revision: 541348
URL: https://svnweb.freebsd.org/changeset/ports/541348

Log:
  Fix some regressions in the 1.18 reboot of development.

  PR:	247529
  Submitted by:	vvd@unislabs.com daniel.engberg.lists@pyret.net
  Reported by:	tobik
  MFH:	2020Q3

Changes:
  head/devel/popt/Makefile
  head/devel/popt/files/patch-src_popt.c
  head/devel/popt/files/patch-src_poptint.h
Comment 14 Josh Paetzel freebsd_committer freebsd_triage 2020-07-06 14:47:49 UTC
I'm going to hold this open until the MFH is done.
Comment 15 commit-hook freebsd_committer freebsd_triage 2020-07-09 14:01:49 UTC
A commit references this bug:

Author: jpaetzel
Date: Thu Jul  9 14:01:08 UTC 2020
New revision: 541751
URL: https://svnweb.freebsd.org/changeset/ports/541751

Log:
  MFH: r541348

  Fix some regressions in the 1.18 reboot of development.

  PR:	247529
  Submitted by:	vvd@unislabs.com daniel.engberg.lists@pyret.net
  Reported by:	tobik

  Approved by:	ports-secteam (joneum)

Changes:
_U  branches/2020Q3/
  branches/2020Q3/devel/popt/Makefile
  branches/2020Q3/devel/popt/files/patch-src_popt.c
  branches/2020Q3/devel/popt/files/patch-src_poptint.h
Comment 16 Josh Paetzel freebsd_committer freebsd_triage 2020-07-09 14:02:24 UTC
Thanks everyone for their work here!