uudecode -o doesn't work if the output is piped to other programs. 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 - 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); }--tRhxagT6sE1F4yP2CVpm2N9ZDtmJzlkPrVQFEkuz3iUWSMaX Content-Type: text/plain; name="file.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="file.diff" 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) 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
* De: Kimura Fuyuki <fuyuki@hadaly.org> [ Data: 2002-09-02 ] [ Subjecte: bin/42356: uudecode -o doesn't work if piped ] > 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); > } This is to set the mode within the acceptable bitmask of modes, of the file being created. juli. -- Juli Mallett <jmallett@FreeBSD.org> | FreeBSD: The Power To Serve Will break world for fulltime employment. | finger jmallett@FreeBSD.org
> > } else if (!freopen(buf, "w", stdout) || > > fchmod(fileno(stdout), getmode(mode_handle, 0) & 0666)) { > > warn("%s: %s", buf, filename); > > return(1); > > } > This is to set the mode within the acceptable bitmask of modes, of the > file being created. I understand. I must have been half-asleep. :( -- fuyuki
Kimura Fuyuki <fuyuki@hadaly.org> wrote: > >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 I think this is a documentation bug, rather than a bug in uudecode itself. The manual page should suggest the -p option rather than -o /dev/stdout. (or perhaps failure to chmod should not be fatal) Would fixing the manual page satisfy you? Tony. -- f.a.n.finch <dot@dotat.at> http://dotat.at/ BISCAY SOUTHEAST FITZROY: EAST OR NORTHEAST 4 OR 5 BACKING MAINLY NORTHWEST 3 OR 4. MAINLY FAIR. GOOD.
State Changed From-To: open->feedback Is the submitter happy with a manpage fix instead?
At Tue, 03 Sep 2002 10:55:51 +0100, Tony Finch <dot@dotat.at> wrote: > > Kimura Fuyuki <fuyuki@hadaly.org> wrote: > > > >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 > > I think this is a documentation bug, rather than a bug in uudecode itself. > The manual page should suggest the -p option rather than -o /dev/stdout. > (or perhaps failure to chmod should not be fatal) > > Would fixing the manual page satisfy you? It would make standards@ people unhappy. Commit log says as follows: ---------------------------- revision 1.18 date: 2002/02/16 09:18:33; author: mike; state: Exp; lines: +0 -1 Un-deprecate the -p option. We now have two ways to output to stdout: `-o /dev/stdout' or `-p'. Requested by: grog, nectar ---------------------------- revision 1.17 date: 2002/01/27 18:21:23; author: mike; state: Exp; lines: +26 -3 Add -o option (POSIX.1-2001) to uudecode(1). Deprecate the -p option (which allows one to redirect output to stdout); `-o /dev/stdout' is recommended instead. Submitted by: Joseph Mallett <jmallett@xMach.org> MFC after: 2 weeks ---------------------------- -- fuyuki
State Changed From-To: feedback->patched Patch applied to -CURRENT.
State Changed From-To: patched->closed Fixed in -stable a long time ago.