[Rpm-maint] Logging rpm installation logs to file

viren.sharma at tcs.com viren.sharma at tcs.com
Mon Jan 7 13:01:57 UTC 2008


Hi Panu,

With the change you suggested the error is resolved but rpmtsSetScriptFd() 
is still not logging the data to file.

LogFile.txt is created but it is empty :-(


- - -
Virendra




Panu Matilainen <pmatilai at redhat.com> 
01/07/2008 05:18 PM

To
viren.sharma at tcs.com
cc
rpm-maint at lists.rpm.org
Subject
Re: [Rpm-maint] Logging rpm installation logs to file






On Mon, 7 Jan 2008, viren.sharma at tcs.com wrote:

> Hi Panu,
>
> I've tried redirecting output using rpmtsSetScriptFd()but it is not
> working.
>
> I've done something like this:
> ****************************************
>>     FILE *fdLogFile;
>>     fdLogFile = fopen("LogFile.txt", "w");
>>     if (fdLogFile == NULL)
>>     {
>>         printf("Unable to open file LogFile.txt");
>>         return RPM_FAILURE;
>>     }
>>
> ..
> ..
>> rpmtsSetScriptFd(ts, (FD_t)&fdLogFile);
> ..
> ..
>>     fclose(fdLogFile);
>
> ****************************************
>
> On running this I am getting the following error:
>
> testRpm: ./rpmio_internal.h:525: c2f: Assertion `fd && fd->magic ==
> 0x04463138' failed.
> Aborted

FD_t is not something you can just cast to FILE, it's rpm's own io subsys 
type. Try something like this instead:

FD_t fdLogFile;
fdLogFile = Fopen("LogFile.txt", "w.fdio");
if (fdLogFile == NULL)
    ...
rpmtsSetScriptFd(ts, fdLogFile);

Fopen() and the related rpmio functions can be found in rpmio.h.

                 - Panu -

ForwardSourceID:NT0000E746 
=====-----=====-----=====
Notice: The information contained in this e-mail
message and/or attachments to it may contain 
confidential or privileged information. If you are 
not the intended recipient, any dissemination, use, 
review, distribution, printing or copying of the 
information contained in this e-mail message 
and/or attachments to it are strictly prohibited. If 
you have received this communication in error, 
please notify us by reply e-mail or telephone and 
immediately and permanently delete the message 
and any attachments. Thank you


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.rpm.org/pipermail/rpm-maint/attachments/20080107/4883d202/attachment-0001.htm 


More information about the Rpm-maint mailing list