NetBSD Problem Report #49177

From www@NetBSD.org  Sat Sep  6 15:11:46 2014
Return-Path: <www@NetBSD.org>
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 78A57B88FB
	for <gnats-bugs@gnats.NetBSD.org>; Sat,  6 Sep 2014 15:11:46 +0000 (UTC)
Message-Id: <20140906151144.DA0ACB8A65@mollari.NetBSD.org>
Date: Sat,  6 Sep 2014 15:11:44 +0000 (UTC)
From: skyblack@live.cn
Reply-To: skyblack@live.cn
To: gnats-bugs@NetBSD.org
Subject: usr.bin/uuencode is not functioning correctly, there are some problems in the source code.
X-Send-Pr-Version: www-1.0

>Number:         49177
>Category:       bin
>Synopsis:       usr.bin/uuencode is not functioning correctly, there are some problems in the source code.
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    bin-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Sep 06 15:15:00 +0000 2014
>Closed-Date:    Sat Sep 06 19:01:17 +0000 2014
>Last-Modified:  Thu Sep 11 12:25:00 +0000 2014
>Originator:     Sky Liu
>Release:        6.1.4
>Organization:
Beijiang Senior School
>Environment:
NetBSD foobar 6.1.4 NetBSD 6.1.4 (EEEPC900) #2: Sun Jun 29 02:00:06 CEST 2014

>Description:
I've read through the code carefully, and i found the following problems:
it says "usage: %s [-m] [inputfile] outputname\n", right?
despite of the "-m" , it means if i pass two arguments to it, the first one will be treated as input and the second one will be treated as output
and if i pass one argument to it , stdin will be treated as input and the only argument will be the output right?
but whatever your arguments are, the output will alway be stdout
according to the code , it uses putchar() to print things but there isn't any freopen(*,*,stdout) through the whole file
according to my experiments and oservations this is what it actually does:
if i give only one argument to it, it will use stdin and stdout as input and output
if i give two arguments to it, it will take the second one as input and print all the things to the screen
>How-To-Repeat:
if YOU give only one argument to it, it will use stdin and stdout as input and output
if you give two arguments to it, it will take the second one as input and print all the things to the screen
which is not what it should be
>Fix:
it's not hard to fix it. making some small changes to the code(add freopen(), or replace putchar() with fprintf()) and it will be alright. And I would like to help. Please inform me if you figure out what to do next, thanks.

>Release-Note:

>Audit-Trail:
From: "Jeremy C. Reed" <reed@reedmedia.net>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: bin/49177: usr.bin/uuencode is not functioning correctly, there
 are some problems in the source code.
Date: Sat, 6 Sep 2014 13:22:17 -0500 (CDT)

 On Sat, 6 Sep 2014, skyblack@live.cn wrote:

 > but whatever your arguments are, the output will alway be stdout

 That is correct.

 > if i give two arguments to it, it will take the 
 > second one as input and print all the things to the screen

 I cannot reproduce this. I assume you may see it wrong.

 note that the you may be mislead by the correct behaviour.

 The second argument "outputname" is not the name of any input file but 
 is the name to use for later uudecode. See the "begin" line contains 
 your desired filename.

 t1:reed$ uuencode /etc/passwd whatever | head -1
 begin 644 whatever

 t1:reed$ uuencode /etc/passwd whatever | uudecode
 t1:reed$ head -1 whatever
 root:*:0:0:Charlie &:/root:/bin/sh

 I think this ticket may be closed, but please double check for yourself.

