Bug 59851 - rpmInstallSourcePackage() API seg fault
rpmInstallSourcePackage() API seg fault
Product: Red Hat Linux
Classification: Retired
Component: rpm (Show other bugs)
i686 Linux
medium Severity medium
: ---
: ---
Assigned To: Jeff Johnson
Depends On:
  Show dependency treegraph
Reported: 2002-02-13 16:16 EST by Melissa Rickman
Modified: 2008-05-01 11:38 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2002-02-15 15:46:31 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Melissa Rickman 2002-02-13 16:16:35 EST
From Bugzilla Helper:
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)

Description of problem:
I have created a small C++ exe using the RPM API rpmInstallSourcePackage().  
However, when running the program it seg faults on rpmInstallSourcePackage(). 
It is seg. faulting on the function rpmInstallSourcePackage() in Fileno() 
from /usr/lib/librpmio. The debugger shows me that before it seg faults, the 
program will trace through the lib's rpmInstallSourcePackage(), queryArgCallback
(), rpmInstallSourcePackage(), rpmreadPackageHeader(),readPackageHeaders() and 
finally choke on some Fileno().

my usage of the function is as follows 
rpmInstallSourcePackage(rootDir, fd, specFilePtr,0,0,0) 
where rootDir is a const char * = "to/some/path" 
where fd = Fopen(argv[1]) 
where specFilePtr is a const char **="to/some/path" 
and I substitute null for the rest. 

My program is very simple and only calls two functions from the API.  The Fopen 
and rpmInstallSourcePackage().

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

How reproducible:

Steps to Reproduce:
1.run the program e.g.- # ./instllpkg /development/RPMS/i386/somepkg.rpm

Actual Results:  Segmentation fault in the function call in Fileno() 
from /usr/lib/librpmio 4.0.3.so

Expected Results:  The program should execute without segmentation faults, 
install package as specified and write output that it has installed package.

Additional info:

I'm not sure that this is a bug of rpm. Given my lack of knowledge to the rpm 
API I could be giving it bad params or giving it null when it is expecting a 
Comment 1 Jeff Johnson 2002-02-13 16:28:14 EST
If your program is small, can you attach here? I can probably
tell you what's up even though I'm not a C++ programmer.
Comment 2 Melissa Rickman 2002-02-14 16:40:41 EST
Jeff, I made some progress with my bug. I ended up using rpmInstall() vs. 
rpmInstallSource(). However, I now get another seg fault that says Error: no db 
path set.  The source is as follows.
#include <rpm/rpmlib.h>

void main()
const char * rootdir = "/development"
char * str[]={"/development/RPMS/i386/IM-0.1-1.i386.rpm"};
const char ** temp = const_cast<const char**>(str);
Comment 3 Jeff Johnson 2002-02-14 16:45:29 EST
All programs that link against rpmlib need to do
    if (rpmReadConfigFiles(rcfile, NULL))
early on.
Comment 4 Melissa Rickman 2002-02-14 19:31:39 EST
ok, something is weird with rpm and its files. My rpmrc file resides 
in /usr/lib. It's visible to ls and when I do rpm --showrc it shows the 
contents of that file.  However, when I use the command # more /usr/lib/rpmrc, 
it says no such file or dir.  This error also happens when I supply this file 
to rpmReadConfigFiles("/usr/lib/rpmrc", NULL).  Another weird thing is that I 
went to view /usr/include/rpmlib.h with the more command and it says that that 
file dn exist, but it does!  I must be doing something wrong????
Comment 5 Jeff Johnson 2002-02-15 15:46:26 EST
There may be a /usr/lib/rpmrc symlink, but the file(s)
you want/need are
and (possibly)
This is what is read by rpmReadConfigFiles(NULL, NULL);
(Yes, NULL will use defaults).
Comment 6 Jeff Johnson 2002-02-24 12:16:46 EST
If you need more help, please reopen this
bug. Meanwhile I'm gonna close.

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