NetBSD Problem Report #16132

Received: (qmail 21463 invoked from network); 30 Mar 2002 17:53:53 -0000
Message-Id: <20020330175350.5FF147B4B@berkshire.research.att.com>
Date: Sat, 30 Mar 2002 12:53:50 -0500 (EST)
From: smb@research.att.com
Reply-To: smb@research.att.com
To: gnats-bugs@gnats.netbsd.org
Subject: ftp's 'ls' to a file is interactive, even in a script
X-Send-Pr-Version: 3.95

>Number:         16132
>Category:       bin
>Synopsis:       ftp's 'ls' to a file is interactive, even in a script
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    lukem
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Mar 30 17:54:01 +0000 2002
>Closed-Date:    
>Last-Modified:  Mon May 06 14:41:32 +0000 2002
>Originator:     Steven M. Bellovin
>Release:        NetBSD 1.5.1
>Organization:
AT&T Labs Research
>Environment:

System: NetBSD berkshire.research.att.com 1.5.3_ALPHA NetBSD 1.5.3_ALPHA (BERKSHIRE.nosound) #5: Wed Feb 20 22:37:19 EST 2002 root@:/usr/src/sys/arch/i386/compile/BERKSHIRE.nosound i386


>Description:
	When you do an 'ls' inside of ftp and specify an output file
	(i.e., 'ls . /tmp/xx' or 'nlist /pub /tmp/xx'), it prompts
	to ask if you really want to write the output to a file.  That's
	fine for interactive use (though rather non-Unix like, but that's
	another story).  But it issues the same prompt even for non-
	interactive ftp sessions, such as ftp from a script.  That's
	wrong.
>How-To-Repeat:
	cat >/tmp/xx <<EOF
	ls . /tmp/yy
	EOF
	ftp -a ftp.netbsd.org </tmp/xx
>Fix:
	-i is a workaround, but it shouldn't be needed in this case.
	There's already a variable inside ftp that knows it's got
	stdin from a tty; its value should be checked before that prompt.
>Release-Note:
>Audit-Trail:

From: Hubert Feyrer <hubert.feyrer@informatik.fh-regensburg.de>
To: smb@research.att.com
Cc: gnats-bugs@gnats.netbsd.org
Subject: Re: bin/16132: ftp's 'ls' to a file is interactive, even in a script
Date: Sat, 30 Mar 2002 19:14:59 +0100 (MET)

 On Sat, 30 Mar 2002 smb@research.att.com wrote:
 > 	When you do an 'ls' inside of ftp and specify an output file
 > 	(i.e., 'ls . /tmp/xx' or 'nlist /pub /tmp/xx'), it prompts
 > 	to ask if you really want to write the output to a file.  That's
 > 	fine for interactive use (though rather non-Unix like, but that's
 > 	another story).  But it issues the same prompt even for non-
 > 	interactive ftp sessions, such as ftp from a script.  That's
 > 	wrong.

 I don't remember the details, but check
 src/usr.sbin/pkg_install/lib/ftpio.c, which uses that for wildcard
 expansion. I didn't have that problem ...


  - Hubert

 -- 
 Want to get a clue on IPv6 but don't know where to start? Try this:
 * Basics -> http://www.onlamp.com/pub/a/onlamp/2001/05/24/ipv6_tutorial.html
 * Setup  -> http://www.onlamp.com/pub/a/onlamp/2001/06/01/ipv6_tutorial.html 
 Of course with your #1 IPv6 ready operating system -> http://www.NetBSD.org/



