From owner-freebsd-stable Sun Mar 16 12:41:26 2003 Delivered-To: freebsd-stable@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 2D56B37B401; Sun, 16 Mar 2003 12:41:22 -0800 (PST) Received: from pcwin002.win.tue.nl (pcwin002.win.tue.nl [131.155.71.72]) by mx1.FreeBSD.org (Postfix) with ESMTP id 19FE243F75; Sun, 16 Mar 2003 12:41:21 -0800 (PST) (envelope-from stijn@pcwin002.win.tue.nl) Received: from pcwin002.win.tue.nl (orb_rules@localhost [127.0.0.1]) by pcwin002.win.tue.nl (8.12.8/8.12.8) with ESMTP id h2GKf3lT006453; Sun, 16 Mar 2003 21:41:03 +0100 (CET) (envelope-from stijn@pcwin002.win.tue.nl) Received: (from stijn@localhost) by pcwin002.win.tue.nl (8.12.8/8.12.8/Submit) id h2GKf3J2006452; Sun, 16 Mar 2003 21:41:03 +0100 (CET) Date: Sun, 16 Mar 2003 21:41:03 +0100 From: Stijn Hoop To: parv Cc: Thomas David Rivers , 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> References: <20030316113452.GA309@thai-aec.org> <200303161153.h2GBrk620041@lakes.dignus.com> <20030316203223.GA34213@moo.holy.cow> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="gKMricLos+KVdGMg" Content-Disposition: inline In-Reply-To: <20030316203223.GA34213@moo.holy.cow> User-Agent: Mutt/1.4i X-Bright-Idea: Let's abolish HTML mail! Sender: owner-freebsd-stable@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG --gKMricLos+KVdGMg Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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 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 >=20 > 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 c= ase is the name of the file that a subsequent uu_de_code will produce. The outp= ut 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 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... >=20 > uuencode -o p.uue p >=20 > ...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 typ= ing 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 =20 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 --=20 "A mouse is a device used to point at the xterm you want to type in." -- Kim Alm, alt.sysadmin.recovery --gKMricLos+KVdGMg Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.1 (FreeBSD) iD8DBQE+dOFfY3r/tLQmfWcRAhRtAJ0QhbhFqciXOKARCd9DF/cRcGaDgQCeLiCt PV7oSCdM3cuIcAdvQlEu7Gc= =PklY -----END PGP SIGNATURE----- --gKMricLos+KVdGMg-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-stable" in the body of the message