NetBSD Problem Report #50337

From www@NetBSD.org  Tue Oct 13 17:09:06 2015
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [149.20.53.66])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "mail.netbsd.org", Issuer "Postmaster NetBSD.org" (verified OK))
	by mollari.NetBSD.org (Postfix) with ESMTPS id CA8D9A65E7
	for <gnats-bugs@gnats.NetBSD.org>; Tue, 13 Oct 2015 17:09:05 +0000 (UTC)
Message-Id: <20151013170904.7546EA65E8@mollari.NetBSD.org>
Date: Tue, 13 Oct 2015 17:09:04 +0000 (UTC)
From: chneukirchen@gmail.com
Reply-To: chneukirchen@gmail.com
To: gnats-bugs@NetBSD.org
Subject: pgrep: -d outputs delimiter as terminator
X-Send-Pr-Version: www-1.0

>Number:         50337
>Category:       bin
>Synopsis:       pgrep: -d outputs delimiter as terminator
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Oct 13 17:10:01 +0000 2015
>Originator:     Christian Neukirchen
>Release:        5.2.3 (also in 7.0)
>Organization:
>Environment:
NetBSD zhora 5.2.3 NetBSD 5.2.3 (XEN3_DOMU) #0: Sat Nov 15 21:06:05 UTC 2014  snj@b45.netbsd.org:/home/builds/ab/netbsd-5-2-3-RELEASE/amd64/201411152021Z-obj/home/source/ab/netbsd-5-2-3-RELEASE/src/sys/arch/amd64/compile/XEN3_DOMU amd64
>Description:
The -d flag of pgrep is supposed to "Specify a delimiter to be printed between each process ID."

Instead, the delimiter is also outputted after the final PID, where a newline should be printed instead.

Fixed in OpenBSD pkill.c,v 1.8 from 2005/02/11, ported patch below.
>How-To-Repeat:
% pgrep -d, t
932,931,930,929,928,927,926,925,% _

Contrast with Linux procps-ng 3.3.11, Solaris 5.11 or OpenBSD 5.7:

% pgrep -d, t
3191,902
% _
>Fix:
Patch ported from OpenBSD available at http://chneukirchen.org/patches/netbsd-7.0-pkill-delim.patch

Also see https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=203744 for the equivalent bug in FreeBSD.

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2014 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.