NetBSD Problem Report #52460

From www@NetBSD.org  Thu Aug  3 04:00:58 2017
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (verified OK))
	by mollari.NetBSD.org (Postfix) with ESMTPS id D75B07A182
	for <gnats-bugs@gnats.NetBSD.org>; Thu,  3 Aug 2017 04:00:58 +0000 (UTC)
Message-Id: <20170803040057.D60AD7A1F5@mollari.NetBSD.org>
Date: Thu,  3 Aug 2017 04:00:57 +0000 (UTC)
From: nonakap@gmail.com
Reply-To: nonakap@gmail.com
To: gnats-bugs@NetBSD.org
Subject: devel/jq: strftime function causes core dump
X-Send-Pr-Version: www-1.0

>Number:         52460
>Category:       pkg
>Synopsis:       devel/jq: strftime function causes core dump
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    leot
>State:          feedback
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Aug 03 04:05:00 +0000 2017
>Closed-Date:    
>Last-Modified:  Sun Aug 19 18:20:01 +0000 2018
>Originator:     Kimihiro Nonaka
>Release:        HEAD (20170802)
>Organization:
>Environment:
NetBSD netbsd 7.1_STABLE NetBSD 7.1_STABLE (NBSERVER) #10: Wed Jul 26 09:55:06 JST 2017  nonaka@netbsd:/home/storage/snapshot/NetBSD/7-STABLE/obj.NetBSD-amd64/amd64/sys/arch/amd64/compile/NBSERVER amd64
>Description:
nonaka@netbsd$ echo 334 | jq 'strftime("%Y-%m-%dT%H:%M:%SZ")'
Memory fault (core dumped)
nonaka@netbsd$ gdb jq
GNU gdb (GDB) 7.7.1
Copyright (C) 2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64--netbsd".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from jq...(no debugging symbols found)...done.
(gdb) core jq.core
[New process 1]
Core was generated by `jq'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x00000000004054a1 in tm2jv ()
(gdb) bt
#0  0x00000000004054a1 in tm2jv ()
#1  0x00000000004056b7 in f_gmtime ()
#2  0x0000000000405cc1 in f_strftime ()
#3  0x0000000000404684 in jq_next ()
#4  0x00000000004026da in process ()
#5  0x0000000000426436 in main ()
(gdb)
>How-To-Repeat:
echo 334 | jq 'strftime("%Y-%m-%dT%H:%M:%SZ")'
>Fix:

>Release-Note:

>Audit-Trail:

Responsible-Changed-From-To: pkg-manager->jperkin
Responsible-Changed-By: bsiegert@NetBSD.org
Responsible-Changed-When: Thu, 03 Aug 2017 12:25:43 +0000
Responsible-Changed-Why:
Over to maintainer.


From: SODA Noriyuki <soda@NetBSD.org>
To: gnats-bugs@NetBSD.org, 
    pkg-manager@netbsd.org,
    gnats-admin@netbsd.org,
    pkgsrc-bugs@netbsd.org
Cc: nonakap@gmail.com
Subject: Re: pkg/52460: devel/jq: strftime function causes core dump
Date: Thu, 3 Aug 2017 21:31:09 +0900

 I believe this problem is addressed in the following pull request:
 https://github.com/stedolan/jq/pull/1458

Responsible-Changed-From-To: jperkin->pkg-manager
Responsible-Changed-By: jperkin@NetBSD.org
Responsible-Changed-When: Thu, 03 Aug 2017 12:39:32 +0000
Responsible-Changed-Why:
Not sure why I put myself as MAINTAINER as I don't use this package, reset.


From: Benny Siegert <bsiegert@gmail.com>
To: SODA Noriyuki <soda@NetBSD.org>
Cc: gnats-bugs@NetBSD.org,
 pkg-manager@netbsd.org,
 gnats-admin@netbsd.org,
 pkgsrc-bugs@netbsd.org,
 nonakap@gmail.com
Subject: Re: pkg/52460: devel/jq: strftime function causes core dump
Date: Thu, 3 Aug 2017 14:53:27 +0200

 > Am 03.08.2017 um 14:31 schrieb SODA Noriyuki <soda@NetBSD.org>:
 > 
 > I believe this problem is addressed in the following pull request:
 > https://github.com/stedolan/jq/pull/1458

 So is the plan to just wait for a new upstream release?

From: SODA Noriyuki <soda@NetBSD.org>
To: Benny Siegert <bsiegert@gmail.com>
Cc: SODA Noriyuki <soda@NetBSD.org>,
    gnats-bugs@NetBSD.org,
    pkg-manager@netbsd.org,
    gnats-admin@netbsd.org,
    pkgsrc-bugs@netbsd.org,
    nonakap@gmail.com
Subject: Re: pkg/52460: devel/jq: strftime function causes core dump
Date: Thu, 3 Aug 2017 22:13:17 +0900

 >  So is the plan to just wait for a new upstream release?

 Yes.
 Or, if it takes too much time, applying part of the patches may be
 an option, perhaps.

 the following patch should fix the segmentation fault, for example.
 https://github.com/stedolan/jq/pull/1458/commits/df9a0963f8fa6fca773b059dce22c598152f3edb

From: Leonardo Taccari <leot@NetBSD.org>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: pkg/52460: devel/jq: strftime function causes core dump
Date: Wed, 08 Aug 2018 11:17:46 +0200

 Hello SODA-san and all,

 SODA Noriyuki writes:
 > > Benny Siegert writes:
 > > So is the plan to just wait for a new upstream release?
 >  =

 > Yes.
 > Or, if it takes too much time, applying part of the patches may be
 > an option, perhaps.
 >
 > the following patch should fix the segmentation fault, for example.
 > https://github.com/stedolan/jq/pull/1458/commits/df9a0963f8fa6fca773b059=
 dce22c598152f3edb

 IIUC unfortunately upstream still has not applied this pull request
 or parts of them.

 I've ben hit by this bug for several times, but this time I would
 like to use date builtins in jq... ...so here you can find that
 part of the pull request applied to devel/jq with a candidate commit
 message:

  <https://www.NetBSD.org/~leot/pkgsrc-patches/jq-pkg-52460.patch>

 The possible controversial change is a pretty big patches/patch-configure
 that is unfortunately unavoidable due AC_USE_SYSTEM_EXTENSIONS,
 but IMHO it's better to have that than to depends to `autoconf'
 for devel/jq.


 If there are no feedbacks in a week or so I would like to commit
 it.


 Thank you again very much SODA, Takehiko and Kimihiro for investigating
 and fixing that!

