X-Loop: help-debbugs@HIDDEN Subject: bug#33181: sed --debug: fix two problems Resent-From: Jim Meyering <jim@HIDDEN> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> Resent-CC: bug-sed@HIDDEN Resent-Date: Sat, 27 Oct 2018 23:01:01 +0000 Resent-Message-ID: <handler.33181.B.154068126122599 <at> debbugs.gnu.org> Resent-Sender: help-debbugs@HIDDEN X-GNU-PR-Message: report 33181 X-GNU-PR-Package: sed X-GNU-PR-Keywords: To: 33181 <at> debbugs.gnu.org X-Debbugs-Original-To: bug-sed@HIDDEN Received: via spool by submit <at> debbugs.gnu.org id=B.154068126122599 (code B ref -1); Sat, 27 Oct 2018 23:01:01 +0000 Received: (at submit) by debbugs.gnu.org; 27 Oct 2018 23:01:01 +0000 Received: from localhost ([127.0.0.1]:46047 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1gGXZk-0005sR-Qm for submit <at> debbugs.gnu.org; Sat, 27 Oct 2018 19:01:01 -0400 Received: from eggs.gnu.org ([208.118.235.92]:43011) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <meyering@HIDDEN>) id 1gGXZj-0005sE-In for submit <at> debbugs.gnu.org; Sat, 27 Oct 2018 19:01:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from <meyering@HIDDEN>) id 1gGXZd-0000AQ-HN for submit <at> debbugs.gnu.org; Sat, 27 Oct 2018 19:00:54 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=BAYES_40,FREEMAIL_FROM autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:54992) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from <meyering@HIDDEN>) id 1gGXZd-0000AK-Dz for submit <at> debbugs.gnu.org; Sat, 27 Oct 2018 19:00:53 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52619) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from <meyering@HIDDEN>) id 1gGXZc-0007Ev-JC for bug-sed@HIDDEN; Sat, 27 Oct 2018 19:00:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from <meyering@HIDDEN>) id 1gGXZa-00008i-P3 for bug-sed@HIDDEN; Sat, 27 Oct 2018 19:00:52 -0400 Received: from mail-pg1-x531.google.com ([2607:f8b0:4864:20::531]:33945) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from <meyering@HIDDEN>) id 1gGXZa-00008S-IB for bug-sed@HIDDEN; Sat, 27 Oct 2018 19:00:50 -0400 Received: by mail-pg1-x531.google.com with SMTP id k1-v6so720371pgq.1 for <bug-sed@HIDDEN>; Sat, 27 Oct 2018 16:00:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:subject:date:message-id:mime-version; bh=M8Ms7N0sj44rhAbWrVK90rVgVtqkCO2PFUbbAe1R+hE=; b=Pw1/RBoEqPbbZpM8+pzIjGuM6nTJvuRSz+dPOmgZ2u9u+HIFAqG2gSYZxvVGm8XDwy OfYE0aWIabHOZkxBvO/egI6Aiwscs5/iWXrX5TUFPz7T6HcLH0OFi2uQYU7keVjq7oxh B77wGr9+wlNeCOEJisTJokmVQb7zqnQi2NN0HIAOJksaRgV+MVtUX8dIJn/HQMIWD94K SIBfungHtyKMcex12eZGe+4eQaCl4U6JfhnYp6OG/8hT2OivvU/54FyUCT5YVKjp6+S+ WA/QwrmdiJdTKiDKcEJ2gTg3gfsooT3vNyABrfl0yda9+7vZ+Kv9o+wyuIm/Gu4i9D9T 7j+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:subject:date:message-id :mime-version; bh=M8Ms7N0sj44rhAbWrVK90rVgVtqkCO2PFUbbAe1R+hE=; b=Vc9kkA7mZTN/a16cZQShE+yWTKvg5Ir+JI3mDyzTYS43p4LAyijh/E+mJ4LH/To3HE S1FL5bXbR9/9TYFa7HHcENbloI3gzFaukn++bMgXlqlkR6tU/uKq5d9oBTac13kUge8e ayw8kfKAb9Az6cfMS//h4scq8YmHb6rXLrZjELpfC/ml/h0bBsQyTBbU/WtH48WhW8jY RrTmZBoG1i5JIeeQFYIYBMITR4jMS+4VQlFaUuK/+V15x4h6m12+xXy0TtHr7ITWNqc2 VKwbGK1a6j1Qu1We9wTskMvN6edb+kns3ydNsrhzIZgmBZ265ExsLmJJG6u5u+6UPkc0 gbLA== X-Gm-Message-State: AGRZ1gINpJINzbptYEVebYI6OabDxTnKW05uQDWkqTxYPw8Cv1glGMKy QIPlqtrzcZCCEiJVPE7e6yK7V3pw X-Google-Smtp-Source: AJdET5emQK331jrJ3YLYNIXwvbDYbzu0PjjIviu8TYwOtZi5imo2QrfuB7CQbwPEvaoPI6TbIaT7MA== X-Received: by 2002:a62:b90f:: with SMTP id z15-v6mr5577701pfe.171.1540681248541; Sat, 27 Oct 2018 16:00:48 -0700 (PDT) Received: from meyering-mbp ([2620:10d:c090:180::1:90c9]) by smtp.gmail.com with ESMTPSA id p64-v6sm13688257pfi.22.2018.10.27.16.00.46 for <bug-sed@HIDDEN> (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 27 Oct 2018 16:00:47 -0700 (PDT) From: Jim Meyering <jim@HIDDEN> Date: Sat, 27 Oct 2018 16:00:40 -0700 Message-ID: <lubpf37ei3ro4n.fsf@HIDDEN> MIME-Version: 1.0 Content-Type: text/plain X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -3.5 (---) X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -4.5 (----) Hi Assaf, I built and ran tests on a Fedora 29 beta system and noticed a failure in the new debug test because I'd set MALLOC_PERTURB_=13 in my environment. That exposed what looked like a UMR bug. I confirmed it by running under valgrind. Fixed by the first patch below. Initially, I didn't even reach the offending code because that same system lacked perl's Data::Dump module. That is addressed by the second patch. Thanks, Jim >From 2bfa7984c84caaaedcfb26a13d8c190f490d7cd0 Mon Sep 17 00:00:00 2001 From: Jim Meyering <meyering@HIDDEN> Date: Sat, 27 Oct 2018 15:47:41 -0700 Subject: [PATCH 1/2] sed: avoid UMR in --debug code path * sed/debug.c (debug_print_function) [b, t, T]: For a b, t or T command with no LABEL, do not access uninitialized memory. I.e., print the label name only when there is one. --- sed/debug.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/sed/debug.c b/sed/debug.c index 4eedd40..9ec37b6 100644 --- a/sed/debug.c +++ b/sed/debug.c @@ -302,9 +302,12 @@ debug_print_function (const struct vector *program, const struct sed_cmd *sc) case 't': case 'T': { - const char *label_name = program->v[sc->x.jump_index].x.label_name; - if (label_name) - printf (" %s", label_name); + if (sc->x.jump_index < program->v_length) + { + const char *label_name = program->v[sc->x.jump_index].x.label_name; + if (label_name) + printf (" %s", label_name); + } } break; -- 2.18.0 >From 1c0866b1d34c18cfba2cfd20cc915e70fa975cbd Mon Sep 17 00:00:00 2001 From: Jim Meyering <meyering@HIDDEN> Date: Sat, 27 Oct 2018 15:53:03 -0700 Subject: [PATCH 2/2] tests: avoid unnecessary dependency on Data::Dump * testsuite/debug.pl: Don't use Data::Dump. Unnecessary. That package, perl-Data-Dump, appear not to be default-installed on at least a Fedora 29 beta system. --- testsuite/debug.pl | 1 - 1 file changed, 1 deletion(-) diff --git a/testsuite/debug.pl b/testsuite/debug.pl index 2e4235a..661c5ed 100644 --- a/testsuite/debug.pl +++ b/testsuite/debug.pl @@ -18,7 +18,6 @@ use strict; use File::stat; -use Data::Dump qw(dump); (my $program_name = $0) =~ s|.*/||; -- 2.18.0
Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) Content-Type: text/plain; charset=utf-8 X-Loop: help-debbugs@HIDDEN From: help-debbugs@HIDDEN (GNU bug Tracking System) To: Jim Meyering <jim@HIDDEN> Subject: bug#33181: Acknowledgement (sed --debug: fix two problems) Message-ID: <handler.33181.B.154068126122599.ack <at> debbugs.gnu.org> References: <lubpf37ei3ro4n.fsf@HIDDEN> X-Gnu-PR-Message: ack 33181 X-Gnu-PR-Package: sed Reply-To: 33181 <at> debbugs.gnu.org Date: Sat, 27 Oct 2018 23:01:02 +0000 Thank you for filing a new bug report with debbugs.gnu.org. This is an automatically generated reply to let you know your message has been received. Your message is being forwarded to the package maintainers and other interested parties for their attention; they will reply in due course. Your message has been sent to the package maintainer(s): bug-sed@HIDDEN If you wish to submit further information on this problem, please send it to 33181 <at> debbugs.gnu.org. Please do not send mail to help-debbugs@HIDDEN unless you wish to report a problem with the Bug-tracking system. --=20 33181: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D33181 GNU Bug Tracking System Contact help-debbugs@HIDDEN with problems
X-Loop: help-debbugs@HIDDEN Subject: bug#33181: sed --debug: fix two problems Resent-From: Assaf Gordon <assafgordon@HIDDEN> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> Resent-CC: bug-sed@HIDDEN Resent-Date: Sun, 28 Oct 2018 05:57:02 +0000 Resent-Message-ID: <handler.33181.B33181.154070620530690 <at> debbugs.gnu.org> Resent-Sender: help-debbugs@HIDDEN X-GNU-PR-Message: followup 33181 X-GNU-PR-Package: sed X-GNU-PR-Keywords: To: Jim Meyering <jim@HIDDEN>, 33181 <at> debbugs.gnu.org Received: via spool by 33181-submit <at> debbugs.gnu.org id=B33181.154070620530690 (code B ref 33181); Sun, 28 Oct 2018 05:57:02 +0000 Received: (at 33181) by debbugs.gnu.org; 28 Oct 2018 05:56:45 +0000 Received: from localhost ([127.0.0.1]:46163 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1gGe44-0007yw-Vm for submit <at> debbugs.gnu.org; Sun, 28 Oct 2018 01:56:45 -0400 Received: from mail-pg1-f170.google.com ([209.85.215.170]:32843) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <assafgordon@HIDDEN>) id 1gGe43-0007yj-Qg for 33181 <at> debbugs.gnu.org; Sun, 28 Oct 2018 01:56:44 -0400 Received: by mail-pg1-f170.google.com with SMTP id z2-v6so2374657pgp.0 for <33181 <at> debbugs.gnu.org>; Sat, 27 Oct 2018 22:56:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-language:content-transfer-encoding; bh=joaV7MYFi9QqKEbAnXu9EX2sWBJF7muvyOQqKzuOCH8=; b=TNPTIpmwfQzhIWNtdSzEUaLwHzuDpZzogJBijzY/iW4cDtNNADBtEZFcAIepBrnBy3 dZsGzeV5ln66jKQZ1kJVnFzx47gcrNqahDtV65TU4COmmpgXdvwq2yUBEUVz8K9bsx0E gXHNLVcG2gyFWkPRYjvYuUUyCryRThyI4vJUT0W3M0owIPV01DJBw+ayMN8hX2EPbcMF X00/lbxsq7xKUiYhD1PSyoj5odz5UAIao56veL76HfABK7yvLtWM5DkmV45E7sDT9a+W IN6kMLQTLqr3WSmi+08pb6EJaHLsS9tDbFioOMxrKQcj6/hH70M9/AOQ14cjQsiO546t Ie/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=joaV7MYFi9QqKEbAnXu9EX2sWBJF7muvyOQqKzuOCH8=; b=M7J1Lf0Wj+3ToCD6mOcP57+1+9+JuC3H/dy19jZ2ZEO5Am9EOY2D9UlI1Dyx4KN5X5 0IhypQPK6Ai5MCm/sIGMA3yx3tEy5j+4LHFuDcOhOZqHmNcAjrCnSbykCxNQDsFTXS5X 0MUNUz4mVsZSQO50aHWVIcNb8msisWs2Pb6j6ZxCjHtLw6cdybtP50k0LnvkDB33M8h0 wFQ0PRFpb+VXdhklEzHXItYknnF5GBll7LD7I83NTFJQMKykn70ba0x6ISQwwcrR7xMu /zInqFokp0DyMLhkZa4rRmclAe1Hc46hCENE/ouYJBJw1XQfpd1BLQBeA4TxGRD7Vssk Nd7A== X-Gm-Message-State: AGRZ1gIN+0Uk5I7/ZJmSH+eZrg1UKhIqAwSydHvCz17XmKv9aTulcoTJ zHgHF+6R5Jr51bHjYDxMM/qRkQwJ X-Google-Smtp-Source: AJdET5f4oM6PxZr58gqiUO0onUoLUysoHpq3/xiAfECz9GzrvkNSEQG39oQyNOo10rnQzgtYVlQd8Q== X-Received: by 2002:a63:f60c:: with SMTP id m12-v6mr9392936pgh.293.1540706197344; Sat, 27 Oct 2018 22:56:37 -0700 (PDT) Received: from tomato.housegordon.com (moose.housegordon.com. [184.68.105.38]) by smtp.googlemail.com with ESMTPSA id b139-v6sm15468472pfb.3.2018.10.27.22.56.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 27 Oct 2018 22:56:36 -0700 (PDT) References: <lubpf37ei3ro4n.fsf@HIDDEN> From: Assaf Gordon <assafgordon@HIDDEN> Message-ID: <e3cbe891-a2b9-5d1d-c3bc-0f1dad7ca6c0@HIDDEN> Date: Sat, 27 Oct 2018 23:56:34 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: <lubpf37ei3ro4n.fsf@HIDDEN> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) On 2018-10-27 5:00 p.m., Jim Meyering wrote: > That exposed what looked like a UMR bug. I confirmed it by > running under valgrind. Fixed by the first patch below. [...] > Initially, I didn't even reach the offending code because > that same system lacked perl's Data::Dump module. > That is addressed by the second patch. Good catch! I should have used the new "make build-asan" to test the new debug feature, I now see it does report similar failures. Thanks for the quick fix, looks good. -assaf
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997 nCipher Corporation Ltd,
1994-97 Ian Jackson.