Skip site navigation (1)Skip section navigation (2)
Date:      Tue,  3 Sep 2002 14:47:33 +0900 (JST)
From:      Kimura Fuyuki <fuyuki@hadaly.org>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   bin/42356: uudecode -o doesn't work if piped
Message-ID:  <20020903054733.24DAC5693@hadaly.dyndns.org>

next in thread | raw e-mail | index | archive | help

>Number:         42356
>Category:       bin
>Synopsis:       uudecode -o doesn't work if piped
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Sep 02 22:50:01 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     Kimura Fuyuki
>Release:        FreeBSD 4.6.2-RELEASE i386
>Organization:
>Environment:
System: FreeBSD hadaly.dyndns.org 4.6.2-RELEASE FreeBSD 4.6.2-RELEASE #17: Wed Aug 14 17:19:17 JST 2002 root@hadaly.dyndns.org:/sack/tmp/obj/pub/src/sys/NS i386


	
>Description:
uudecode -o doesn't work if the output is piped to other programs.
	
>How-To-Repeat:
 $ uudecode -o /tmp/a.tgz </tmp/a.uue
 $ tar tvzf /tmp/a.tgz
 drwxr-xr-x user/user         0 Nov 13 13:10 2001 dir/
 -rw-r--r-- user/user         3 Nov 13 13:10 2001 dir/file
 drwxr-xr-x user/user         0 Nov 13 13:10 2001 dir/RCS/
 -r--r--r-- user/user       307 Nov 13 13:10 2001 dir/RCS/file,v
 $ uudecode -o /dev/stdout </tmp/a.uue | tar xvzf -
 uudecode: /dev/stdout: stdin: Invalid argument
 
 gzip: stdin: unexpected end of file
 tar: child returned status 1
	
>Fix:
This patch could be a solution, but doesn't solve the below though I
don't think it's useful.

$ uudecode -o /tmp/a.tgz </tmp/*.uue | tar xvzf -

Index: uudecode.c
===================================================================
RCS file: /home/ncvs/src/usr.bin/uudecode/uudecode.c,v
retrieving revision 1.27
diff -u -r1.27 uudecode.c
--- uudecode.c	19 May 2002 11:22:52 -0000	1.27
+++ uudecode.c	3 Sep 2002 05:25:08 -0000
@@ -96,6 +96,8 @@
 			oflag = 1; /* output to the specified file */
 			sflag = 1; /* do not strip pathnames for output */
 			outfile = optarg; /* set the output filename */
+			if (strcmp(outfile, "/dev/stdout") == 0)
+				pflag = 1;
 			break;
 		case 'p':
 			if (oflag)

By the way, I don't understand the mean of the following lines. Are they
necessary? If they can be zapped, it could be a better solution.

		} else if (!freopen(buf, "w", stdout) ||
		    fchmod(fileno(stdout), getmode(mode_handle, 0) & 0666)) {
			warn("%s: %s", buf, filename);
			return(1);
		}

>Release-Note:
>Audit-Trail:
>Unformatted:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020903054733.24DAC5693>