From: Benny Siegert <bsiegert@gmail.com>
To: gnats-bugs@netbsd.org
Cc: pkg-manager@netbsd.org, gnats-admin@netbsd.org, pkgsrc-bugs@netbsd.org, 
	=?UTF-8?B?5Z+c5Lit5YWs5Y2a?= <nonakap@gmail.com>
Subject: Re: pkg/52460: devel/jq: strftime function causes core dump
Date: Sun, 12 Aug 2018 11:03:20 +0300

 >  The possible controversial change is a pretty big patches/patch-configure
 >  that is unfortunately unavoidable due AC_USE_SYSTEM_EXTENSIONS,
 >  but IMHO it's better to have that than to depends to `autoconf'
 >  for devel/jq.

 Up to you, but personally I prefer patching configure.ac, as that's
 far less likely to break on future package updates. autoconf is small
 enough to not matter.

 -- 
 Benny

Responsible-Changed-From-To: pkg-manager->leot
Responsible-Changed-By: leot@NetBSD.org
Responsible-Changed-When: Sun, 19 Aug 2018 18:13:01 +0000
Responsible-Changed-Why:
Take


State-Changed-From-To: open->feedback
State-Changed-By: leot@NetBSD.org
State-Changed-When: Sun, 19 Aug 2018 18:13:01 +0000
State-Changed-Why:
Patch committed and as suggested by Benny I have just added tool dependency
to auto{conf,make,reconf}.

The problem should be fixed but a feedback is welcomed and please
also let us know if you think it is worth to request a pullup for it.

Thank you very much again for investigating and fixing the problem
(and sorry for a year delay in adjusting the pkgsrc bits for it!)!


From: "Leonardo Taccari" <leot@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/52460 CVS commit: pkgsrc/devel/jq
Date: Sun, 19 Aug 2018 18:08:06 +0000

 Module Name:	pkgsrc
 Committed By:	leot
 Date:		Sun Aug 19 18:08:06 UTC 2018

 Modified Files:
 	pkgsrc/devel/jq: Makefile distinfo
 Added Files:
 	pkgsrc/devel/jq/patches: patch-builtin.c patch-compile.c
 	    patch-configure.ac patch-inject__errors.c patch-util.c

 Log Message:
 jq: Avoid SIGSEGVs when using date builtins

 Apply patch written by <soda> and shared with upstream as part of
 <https://github.com/stedolan/jq/pull/1458> in order to fix crashes of jq when
 using date builtin functions.

 Also add a SUBST class intended to avoid invoking git as part of pre-configure
 phase when invoking autoreconf.

 While here take the MAINTAINERship and reformat a bit the Makefile
 (NFCI).

 Thanks a lot to <soda>, Takehiko NOZAKI and <nonaka> for investigating
 the issue, writing the patches, sharing them with upstream and as
 part of PR pkg/52460!

 Bump PKGREVISION


 To generate a diff of this commit:
 cvs rdiff -u -r1.15 -r1.16 pkgsrc/devel/jq/Makefile
 cvs rdiff -u -r1.9 -r1.10 pkgsrc/devel/jq/distinfo
 cvs rdiff -u -r0 -r1.1 pkgsrc/devel/jq/patches/patch-builtin.c \
     pkgsrc/devel/jq/patches/patch-compile.c \
     pkgsrc/devel/jq/patches/patch-inject__errors.c \
     pkgsrc/devel/jq/patches/patch-util.c
 cvs rdiff -u -r0 -r1.3 pkgsrc/devel/jq/patches/patch-configure.ac

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.43 2018/01/16 07:36:43 maya Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2017 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.