From: matthew green <mrg@eterna.com.au>
To: gnats-bugs@NetBSD.org
Cc: gnats-admin@netbsd.org, netbsd-bugs@netbsd.org
Subject: re: bin/49177: usr.bin/uuencode is not functioning correctly, there are some problems in the source code.
Date: Sun, 07 Sep 2014 04:25:27 +1000

 this is as-designed.  "outputname" is not a file on the local system,
 but the file name that is put inside the uuencoded output at the start.

 eg:

 > echo foo | uuencode fo 
 begin 664 fo
 $9F]O"G]_
 `
 end


 .mrg.

From: "David A. Holland" <dholland@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/49177 CVS commit: src/usr.bin/uuencode
Date: Sat, 6 Sep 2014 18:37:01 +0000

 Module Name:	src
 Committed By:	dholland
 Date:		Sat Sep  6 18:37:01 UTC 2014

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

 Log Message:
 Fix wrong use of argument identifiers; pursuant to PR 49177.


 To generate a diff of this commit:
 cvs rdiff -u -r1.22 -r1.23 src/usr.bin/uuencode/uuencode.1

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

From: Dave Huang <khym@azeotrope.org>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: bin/49177: usr.bin/uuencode is not functioning correctly, there are some problems in the source code.
Date: Sat, 6 Sep 2014 13:48:53 -0500

 On Sep 6, 2014, at 10:15, skyblack@live.cn wrote:
 > I've read through the code carefully, and i found the following =
 problems:
 > it says "usage: %s [-m] [inputfile] outputname\n", right?
 > despite of the "-m" , it means if i pass two arguments to it, the =
 first one will be treated as input and the second one will be treated as =
 output

 It's hard to document how a program works in a one-line usage summary.=20=

 The man page should have a better explanation of what "outputname"=20
 means (although in the case of uuencode, it's still not very clear,=20
 unfortunately). However, it is clear that "uuencode reads inputfile (or=20=

 by default the standard input) and writes an encoded version to the=20
 standard output."

 In other words, uuencode always writes to stdout. The "outputname"=20
 parameter just affects the filename in the "begin" line of the encoded=20=

 file; uuencode doesn't actually write to that file. I think the purpose=20=

 of "outputname" is if you are encoding stdin; you need to provide=20
 uuencode a filename to store in the begin line. E.g.,

 $ gzip -c /vmunix | uuencode vmunix.gz | mail khym

 P.S. I do think the uuencode man page could be improved. It talks about=20=

 "outputname" in the paragraph describing "uudecode", and in the=20
 documentation of the options, it lists "-o outputname" for uudecode,=20
 when uudecode's synopsis has "-o outputfile"

From: "David A. Holland" <dholland@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/49177 CVS commit: src/usr.bin/uuencode
Date: Sat, 6 Sep 2014 18:54:46 +0000

 Module Name:	src
 Committed By:	dholland
 Date:		Sat Sep  6 18:54:46 UTC 2014

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

 Log Message:
 Clarify and generally improve. The expansion of files is not a bug,
 it's a consequence of what uuencode does. Also note for a more hostile
 internet environment that blindly uudecoding files without inspecting
 the header is dangerous.

 Pursuant to PR 49177.


 To generate a diff of this commit:
 cvs rdiff -u -r1.23 -r1.24 src/usr.bin/uuencode/uuencode.1

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

From: "David A. Holland" <dholland@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/49177 CVS commit: src/usr.bin/uuencode
Date: Sat, 6 Sep 2014 18:58:35 +0000

 Module Name:	src
 Committed By:	dholland
 Date:		Sat Sep  6 18:58:35 UTC 2014

 Modified Files:
 	src/usr.bin/uuencode: uuencode.c

 Log Message:
 Clarify the usage message. For PR 49177.


 To generate a diff of this commit:
 cvs rdiff -u -r1.15 -r1.16 src/usr.bin/uuencode/uuencode.c

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

From: David Holland <dholland-bugs@netbsd.org>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: bin/49177 (Fwd: CVS commit: src/usr.bin/uuencode)
Date: Sat, 6 Sep 2014 18:59:53 +0000

 Forgot to tag this one with the PR number.

    ------

 From: "David A. Holland" <dholland@netbsd.org>
 To: source-changes@NetBSD.org
 Subject: CVS commit: src/usr.bin/uuencode
 Date: Sat, 6 Sep 2014 18:58:06 +0000
 Mail-Followup-To: source-changes-d@NetBSD.org

 Module Name:	src
 Committed By:	dholland
 Date:		Sat Sep  6 18:58:05 UTC 2014

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

 Log Message:
 On reflection change "outputname" to "headername" so it's clear it's not
 the output of uuencode.


 To generate a diff of this commit:
 cvs rdiff -u -r1.24 -r1.25 src/usr.bin/uuencode/uuencode.1

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

State-Changed-From-To: open->closed
State-Changed-By: dholland@NetBSD.org
State-Changed-When: Sat, 06 Sep 2014 19:01:17 +0000
State-Changed-Why:
Not a bug. But I've improved the documentation.


From: "Martin Husemann" <martin@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/49177 CVS commit: [netbsd-7] src/usr.bin/uuencode
Date: Thu, 11 Sep 2014 12:22:28 +0000

 Module Name:	src
 Committed By:	martin
 Date:		Thu Sep 11 12:22:27 UTC 2014

 Modified Files:
 	src/usr.bin/uuencode [netbsd-7]: uuencode.1 uuencode.c

 Log Message:
 Pull up following revision(s) (requested by dholland in ticket #87):
 	usr.bin/uuencode/uuencode.c: revision 1.16
 	usr.bin/uuencode/uuencode.1: revision 1.23
 	usr.bin/uuencode/uuencode.1: revision 1.24
 	usr.bin/uuencode/uuencode.1: revision 1.25
 	usr.bin/uuencode/uuencode.1: revision 1.26
 Clarify usage message and improve documentation; pursuant to PR 49177.


 To generate a diff of this commit:
 cvs rdiff -u -r1.22 -r1.22.8.1 src/usr.bin/uuencode/uuencode.1
 cvs rdiff -u -r1.15 -r1.15.20.1 src/usr.bin/uuencode/uuencode.c

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

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