Bug 151844

Summary: dc handles input base confusingly
Product: [Fedora] Fedora Reporter: Paul Bolle <pebolle>
Component: bcAssignee: Zdenek Prikryl <zprikryl>
Status: CLOSED RAWHIDE QA Contact:
Severity: low Docs Contact:
Priority: medium    
Version: 3CC: mattdm
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2007-07-26 14:15:32 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
patch to let dc handle numbers outside the input base sanely none

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):
bc-1.06-17.1

How reproducible:
always

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

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
1123455

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.