From: "Steven M. Bellovin" <smb@research.att.com>
To: Hubert Feyrer <hubert.feyrer@informatik.fh-regensburg.de>
Cc: gnats-bugs@gnats.netbsd.org
Subject: Re: bin/16132: ftp's 'ls' to a file is interactive, even in a script 
Date: Sat, 30 Mar 2002 13:23:53 -0500

 In message <Pine.GSO.4.21.0203301913440.18644-100000@rfhpc8317>, Hubert Feyrer 
 writes:
 >On Sat, 30 Mar 2002 smb@research.att.com wrote:
 >> 	When you do an 'ls' inside of ftp and specify an output file
 >> 	(i.e., 'ls . /tmp/xx' or 'nlist /pub /tmp/xx'), it prompts
 >> 	to ask if you really want to write the output to a file.  That's
 >> 	fine for interactive use (though rather non-Unix like, but that's
 >> 	another story).  But it issues the same prompt even for non-
 >> 	interactive ftp sessions, such as ftp from a script.  That's
 >> 	wrong.
 >
 >I don't remember the details, but check
 >src/usr.sbin/pkg_install/lib/ftpio.c, which uses that for wildcard
 >expansion. I didn't have that problem ...
 >


 Odd.  That runs ftp with -detv; here's what I get when I try that:

 b131$ cat /tmp/xx
 ls . /tmp/yy
 b132$ ftp -adetv ftp.netbsd.org </tmp/xx          
 Trying 3ffe:8050:201:1860:2a0:c9ff:feed:b7ea...
 Connected to ftp.netbsd.org.
 220 ftp6.netbsd.org FTP server (NetBSD-ftpd 20020201) ready.
 ftp_login: user `<null>' pass `<null>' host `ftp.netbsd.org'
 ---> USER anonymous
 331 Guest login ok, type your name as password.
 ---> PASS XXXX
 230-

      Welcome to FTP.NetBSD.ORG                                              
      Located in Palo Alto, CA, USA                         ,        ,       
                                                           /(        )`      
                                              Home of      \ \___   / |      
        100Mb Connectivity Courtesy of       the FREE      /- _  `-/  '      
         Internet Software Consortium      MULTIPLATFORM  (/\/ \ \   /\      
                                          NetBSD 1.5.2 OS / /   | `    \     
                                                      \   O O   ) /    |     
     +--- Currently Supported Platforms ----+          \  `-^--'`<     '     
     |   DEC ALPHA, (STRONG)ARM32, ATARI,   |           \ (_.)  _  )   /     
     |BEBOX, COMMODORE AMIGA & MACROSYSTEMS |             `.___/`    /       
     |   DRACO, HP 300, INTEL x86, APPLE    |               `-----' /        
     | MACINTOSH(68k & PPC, iMAC, G3, G4),  |  <----.     __ / __   \        
     | MOTOROLA MVME68k, NEWS (68k & MIPS), |  <----|====O)))==) \) /====    
     |   NeXT, PC532, PMAX, POWERPC, SUN    |  <----'    `--' `.__,' \       
     |  SPARC(64), SUN 3/3X, DEC VAX, X68k  |               |        |       
     +--------------------------------------+               \       /        
            MORE ARE UNDER DEVELOPMENT                 ______( (_  / \_____  
                                               (FL)  ,'  ,-----'   |       \ 
     ALL FTP TRANSFERS AND COMMANDS ARE LOGGED.      `--{__________)       \/
 230-
     EXPORT NOTICE

     Please note that portions of this FTP site contain cryptographic
     software controlled under the Export Administration Regulations (EAR).

     None of this software may be downloaded or otherwise exported or
     re-exported into (or to a national or resident of) Cuba, Iraq, Libya,
     Sudan, North Korea, Iran, Syria or any other country to which the
     U.S. has embargoed goods.

     By downloading or using said software, you are agreeing to the
     foregoing and you are representing and warranting that you are not
     located in, under the control of, or a national or resident of any
     such country or on any such list.
 230 Guest login ok, access restrictions apply.
 ---> SYST
 215 UNIX Type: L8 Version: NetBSD-ftpd 20020201
 Remote system type is UNIX.
 Using binary mode to transfer files.
 ---> PWD
 257 "/" is the current directory.
 got remotepwd as `/'
 output to local-file: /tmp/yy [anpqy?]? 
 EOF received; (null) aborted
 ---> QUIT
 221-
     Data traffic for this session was 0 bytes in 0 files.
     Total traffic for this session was 2683 bytes in 0 transfers.
 221 Thank you for using the FTP service on ftp6.netbsd.org.


 		--Steve Bellovin, http://www.research.att.com/~smb
 		Full text of "Firewalls" book now at http://www.wilyhacker.com



From: Todd Vierling <tv@wasabisystems.com>
To: smb@research.att.com
Cc: gnats-bugs@gnats.netbsd.org
Subject: Re: bin/16132: ftp's 'ls' to a file is interactive, even in a script
Date: Sat, 30 Mar 2002 15:04:29 -0500 (Eastern Standard Time)

 On Sat, 30 Mar 2002 smb@research.att.com wrote:

 : 	When you do an 'ls' inside of ftp and specify an output file
 : 	(i.e., 'ls . /tmp/xx' or 'nlist /pub /tmp/xx'), it prompts
 : 	to ask if you really want to write the output to a file.  That's
 : 	fine for interactive use (though rather non-Unix like, but that's
 : 	another story).  But it issues the same prompt even for non-
 : 	interactive ftp sessions, such as ftp from a script.  That's
 : 	wrong.

 : 	-i is a workaround, but it shouldn't be needed in this case.
 : 	There's already a variable inside ftp that knows it's got
 : 	stdin from a tty; its value should be checked before that prompt.

 Actually, I believe the `-i' in this case should be mandatory as is already
 the case.  I think the proper fix here is to make ftp use /dev/tty
 explicitly for such prompting as needed, if `-i' is not specified.  I've had
 a need for prompting on aborted transfers, for one, when using a script, and
 this ability exists on ftp clients on one specific popular, unnamed OS.  8-)

 There's reasons for including prompting even when redirecting input from a
 script; hence, I personally suggest that the bug here is actually that
 ftp(1) tries to read responses to the prompt from the script, rather than
 the terminal.

 -- 
 -- Todd Vierling <tv@wasabisystems.com>  *  Wasabi & NetBSD:  Run with it.
 -- CDs, Integration, Embedding, Support -- http://www.wasabisystems.com/


From: Berndt Josef Wulf <wulf@dingo.ping.net.au>
To: smb@research.att.com
Cc: gnats-bugs@gnats.netbsd.org
Subject: Re: bin/16132: ftp's 'ls' to a file is interactive, even in a script
Date: Sun, 31 Mar 2002 09:37:21 +0930 (CST)

 smb@research.att.com wrote
 > 
 > >Number:         16132
 > >Category:       bin
 > >Synopsis:       ftp's 'ls' to a file is interactive, even in a script
 > >Confidential:   no
 > >Severity:       non-critical
 > >Priority:       low
 > >Responsible:    bin-bug-people
 > >State:          open
 > >Class:          sw-bug
 > >Submitter-Id:   net
 > >Arrival-Date:   Sat Mar 30 09:54:01 PST 2002
 > >Closed-Date:
 > >Last-Modified:
 > >Originator:     Steven M. Bellovin
 > >Release:        NetBSD 1.5.1
 > >Organization:
 > AT&T Labs Research
 > >Environment:
 > 	
 > System: NetBSD berkshire.research.att.com 1.5.3_ALPHA NetBSD 1.5.3_ALPHA (BERKSHIRE.nosound) #5: Wed Feb 20 22:37:19 EST 2002 root@:/usr/src/sys/arch/i386/compile/BERKSHIRE.nosound i386
 > 
 > 
 > >Description:
 > 	When you do an 'ls' inside of ftp and specify an output file
 > 	(i.e., 'ls . /tmp/xx' or 'nlist /pub /tmp/xx'), it prompts
 > 	to ask if you really want to write the output to a file.  That's
 > 	fine for interactive use (though rather non-Unix like, but that's
 > 	another story).  But it issues the same prompt even for non-
 > 	interactive ftp sessions, such as ftp from a script.  That's
 > 	wrong.
 > >How-To-Repeat:
 > 	cat >/tmp/xx <<EOF
 > 	ls . /tmp/yy
 > 	EOF
 > 	ftp -a ftp.netbsd.org </tmp/xx
 > >Fix:
 > 	-i is a workaround, but it shouldn't be needed in this case.
 > 	There's already a variable inside ftp that knows it's got
 > 	stdin from a tty; its value should be checked before that prompt.
 > >Release-Note:
 > >Audit-Trail:
 > >Unformatted:
 > 

 This is not a bug but the expected behaviour of the ftp client.
 Use the 'prompt' option to suppress the interactive characteristics of ftp.

  	cat >/tmp/xx <<EOF
 	prompt
  	ls . /tmp/yy
  	EOF
  	ftp -a ftp.netbsd.org </tmp/xx

 cheerio Berndt
 -- 
 Name    : Berndt Josef Wulf            | +++ With BSD on Packet Radio +++
 E-Mail  : wulf@ping.net.au             |    tfkiss, tnt, dpbox, wampes
 ICQ     : 18196098                     |  VK5ABN, Nairne, South Australia 
 URL     : http://www.ping.net.au/~wulf | MBOX : vk5abn@vk5abn.#lmr.#sa.au.oc
 Sysinfo : DEC AXPpci33+, NetBSD-1.5    | BBS  : vk5abn.#lmr.#sa.aus.oc 
Responsible-Changed-From-To: bin-bug-people->lukem 
Responsible-Changed-By: lukem 
Responsible-Changed-When: Mon May 6 07:41:24 PDT 2002 
Responsible-Changed-Why:  
mine... 
>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.