Bug 151844 - dc handles input base confusingly
Summary: dc handles input base confusingly
Alias: None
Product: Fedora
Classification: Fedora
Component: bc (Show other bugs)
(Show other bugs)
Version: 3
Hardware: All Linux
Target Milestone: ---
Assignee: Zdenek Prikryl
QA Contact:
Depends On:
TreeView+ depends on / blocked
Reported: 2005-03-22 20:31 UTC by Paul Bolle
Modified: 2007-11-30 22:11 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2007-07-26 14:15:32 UTC
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
patch to let dc handle numbers outside the input base sanely (1.02 KB, patch)
2005-03-22 20:31 UTC, Paul Bolle
no flags Details | Diff

Description Paul Bolle 2005-03-22 20:31:03 UTC
Description of problem:
dc accepts the inputn of numbers outside the "input base". This rather
confusing. That makes it hard to see this as a feature and not as a bug.

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1.  echo "10 i ABCDEF p"|dc
Actual results:

Expected results:
dc should ignore numbers ouside the input base and print some sort of error
message instead.

Additional info:
dc mixes 10 base and 16 base in the above example, as the next command (with
identical result as the above command) shows:
echo "10 i 10 100000 * 11 10000 * + 12 1000 * + 13 100 * + 14 10 * + 15 + p"|dc

Other - even more confusing - examples can be added easily but I hope the above
is clear enough.

I'll try to attach a patch for a quick solution. (I do realize dc seems to be
basically umaintained as there hasn't been any change to the code in years.
Still, I guess fixing this confusing behaviour could be useful ...)

Comment 1 Paul Bolle 2005-03-22 20:31:03 UTC
Created attachment 112229 [details]
patch to let dc handle numbers outside the input base sanely

Comment 2 Paul Bolle 2005-03-23 00:41:41 UTC
Comment on attachment 112229 [details]
patch to let dc handle numbers outside the input base sanely

Please disregard the patch. It only (sort of) works if a number starts with a
digit outside of the input base. I'll have to try again ...

Comment 3 Matthew Miller 2006-07-10 23:41:34 UTC
Fedora Core 3 is now maintained by the Fedora Legacy project for security
updates only. If this problem is a security issue, please reopen and
reassign to the Fedora Legacy product. If it is not a security issue and
hasn't been resolved in the current FC5 updates or in the FC6 test
release, reopen and change the version to match.

Thank you!

Comment 4 Zdenek Prikryl 2007-07-26 14:15:32 UTC
Now dc accepts the input which contains wrong symbols of radix in same way like bc.

Note You need to log in before you can comment on or make changes to this bug.