NetBSD Problem Report #51878

From www@NetBSD.org  Sun Jan 15 05:35:46 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 "Postmaster NetBSD.org" (verified OK))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 442137A2A1
	for <gnats-bugs@gnats.NetBSD.org>; Sun, 15 Jan 2017 05:35:46 +0000 (UTC)
Message-Id: <20170115053545.54DEF7A2A9@mollari.NetBSD.org>
Date: Sun, 15 Jan 2017 05:35:45 +0000 (UTC)
From: cfkoch@edgebsd.org
Reply-To: cfkoch@edgebsd.org
To: gnats-bugs@NetBSD.org
Subject: db(1) 'quiet' mode does not exit according to documented behavior
X-Send-Pr-Version: www-1.0

>Number:         51878
>Category:       bin
>Synopsis:       db(1) 'quiet' mode does not exit according to documented behavior
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    charlotte
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Jan 15 05:40:00 +0000 2017
>Closed-Date:    Tue Aug 09 21:28:00 +0000 2022
>Last-Modified:  Tue Aug 09 21:28:00 +0000 2022
>Originator:     Charlotte Koch
>Release:        amd64 CURRENT
>Organization:
>Environment:
NetBSD sakuracity 7.99.52 NetBSD 7.99.52 (CHARLOTTE) #0: Fri Dec 23 12:03:14 PST 2016  charlotte@sakuracity:/home/charlotte/devel/netbsd/sys/arch/amd64/compile/obj/CHARLOTTE amd64
>Description:
The man page for db(1) indicates that if you pass the '-q' flag then reading a nonexistent key from a hash(3) database does not result in an error. It is true that error messages are suppressed but the exit status of the command is still nonzero, which I do not believe is the intended behavior.
>How-To-Repeat:
It's as easy as

"db hash blah.db foo bar; db -q hash blah.db quux; echo $?"
>Fix:
A proposed patch is available at https://edgebsd.org/~cfkoch/patches/20170114-db-quiet.diff.txt

FWIW a whole slew of ATF tests for db(1) are on their way, too

>Release-Note:

>Audit-Trail:
From: christos@zoulas.com (Christos Zoulas)
To: gnats-bugs@NetBSD.org, gnats-admin@netbsd.org, netbsd-bugs@netbsd.org
Cc: 
Subject: Re: bin/51878: db(1) 'quiet' mode does not exit according to documented behavior
Date: Sun, 15 Jan 2017 10:51:07 -0500

 On Jan 15,  5:40am, cfkoch@edgebsd.org (cfkoch@edgebsd.org) wrote:
 -- Subject: bin/51878: db(1) 'quiet' mode does not exit according to document

 | >Number:         51878
 | >Category:       bin
 | >Synopsis:       db(1) 'quiet' mode does not exit according to documented behavior
 | >Confidential:   no
 | >Severity:       non-critical
 | >Priority:       medium
 | >Responsible:    bin-bug-people
 | >State:          open
 | >Class:          sw-bug
 | >Submitter-Id:   net
 | >Arrival-Date:   Sun Jan 15 05:40:00 +0000 2017
 | >Originator:     Charlotte Koch
 | >Release:        amd64 CURRENT
 | >Organization:
 | >Environment:
 | NetBSD sakuracity 7.99.52 NetBSD 7.99.52 (CHARLOTTE) #0: Fri Dec 23 12:03:14 PST 2016  charlotte@sakuracity:/home/charlotte/devel/netbsd/sys/arch/amd64/compile/obj/CHARLOTTE amd64
 | >Description:
 | The man page for db(1) indicates that if you pass the '-q' flag then reading a nonexistent key from a hash(3) database does not result in an error. It is true that error messages are suppressed but the exit status of the command is still nonzero, which I do not believe is the intended behavior.
 | >How-To-Repeat:
 | It's as easy as
 | 
 | "db hash blah.db foo bar; db -q hash blah.db quux; echo $?"
 | >Fix:
 | A proposed patch is available at https://edgebsd.org/~cfkoch/patches/20170114-db-quiet.diff.txt
 | 
 | FWIW a whole slew of ATF tests for db(1) are on their way, too

 Thanks. I think it is best to create a new flag for "no error if not found"
 rather than overloading -q. Either way we should document the behavior.

 christos

From: matthew green <mrg@eterna.com.au>
To: gnats-bugs@NetBSD.org
Cc: gnats-admin@netbsd.org, netbsd-bugs@netbsd.org
Subject: re: bin/51878: db(1) 'quiet' mode does not exit according to documented behavior
Date: Mon, 16 Jan 2017 07:47:10 +1100

 i would rather that quite mode *did* return an error in this case,
 as it is the only way to know it didn't work.

 can we fix the doc to match the existing code rather than change
 the behaviour of an old tool instead?


 .mrg.

From: Robert Elz <kre@munnari.OZ.AU>
To: matthew green <mrg@eterna.com.au>
Cc: gnats-bugs@NetBSD.org, gnats-admin@netbsd.org, netbsd-bugs@netbsd.org
Subject: Re: bin/51878: db(1) 'quiet' mode does not exit according to documented behavior
Date: Mon, 16 Jan 2017 04:22:52 +0700

     Date:        Mon, 16 Jan 2017 07:47:10 +1100
     From:        matthew green <mrg@eterna.com.au>
     Message-ID:  <7046.1484513230@splode.eterna.com.au>

   | i would rather that quite mode *did* return an error in this case,
   | as it is the only way to know it didn't work.

 I agree.   It is easy to ignore the error code if you don't care,
 but otherwise impossible to use the utility as a quiet predicate.

 kre

From: "Charlotte Koch" <charlotte@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/51878 CVS commit: src/usr.bin/db
Date: Tue, 9 Aug 2022 07:56:19 +0000

 Module Name:	src
 Committed By:	charlotte
 Date:		Tue Aug  9 07:56:19 UTC 2022

 Modified Files:
 	src/usr.bin/db: db.1

 Log Message:
 PR bin/51878: db(1)'s man page to describe the actual behavior of '-q'


 To generate a diff of this commit:
 cvs rdiff -u -r1.27 -r1.28 src/usr.bin/db/db.1

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

Responsible-Changed-From-To: bin-bug-people->charlotte
Responsible-Changed-By: charlotte@NetBSD.org
Responsible-Changed-When: Tue, 09 Aug 2022 21:26:26 +0000
Responsible-Changed-Why:
I was the original submitter, but now I am able to 
fix this myself.


State-Changed-From-To: open->closed
State-Changed-By: charlotte@NetBSD.org
State-Changed-When: Tue, 09 Aug 2022 21:28:00 +0000
State-Changed-Why:
I changed the man page to reflect the actual behavior of `db -q`.


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.46 2020/01/03 16:35:01 leot Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2020 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.