NetBSD Problem Report #10898

Received: (qmail 22374 invoked from network); 27 Aug 2000 03:28:37 -0000
Message-Id: <200008270328.e7R3San14420@quix>
Date: Sat, 26 Aug 2000 23:28:36 -0400 (EDT)
From: jchacon@genuity.net
Reply-To: jchacon@genuity.net
To: gnats-bugs@gnats.netbsd.org
Subject: Patch to arp to allow -f -
X-Send-Pr-Version: 3.95

>Number:         10898
>Category:       bin
>Synopsis:       arp allows -f file but not -f - which is useful
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    dholland
>State:          closed
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Sun Aug 27 03:29:01 +0000 2000
>Closed-Date:    Thu Jun 10 06:21:02 +0000 2010
>Last-Modified:  Thu Jun 10 06:21:02 +0000 2010
>Originator:     James Chacon
>Release:        1.5_ALPHA2
>Organization:
>Environment:
System: NetBSD quix 1.5_ALPHA NetBSD 1.5_ALPHA (QUIX) #0: Mon Jul 10 20:31:02 EDT 2000 root@quix:/usr/src/sys/arch/i386/compile/QUIX i386

(That's my current running system. I'm working from the current source tree
as of 08/25)
>Description:
arp allows -f filename which is handy if you have multiple things to do
(for instance in a start-up script). However filename must be a real file
which makes creating pipelines a pain (temp files and all that).
A simple fix is to check for -f - and use stdin.

>How-To-Repeat:
Try it:

root:23:19:16_quix:/usr/src/sys>arp -f - < /tmp/out
arp: cannot open -: No such file or directory

>Fix:
root:23:26:22_quix:/usr/src/usr.sbin/arp>cvs diff -r1.1.1.1 arp.c 
Index: arp.c
===================================================================
RCS file: /usr/local/cvs/src/usr.sbin/arp/arp.c,v
retrieving revision 1.1.1.1
diff -c -r1.1.1.1 arp.c
*** arp.c       2000/07/10 05:40:50     1.1.1.1
--- arp.c       2000/08/27 03:26:21
***************
*** 175,182 ****
        int i, retval;
        FILE *fp;

!       if ((fp = fopen(name, "r")) == NULL)
!               err(1, "cannot open %s", name);
        args[0] = &arg[0][0];
        args[1] = &arg[1][0];
        args[2] = &arg[2][0];
--- 175,186 ----
        int i, retval;
        FILE *fp;

!       if (!strcmp ("-", name)) {
!               fp = stdin;
!       } else { 
!               if ((fp = fopen(name, "r")) == NULL)
!                       err(1, "cannot open %s", name);
!       }
        args[0] = &arg[0][0];
        args[1] = &arg[1][0];
        args[2] = &arg[2][0];

>Release-Note:
>Audit-Trail:

From: Andrew Brown <atatat@atatdot.net>
To: jchacon@genuity.net
Cc: gnats-bugs@gnats.netbsd.org, netbsd-bugs@netbsd.org
Subject: Re: bin/10898: Patch to arp to allow -f -
Date: Sun, 27 Aug 2000 15:37:48 -0400

 >>Description:
 >arp allows -f filename which is handy if you have multiple things to do
 >(for instance in a start-up script). However filename must be a real file
 >which makes creating pipelines a pain (temp files and all that).
 >A simple fix is to check for -f - and use stdin.

 the use of - to indicate stdin is a hack.  always was, and always will
 be.  don't get me wrong, i like it too, but there are other ways of
 doing the same thing these days.  did you try using /dev/fd/0 or
 /dev/stdin?

 -- 
 |-----< "CODE WARRIOR" >-----|
 codewarrior@daemon.org             * "ah!  i see you have the internet
 twofsonet@graffiti.com (Andrew Brown)                that goes *ping*!"
 andrew@crossbar.com       * "information is power -- share the wealth."

From: James Chacon <jchacon@genuity.net>
To: atatat@atatdot.net
Cc: jchacon@genuity.net, gnats-bugs@gnats.netbsd.org, netbsd-bugs@netbsd.org
Subject: Re: bin/10898: Patch to arp to allow -f -
Date: Sun, 27 Aug 2000 16:18:48 -0400 (EDT)

 -f - is a standard convention for a lot of stuff already in the source tree.

 Yes, /dev/stdin or /dev/fd could be used (if you've bothered to mount fdesc),
 but in general is never going to be something folks will see as examples or
 would think of. So, adding it in as an option as well just rounds things out.

 James


 >
 >>>Description:
 >>arp allows -f filename which is handy if you have multiple things to do
 >>(for instance in a start-up script). However filename must be a real file
 >>which makes creating pipelines a pain (temp files and all that).
 >>A simple fix is to check for -f - and use stdin.
 >
 >the use of - to indicate stdin is a hack.  always was, and always will
 >be.  don't get me wrong, i like it too, but there are other ways of
 >doing the same thing these days.  did you try using /dev/fd/0 or
 >/dev/stdin?
 >
 >-- 
 >|-----< "CODE WARRIOR" >-----|
 >codewarrior@daemon.org             * "ah!  i see you have the internet
 >twofsonet@graffiti.com (Andrew Brown)                that goes *ping*!"
 >andrew@crossbar.com       * "information is power -- share the wealth."
 >
 >
 >
 >


From: Andrew Brown <atatat@atatdot.net>
To: James Chacon <jchacon@genuity.net>
Cc: gnats-bugs@gnats.netbsd.org, netbsd-bugs@netbsd.org
Subject: Re: bin/10898: Patch to arp to allow -f -
Date: Sun, 27 Aug 2000 19:01:03 -0400

 >-f - is a standard convention for a lot of stuff already in the source tree.

 i'm not debating that.  i was just noting that it was a hack that
 dated back to before the advent of the file descriptor devices.

 >Yes, /dev/stdin or /dev/fd could be used (if you've bothered to mount fdesc),

 funny...they've always worked for me, but i've never mounted that.

 >but in general is never going to be something folks will see as examples or
 >would think of. So, adding it in as an option as well just rounds things out.

 sure...okay.

 -- 
 |-----< "CODE WARRIOR" >-----|
 codewarrior@daemon.org             * "ah!  i see you have the internet
 twofsonet@graffiti.com (Andrew Brown)                that goes *ping*!"
 andrew@crossbar.com       * "information is power -- share the wealth."
From: "David A. Holland" <dholland@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/10898 CVS commit: src/usr.sbin/arp
Date: Thu, 10 Jun 2010 06:03:20 +0000

 Module Name:	src
 Committed By:	dholland
 Date:		Thu Jun 10 06:03:20 UTC 2010

 Modified Files:
 	src/usr.sbin/arp: arp.c

 Log Message:
 Allow -f -, as per PR 10898.


 To generate a diff of this commit:
 cvs rdiff -u -r1.48 -r1.49 src/usr.sbin/arp/arp.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->dholland
Responsible-Changed-By: dholland@NetBSD.org
Responsible-Changed-When: Thu, 10 Jun 2010 06:21:02 +0000
Responsible-Changed-Why:
I did it


State-Changed-From-To: open->closed
State-Changed-By: dholland@NetBSD.org
State-Changed-When: Thu, 10 Jun 2010 06:21:02 +0000
State-Changed-Why:
committed (with a change to avoid fclose(stdin))
thanks.


>Unformatted:

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-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.