NetBSD Problem Report #39201
From www@NetBSD.org Thu Jul 24 09:48:14 2008
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
by narn.NetBSD.org (Postfix) with ESMTP id CC53963B907
for <gnats-bugs@gnats.netbsd.org>; Thu, 24 Jul 2008 09:48:13 +0000 (UTC)
Message-Id: <20080724094813.6438663B89E@narn.NetBSD.org>
Date: Thu, 24 Jul 2008 09:48:13 +0000 (UTC)
From: marcotte@panix.com
Reply-To: marcotte@panix.com
To: gnats-bugs@NetBSD.org
Subject: "who am i" problem when using ptyfs
X-Send-Pr-Version: www-1.0
>Number: 39201
>Category: bin
>Synopsis: "who am i" problem when using ptyfs
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: bin-bug-people
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Thu Jul 24 09:50:00 +0000 2008
>Closed-Date: Fri Nov 28 06:35:52 +0000 2008
>Last-Modified: Fri Nov 28 06:35:52 +0000 2008
>Originator: Brian Marcotte
>Release: 4.0, looks like -current as well
>Organization:
Panix
>Environment:
NetBSD panix5.panix.com 4.0 NetBSD 4.0 (PANIX-XEN3U-USER) #1: Tue Apr 1 23:24:49 EDT 2008 root@juggler.panix.com:/misc2/obj/misc2/devel/netbsd/4.0/src/sys/arch/i386/compile/PANIX-XEN3U-USER i386
>Description:
"who am i" does not work properly when using ptyfs. It does not find the users' ttyname in the utmp file, so prints only the current time rather than the time of login and remote host name.
$ who am i
marcotte 10 Jul 24 05:43
It should print:
marcotte pts/10 Jul 22 03:29 (166.84.167.10)
The code removes "/dev/pts/" from the ttyname, but "pts/" is in the utmp entries.
The patch below just removes "/dev/" if present.
>How-To-Repeat:
Compare the output of "who am i" with and without ptyfs.
>Fix:
diff -u who.c.orig who.c
--- who.c.orig 2006-09-28 11:24:31.000000000 -0400
+++ who.c 2008-07-24 05:35:51.000000000 -0400
@@ -212,16 +212,15 @@
{
struct passwd *pw;
const char *p;
- char *t;
time_t now;
struct utmpentry *ehead, *ep;
/* search through the utmp and find an entry for this tty */
if ((p = ttyname(STDIN_FILENO)) != NULL) {
- /* strip any directory component */
- if ((t = strrchr(p, '/')) != NULL)
- p = t + 1;
+ /* Remove "/dev/" if present */
+ if (strncmp("/dev/",p,5)==0)
+ p += 5;
(void)getutentries(fname, &ehead);
for (ep = ehead; ep; ep = ep->next)
>Release-Note:
>Audit-Trail:
From: Christos Zoulas <christos@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/39201 CVS commit: src/usr.bin/who
Date: Thu, 24 Jul 2008 15:35:41 +0000 (UTC)
Module Name: src
Committed By: christos
Date: Thu Jul 24 15:35:41 UTC 2008
Modified Files:
src/usr.bin/who: who.c
Log Message:
PR/39201: Brian Marcotte: "who am i" problem when using ptyfs, because it
strips pts/
To generate a diff of this commit:
cvs rdiff -r1.22 -r1.23 src/usr.bin/who/who.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
State-Changed-From-To: open->pending-pullups
State-Changed-By: dholland@NetBSD.org
State-Changed-When: Fri, 28 Nov 2008 06:18:23 +0000
State-Changed-Why:
pullup-4 #1242 filed.
From: Soren Jacobsen <snj@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/39201 CVS commit: [netbsd-4] src/usr.bin/who
Date: Fri, 28 Nov 2008 06:30:55 +0000 (UTC)
Module Name: src
Committed By: snj
Date: Fri Nov 28 06:30:55 UTC 2008
Modified Files:
src/usr.bin/who [netbsd-4]: who.c
Log Message:
Pull up following revision(s) (requested by dholland in ticket #1242):
usr.bin/who/who.c: revision 1.23
PR/39201: Brian Marcotte: "who am i" problem when using ptyfs, because it
strips pts/
To generate a diff of this commit:
cvs rdiff -r1.20 -r1.20.2.1 src/usr.bin/who/who.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: dholland@NetBSD.org
State-Changed-When: Fri, 28 Nov 2008 06:35:52 +0000
State-Changed-Why:
Fixed, thanks for the report.
>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-2007
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.