Bug 153276 - [patch] uudecode(1) error message is incorrect
Summary: [patch] uudecode(1) error message is incorrect
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: Unspecified
Hardware: Any Any
: Normal Affects Only Me
Assignee: Piotr Pawel Stefaniak
URL:
Keywords: patch
Depends on:
Blocks:
 
Reported: 2010-12-18 19:20 UTC by David Brennan
Modified: 2024-02-08 03:44 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description David Brennan 2010-12-18 19:20:08 UTC
I discovered this problem on my OS X machine, and I am just trying to pass the information upstream as I see it also exists in the FreeBSD source code.

When using uudecode, if an improper character is detected, the error message that is printed does not match the actual error. The problem is that the IS_DEC macro allows character 32-96 inclusive. But the error message says that the allowed characters are 33-96. This caused me some trouble in diagnosing a problem with an external uuencode system.


#define IS_DEC(c)	 ( (((c) - ' ') >= 0) && (((c) - ' ') <= 077 + 1) )

#define OUT_OF_RANGE do {						\
	warnx("%s: %s: character out of range: [%d-%d]",		\
	    infile, outfile, 1 + ' ', 077 + ' ' + 1);			\

As you can see, the error message includes a 1 + ' ', which this IS_DEC macro does not have.

Fix: 

#define OUT_OF_RANGE do {						\
	warnx("%s: %s: character out of range: [%d-%d]",		\
	    infile, outfile, ' ', 077 + ' ' + 1);			\
How-To-Repeat: This only occurs with an improperly formatted file. Here is a simple way to improperly format a file.
$ echo "This is a test" >temp.txt
$ uuencode -o temp.uu temp.txt temp.txt
$ cat temp.uu
begin 644 temp.txt
/5&AI<R!I<R!A('1E<W0*
`
end

$ sed 's/^`$//' temp.uu | uudecode
uudecode: 
    input file: stdin
    encoded file: temp.txt
    character out of range: [33-96]
Comment 1 Eitan Adler freebsd_committer freebsd_triage 2017-12-31 08:01:10 UTC
For bugs matching the following criteria:

Status: In Progress Changed: (is less than) 2014-06-01

Reset to default assignee and clear in-progress tags.

Mail being skipped
Comment 2 commit-hook freebsd_committer freebsd_triage 2022-03-28 07:21:56 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=9f3203c003144a4ef6309435036f985afe549ff0

commit 9f3203c003144a4ef6309435036f985afe549ff0
Author:     Piotr Pawel Stefaniak <pstef@FreeBSD.org>
AuthorDate: 2021-11-08 14:31:03 +0000
Commit:     Piotr Pawel Stefaniak <pstef@FreeBSD.org>
CommitDate: 2022-03-28 07:01:35 +0000

    uudecode: correct error message

    PR:             153276
    Reported by:    David Brennan

 usr.bin/uudecode/uudecode.c                     | 2 +-
 usr.bin/uuencode/tests/regress.153276.in (new)  | 4 ++++
 usr.bin/uuencode/tests/regress.153276.out (new) | 1 +
 usr.bin/uuencode/tests/regress.sh               | 3 +++
 4 files changed, 9 insertions(+), 1 deletion(-)
Comment 3 Kyle Evans freebsd_committer freebsd_triage 2022-04-01 05:52:57 UTC
pstef@ committed, handing over to them for closing as needed.
Comment 4 commit-hook freebsd_committer freebsd_triage 2022-04-30 08:04:31 UTC
A commit in branch stable/13 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=963fdecd1a26676626a7067965a54ca7d5fa48fb

commit 963fdecd1a26676626a7067965a54ca7d5fa48fb
Author:     Piotr Pawel Stefaniak <pstef@FreeBSD.org>
AuthorDate: 2021-11-08 14:31:03 +0000
Commit:     Piotr Pawel Stefaniak <pstef@FreeBSD.org>
CommitDate: 2022-04-30 08:01:22 +0000

    uudecode: correct error message

    PR:             153276
    Reported by:    David Brennan

    (cherry picked from commit 9f3203c003144a4ef6309435036f985afe549ff0)

    uudecode: add missing test files to Makefile

    (cherry picked from commit 1b3af110bcd522a077f01350b6a51b3ffe434393)

    uudecode: use SRCDIR in the regression test

    (cherry picked from commit f5138631fb6f9dc73d696560caa006f3df714b9a)

    uudecode: move the new uudecode test from uuencode/ to uudecode/

    I don't know how that happened.

    (cherry picked from commit ae6aa2d43daa6276dd18dc974a1c5b7c15264615)

 usr.bin/uudecode/tests/Makefile                 | 1 +
 usr.bin/uudecode/tests/regress.153276.in (new)  | 4 ++++
 usr.bin/uudecode/tests/regress.153276.out (new) | 1 +
 usr.bin/uudecode/tests/regress.sh               | 5 ++++-
 usr.bin/uudecode/uudecode.c                     | 2 +-
 5 files changed, 11 insertions(+), 2 deletions(-)
Comment 5 Graham Perrin freebsd_committer freebsd_triage 2022-10-17 12:34:53 UTC
Keyword: 

    patch
or  patch-ready

– in lieu of summary line prefix: 

    [patch]

* bulk change for the keyword
* summary lines may be edited manually (not in bulk). 

Keyword descriptions and search interface: 

    <https://bugs.freebsd.org/bugzilla/describekeywords.cgi>
Comment 6 Mark Linimon freebsd_committer freebsd_triage 2024-02-08 03:44:38 UTC
^Triage: committed back in 2022.