Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2013-09-17
09:25 • Closed ticket [2152292fff]: uuencode encoding wrong plus 7 other changes artifact: 27208b0112 user: dkf
09:24
[2152292]: Corrected implementation of uuencode handling to support line length indicator bytes. **... check-in: c001d40665 user: dkf tags: trunk, potential incompatibility
2013-09-16
13:29 • Ticket [2152292fff] uuencode encoding wrong status still Open with 3 other c... artifact: 89171882c2 user: jan.nijtmans
09:06 • Ticket [2152292fff]: 4 changes artifact: 7d1b6f1bb3 user: dkf
2013-09-15
17:13 • Ticket [2152292fff]: 3 changes artifact: d64d8a6099 user: jan.nijtmans
06:02 • Ticket [2152292fff]: 4 changes artifact: 13974c90ba user: dkf
2013-09-14
21:22 • Ticket [2152292fff]: 4 changes artifact: e1529edd9f user: dkf
08:56 • Ticket [2152292fff]: 3 changes artifact: 7aa813fb7c user: jan.nijtmans
07:09 • Ticket [2152292fff]: 4 changes artifact: 9b1ce24fd1 user: dkf
07:07
[2152292] Corrected implementation of uuencoding. check-in: f335dbad5b user: dkf tags: bug-2152292
2013-09-12
14:48 • Ticket [2152292fff] uuencode encoding wrong status still Open with 5 other c... artifact: e6b0599940 user: dkf
14:46 • Ticket [2152292fff]: 4 changes artifact: 4c229209c9 user: dkf
2013-09-10
18:59 • Ticket [2152292fff]: 5 changes artifact: 7c6ea2ca44 user: dkf
2008-10-07
22:40 • New ticket [2152292fff]. artifact: 607d4e4967 user: dkf

uuencode encoding wrong

Closed / Fixed2152292fffffffffffffffffffffffffffffffffCreated 18 years agoUpdated 13 years ago
Descriptionplain2008-10-07 22:40:06
According to http://en.wikipedia.org/wiki/Uuencode we do uuencoding wrong. In particular (ignoring the header and footer) uuencoding always uses a line length of 61 (encoding 45 bytes as 60 bytes with a length character preceding, typically an 'M' for 45 bytes). Wrap char is always \n (of course). The data is finished off with a line containing zero characters. And a backtick/grave accent (`) is often substituted for space so things don't get mangled.

I'd be perfectly happy at leaving the header/footer processing off. ;-)
dkf Ticket [2152292fff]: 5 changes [History diff]2013-09-10 18:59:40
dkfhtml2013-09-12 14:46:58

Length byte processing is important, and that means that splitting into lines is important.

dkfhtml2013-09-12 14:48:28

Bumping prio; without the length byte (and hence line handling) the encoding/unencoding is actually incorrect. Alas.

dkfhtml2013-09-14 07:09:36

I've got a fix for the encoding side on this branch: bug-2152292. It still needs some work so that it also correctly decodes.

jan.nijtmansplain2013-09-14 08:56:05
Added back the -wrapchar option. I don't think it's really useful, but we cannot be sure no-one used it (e.g. it could be set to "\r\n").
dkfhtml2013-09-14 21:22:56

That's really useless you know? Absolutely no conforming code can use it, and its implementation meant that even the use case you mentioned wouldn't have worked (the old code assumed that it was dealing with a single byte, probably a single non-NUL ASCII byte at that). If there's an option that you cannot touch without making the operation useless, it's best omitted. (Pat assumed that uuencoding was just the same as base64, except with a different encoding alphabet, but that's just not true. I remember because I used to use uuencoding a lot in the early '90s for archive files, and wikipedia backs me up.)

There's now a correct decoder done too; it can consume correct data files with only the need for header and footer processing added.

There might be cause to have some sort of enforcement of strictness, but that's of pretty low value IMO (being able to use a streaming version would be much more relevant, and also clearly in the realm of New Feature).

dkfhtml2013-09-15 06:02:39

It's not that we couldn't do a -wrapchar, but if we did, we might as well allow specifying of the profile of encoding characters to use as well; it's that useless.

If it was purely up to me, someone really needing the functionality could use string map afterwards. (You're holding the data in memory anyway…)

jan.nijtmansplain2013-09-15 17:13:09
I know that -wrapchar is of veeeeeeery limited use, but removing an existing options is not something I would expect in a bug-fix release. That's my main reason for adding it. But I would support removing it in Tcl 9 (or even Tcl 8.7).
dkfhtml2013-09-16 09:06:50

OK, I can live with it. I've tweaked it to work with bytearrays, as everything else is done that way.

jan.nijtmansplain2013-09-16 13:29:09
Thanks! Implementation looks OK to me.
dkfhtml2013-09-17 09:25:27

Committed to trunk. Thanks for your help, Jan.

Log in (anonymous is fine) to add a comment.