Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.

Bug 82191

Summary: broken source code
Product: [Retired] Red Hat Linux Reporter: d.binderman
Component: rpmAssignee: Jeff Johnson <jbj>
Status: CLOSED WORKSFORME QA Contact: Mike McLean <mikem>
Severity: medium Docs Contact:
Priority: medium    
Version: 8.0   
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: 2003-01-21 13:20:02 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description d.binderman 2003-01-19 10:41:23 UTC
From Bugzilla Helper:
User-Agent: Mozilla/4.6 [en-gb]C-CCK-MCD NetscapeOnline.co.uk  (Win98; I)

Description of problem:

Hello there,

I just tried to compile package rpm-4.1-1.06 from Redhat 8.0

The compiler said

../db/db_load/db_load.c:810: warning: operation on `instr' may be undefined

Here is an untested patch to shut up the compiler.

*** ./db/db_load/db_load.c.old	2003-01-18 14:36:07.000000000 +0000
--- ./db/db_load/db_load.c	2003-01-18 14:36:32.000000000 +0000
***************
*** 806,813 ****
  				*outstr++ = '\\';
  				continue;
  			}
! 			c = digitize(dbenv, *instr, &e1) << 4 |
! 			    digitize(dbenv, *++instr, &e2);
  			if (e1 || e2) {
  				badend(dbenv);
  				return (EINVAL);
--- 806,814 ----
  				*outstr++ = '\\';
  				continue;
  			}
! 			c = digitize(dbenv, instr[ 0], &e1) << 4 |
! 			    digitize(dbenv, instr[ 1], &e2);
! 			++instr;
  			if (e1 || e2) {
  				badend(dbenv);
  				return (EINVAL);

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


How reproducible:
Always

Steps to Reproduce:
1. compile the program
2.
3.
    

Additional info

Comment 1 Jeff Johnson 2003-01-20 15:40:34 UTC
Same code compiles w/o warning using gcc-3.2.1.

Comment 2 d.binderman 2003-01-20 18:57:49 UTC
try compiling with C compiler flags "-g -O2 -Wall".

Then you should see the problem.

You appear to have not read the source code I pointed out.
It is clearly wrong, merely by inspection.



Comment 3 Jeff Johnson 2003-01-20 19:02:55 UTC
I *did* compile with -Wall, and several other checks,
but am almost certainly using a different compiler.

Yes, the source code looks "fishy", but that's a
Berkeley DB problem, not an rpm problem. I choose
to stay as close as possible to pristine  Berkeley DB.

Comment 4 d.binderman 2003-01-20 19:27:20 UTC
>I *did* compile with -Wall, and several other checks,
>but am almost certainly using a different compiler.

You may have compiled with -Wall, but you didn't use 3.2.1
as well.

Try using 3.2.1 *and* "-g -O2 -Wall" to reproduce my bug report.

>Yes, the source code looks "fishy", but that's a
>Berkeley DB problem, not an rpm problem. I choose
>to stay as close as possible to pristine  Berkeley DB.

What you describe as "fishy" is undefined code. I strongly
recommend reading section 2.12 of K&R 2. Page 52 in my copy.

You might stay as close as you like to Berkeley, but it's
still undefined code.

I've provided a patch. Just what else do I have to do to get 
you to fix this bug ?


Comment 5 Jeff Johnson 2003-01-21 13:20:02 UTC
Please send patch to sleepycat.