Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 16 Mar 2003 21:41:03 +0100
From:      Stijn Hoop <stijn@win.tue.nl>
To:        parv <parv_fm@emailgroups.net>
Cc:        Thomas David Rivers <rivers@dignus.com>, pirat@access.inet.co.th, stable@FreeBSD.ORG, doc@FreeBSD.ORG
Subject:   Re: uuencode takes very long time
Message-ID:  <20030316204103.GB5607@pcwin002.win.tue.nl>
In-Reply-To: <20030316203223.GA34213@moo.holy.cow>
References:  <20030316113452.GA309@thai-aec.org> <200303161153.h2GBrk620041@lakes.dignus.com> <20030316203223.GA34213@moo.holy.cow>

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

[-- Attachment #1 --]
On Sun, Mar 16, 2003 at 03:32:23PM -0500, parv wrote:
> in message <200303161153.h2GBrk620041@lakes.dignus.com>, wrote
> Thomas David Rivers thusly...
> >
> > pirat <pirat@access.inet.co.th> wrote:
> > > unfortunately, i had been stuck at a step of uuencoding.  it
> > > took a tremendious long time.  i was waiting for 18 hours for
> > > nothing.
> > >
> > > uuencode my-pr.tar.gz > my-pr.uue
> ...
> >  you see, when you had "uuencode my-pr.tar.gz", you were not
> >  trying to uuencode the file "my-pr.tar.gz" - that parameter
> >  provides the name to use when uudecoding (on the "other side", as
> >  it were.)
> >
> >  Thus, the uuencode encode command was waiting for 18 hours trying
> >  to read something from stdin...
> >
> >  There are several ways to handle this:
> >
> > 	cat my-pr.tar.gz | uuencode my-pr.tar.gz
> ...
> > 	uuencode my-pr.tar.gz my-pr.tar.gz
> 
> Are you mad, man?  It is certainly possible that in the 2d case,
> encoded file & the original would be corrupted/incomplete due to
> race conditions.  In case of a (very) large file, the same thing
> would happen in the 1st case too.

Uhm, no. He was right. Reread the man page. The first argument in the 2nd case
is the name of the file that a subsequent uu_de_code will produce. The output
of uuencode is written to stdout by default so no file gets overwritten.

Have you tried the above? I have:

[stijn@firsa] <~> cat tmp.txt
This is a uuencode test.
[stijn@firsa] <~> uuencode tmp.txt tmp.txt
begin 644 tmp.txt
95&AI<R!I<R!A('5U96YC;V1E('1E<W0N"@``
`
end

> It is much safer to use a temporary/other name for a file to store
> the (encoded) output.

No, this is plain wrong. What would be dangerous is the following:

$ uuencode tmp.txt tmp.txt > tmp.txt

But that's just plain silly.

> Mind you w/o -o option uuencode sends output to stdout (from
> uuencode(1)), which is what OP was doing.  I tried the -o option on
> a small (3 kB) file...
> 
>   uuencode -o p.uue p
> 
> ...the process hanged like above.

That's because you're not providing the 'file' argument, and like the first
response said, uuencode will then try to encode stdin. Since you're not typing
anything it will appear to do nothing. Try this:

[stijn@firsa] <~> uuencode -o test.uu test
I TYPED THIS IN AND THEN PRESSED CTRL-D
[stijn@firsa] <~> cat test.uu        
begin 644 test
H22!465!%1"!42$E3($E.($%.1"!42$5.(%!215-3140@0U123"U$"@``
`
end

So that works like a charm.

>   34748 uuencode CALL  read(0,134533120,4096)

This is reading from descriptor 0, stdin by default IIRC.

>   34748 uuencode PSIG  SIGINT SIG_DFL

You pressed ^C here.

> I suppose OP should file a pr.

I don't think so, this is expected and documented behaviour, although
non-intuitive.

HTH,

--Stijn

-- 
"A mouse is a device used to point at the xterm you want to type in."
		-- Kim Alm, alt.sysadmin.recovery

[-- Attachment #2 --]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (FreeBSD)

iD8DBQE+dOFfY3r/tLQmfWcRAhRtAJ0QhbhFqciXOKARCd9DF/cRcGaDgQCeLiCt
PV7oSCdM3cuIcAdvQlEu7Gc=
=PklY
-----END PGP SIGNATURE-----

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