Subject: Re: uudecode?
From: [email-masked] (Pierre A. Humblet)

21 Jan 1999 06:41:22 -0800
Message-ID: <[email-masked]>
References: <[email-masked]>
Mime-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
To: "John Cooper" <[email-masked]>, [email-masked] (root)
Cc: [email-masked] (John Cooper), [email-masked]

This has taken enough bandwidth that we might at least understand what
happened.

As stated in their README, the shareutils from ftp.franken.de require
binary mount. On a text mounted system the uuencode INPUT file gets
truncated at ^Z.
Ideally uuencode should binary open its input file AND setmode stdin to
binary (for use with cygwin shells, other shells always open stdin binary).
Similarly the output of uudecode should be binary.

It doesn't matter if the output of uuencode and the input of uudecode are
text or binary. Those programs encode the line length, usually taking in 45
characters at a time (they have to, to survive inclusion in e-mails).
uuencoded lines start with M because M is the 45th printable character
(above " "). Those 45 characters are expanded to 45 * 8/6 = 60 characters
per line, plus the length.

The uuencode.c program contributed in
http://www.cygnus.com/ml/gnu-win32/1999-Jan/0493.html has a bug: the first
ENC(ch) should have been ENC(n). That's why the uuencoded lines did not
start with M.  
There is also a bug in uudecode.c
if (!strncmp(buf, "end\r\n", 5))
will fail when the file ends with "end\n". The bug is not exposed because
the program normally terminates at the next to last line, which has zero
length.

Pierre

At 02:22 PM 1/20/99 +0000, John Cooper wrote:
>I finally pulled over the sharutils-4.2 source, got that to build under NT
and
>then carefully enabled (or disabled) the binary flag on the fopen calls.  It
>now seems to work fine - without mucking with mounts or using bash (I prefer
>zsh).

-
For help on using this list (especially unsubscribing), send a message to
"[email-masked]" with one line of text: "help".