NetBSD Problem Report #50125
From jarle@singsaker.uninett.no Wed Aug 5 07:53:02 2015
Return-Path: <jarle@singsaker.uninett.no>
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 070A3A5858
for <gnats-bugs@gnats.NetBSD.org>; Wed, 5 Aug 2015 07:53:02 +0000 (UTC)
Message-Id: <20150805074435.E08E984CE7@singsaker.uninett.no>
Date: Wed, 5 Aug 2015 09:44:35 +0200 (CEST)
From: jarle@uninett.no
Reply-To: jarle@uninett.no
To: gnats-bugs@NetBSD.org
Subject: Incorrect PID in /var/run/mountd.pid
X-Send-Pr-Version: 3.95
>Number: 50125
>Category: bin
>Synopsis: Incorrect PID in /var/run/mountd.pid
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: jnemeth
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Wed Aug 05 07:55:00 +0000 2015
>Closed-Date: Thu Aug 06 22:00:56 +0000 2015
>Last-Modified: Thu Aug 06 22:00:56 +0000 2015
>Originator: Jarle Greipsland
>Release: NetBSD 7.99.18
>Organization:
>Environment:
System: NetBSD singsaker.uninett.no 7.99.18 NetBSD 7.99.18 (SINGSAKER) #0: Thu Jun 4 14:37:01 CEST 2015 jarle@singsaker.uninett.no:/usr/obj/sys/arch/i386/compile/SINGSAKER i386
Architecture: i386
Machine: i386
>Description:
The PID recorded in /var/run/mountd.pid when mountd is started is not the
correct one. A bug seems to have been introduced (-r1.126) when the
if (debug == 0) {
daemon(0, 0);
(void)signal(SIGINT, SIG_IGN);
(void)signal(SIGQUIT, SIG_IGN);
}
statements were moved further down in the main() function, so as to appear
_after_ the call to the pidfile() function. Since the daemon() function uses
fork() in order to detach itself from its parent, the PID recorded in
/var/run/mountd.pid will be that of the mountd program prior to the fork.
And not the PID that the mountd program will use during normal operations.
>How-To-Repeat:
Start mountd. Try to do 'kill -HUP `cat /var/run/mountd.pid`'.
>Fix:
Move the call to pidfile() to someplace after the daemon() call.
>Release-Note:
>Audit-Trail:
From: "John Nemeth" <jnemeth@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/50125 CVS commit: src/usr.sbin/mountd
Date: Wed, 5 Aug 2015 23:23:47 +0000
Module Name: src
Committed By: jnemeth
Date: Wed Aug 5 23:23:47 UTC 2015
Modified Files:
src/usr.sbin/mountd: mountd.c
Log Message:
PR/50125 - Jarle Greipsland -- Incorrect PID in /var/run/mountd.pid
Move call to pidfile() after daemon() so that correct (child) pid is
written to pidfile.
To generate a diff of this commit:
cvs rdiff -u -r1.126 -r1.127 src/usr.sbin/mountd/mountd.c
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->jnemeth
Responsible-Changed-By: jnemeth@NetBSD.org
Responsible-Changed-When: Thu, 06 Aug 2015 00:48:24 +0000
Responsible-Changed-Why:
I fixed it. Waiting on pullup to -7.
State-Changed-From-To: open->pending-pullups
State-Changed-By: jnemeth@NetBSD.org
State-Changed-When: Thu, 06 Aug 2015 00:48:24 +0000
State-Changed-Why:
pullup-7 #936
From: "Soren Jacobsen" <snj@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/50125 CVS commit: [netbsd-7] src/usr.sbin/mountd
Date: Thu, 6 Aug 2015 21:59:04 +0000
Module Name: src
Committed By: snj
Date: Thu Aug 6 21:59:04 UTC 2015
Modified Files:
src/usr.sbin/mountd [netbsd-7]: mountd.c
Log Message:
Pull up following revision(s) (requested by jnemeth in ticket #936):
usr.sbin/mountd/mountd.c: revision 1.127
PR/50125 - Jarle Greipsland -- Incorrect PID in /var/run/mountd.pid
Move call to pidfile() after daemon() so that correct (child) pid is
written to pidfile.
To generate a diff of this commit:
cvs rdiff -u -r1.126 -r1.126.4.1 src/usr.sbin/mountd/mountd.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
State-Changed-From-To: pending-pullups->closed
State-Changed-By: snj@NetBSD.org
State-Changed-When: Thu, 06 Aug 2015 22:00:56 +0000
State-Changed-Why:
Pulled up.
>Unformatted:
(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.