Bug 82191 - broken source code
broken source code
Status: CLOSED WORKSFORME
Product: Red Hat Linux
Classification: Retired
Component: rpm (Show other bugs)
8.0
All Linux
medium Severity medium
: ---
: ---
Assigned To: Jeff Johnson
Mike McLean
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2003-01-19 05:41 EST by d.binderman
Modified: 2007-04-18 12:50 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2003-01-21 08:20:02 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description d.binderman 2003-01-19 05:41:23 EST
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 10:40:34 EST
Same code compiles w/o warning using gcc-3.2.1.
Comment 2 d.binderman 2003-01-20 13:57:49 EST
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 14:02:55 EST
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 14:27:20 EST
>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 08:20:02 EST
Please send patch to sleepycat.


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