Bug 151844 - dc handles input base confusingly
dc handles input base confusingly
Product: Fedora
Classification: Fedora
Component: bc (Show other bugs)
All Linux
medium Severity low
: ---
: ---
Assigned To: Zdenek Prikryl
Depends On:
  Show dependency treegraph
Reported: 2005-03-22 15:31 EST by Paul Bolle
Modified: 2007-11-30 17:11 EST (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2007-07-26 10:15:32 EDT
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 15:31 EST, Paul Bolle
no flags Details | Diff

  None (edit)
Description Paul Bolle 2005-03-22 15:31:03 EST
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 15:31:03 EST
Created attachment 112229 [details]
patch to let dc handle numbers outside the input base sanely
Comment 2 Paul Bolle 2005-03-22 19:41:41 EST
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 19:41:34 EDT
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 10:15:32 EDT
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.