Bug 1182949 - Don't complain when helptext is null
Summary: Don't complain when helptext is null
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: pcp
Version: 21
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Nathan Scott
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: 1185740
TreeView+ depends on / blocked
 
Reported: 2015-01-16 09:41 UTC by Stef Walter
Modified: 2015-02-20 20:41 UTC (History)
8 users (show)

Fixed In Version: pcp-3.10.2-2.el5
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-01-30 04:36:34 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Stef Walter 2015-01-16 09:41:17 UTC
Description of problem:

According to the documentation pmdaDSO can be called with a NULL helptext. However it seems that pcp then complains about this valid call. In general, the system shouldn't barf up warnings when everything is going as expected.

http://linux.die.net/man/3/pmdadso

/metrics/compression: [Fri Jan 16 10:37:30] pcp(9181) Warning: pmdaInit: PMDA mock-pmda: No help text file specified

Example call that causes the problem:

 pmdaDSO(dp, PMDA_INTERFACE_2, "mock-pmda", NULL);


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

pcp-3.10.1-1.fc21.x86_64

Comment 1 Nathan Scott 2015-01-20 23:22:26 UTC
Hi Stef,

Hmmm, I'm on the fence a bit - the warning comes from src/libpcp_pmda/src/open.c around line 650 or so...

    else {
        if (dispatch->version.two.text == pmdaText)
            __pmNotifyErr(LOG_WARNING, "pmdaInit: PMDA %s: No help text file specified", pmda->e_name);

So, it is trying to warn that the PMDA is using the default text callback (pmdaText - which makes use of the compiled help text files) but there's no path.

Perhaps the message could be a bit more expressive, and explicitly say that the pmdaText method relies on those files.

In your case, you can set the version.two.text callback to something else (a function that does the help text handling for your metrics), and the warning will go away.

cheers.

Comment 2 Stef Walter 2015-01-21 06:51:12 UTC
You should either change the API and documentation so that helptext is required (it's not right now) ... or not warn. Nobody wants to hear warnings about things that are actually allowed.

Comment 3 Nathan Scott 2015-01-21 22:43:16 UTC
Hi Stef,

The man page for pmdaDSO(3) sayeth:

       helptext       The default path to the help text (see pmdaText(3).   If
                      no  help  text  is installed, or you are not using pmda‐
                      Text(3), then this should be set to NULL.

... which is fairly clear I guess.  Were you looking at some other docs?  (maybe one of the books describes this differently?)

I'll update the library diagnostic to be clear about the rules around pmdaText, and mock-pmda could be tweaked to not use pmdaText(3) as per the extract from pmdaDSO(3) above.

cheers.

Comment 4 Stef Walter 2015-01-22 07:51:02 UTC
(In reply to Nathan Scott from comment #3)
> Hi Stef,
> 
> The man page for pmdaDSO(3) sayeth:
> 
>        helptext       The default path to the help text (see pmdaText(3).  
> If
>                       no  help  text  is installed, or you are not using
> pmda‐
>                       Text(3), then this should be set to NULL.
> 
> ... which is fairly clear I guess.  Were you looking at some other docs? 
> (maybe one of the books describes this differently?)

We are not using pdmaText. When we set helptext argument of pdmaDSO to NULL, then the warning is still issued. The above documentation that you excerpted says it should be set to NULL in this case. If so, no warning should be printed.

Comment 5 Nathan Scott 2015-01-22 08:30:08 UTC
> We are not using pdmaText.

Can you send a pointer to your PMDA code please?  It seems very like you are (perhaps unintentionally) using pmdaText, since the code does this...

    else {
        if (dispatch->version.two.text == pmdaText)
            __pmNotifyErr(LOG_WARNING, "pmdaInit: PMDA %s: No help text file specified for pmdaText", pmda->e_name);
#ifdef PCP_DEBUG
        else
            if (pmDebug & DBG_TRACE_LIBPMDA)
                __pmNotifyErr(LOG_DEBUG, "pmdaInit: PMDA %s: No help text path specified", pmda->e_name);
#endif
    }


IOW, the only way this warning is printed is if you have requested debugging explicitly (unlikely) or you are using pmdaText.

thanks!

Comment 7 Nathan Scott 2015-01-23 06:45:44 UTC
Ah, thanks Stef.  OK - see notes below - we are indeed defaulting to pmdaText here, the new super-helpful diagnostic extension is working, and there's a little patch below and example dbpmda(1) session that shows how to make the mock pmda quieten down (for all versions of libpcp_pmda).

[Not sure how you guys use your mock_control() for testing?  but, you might find the pmStore(3) interface, with a mock_store() callback of your own, helpful for making internal state changes within the PMDA while testing.  Maybe not, just thought I'd mention it anyway]


mock$ dbpmda 
dbpmda> open dso mock.so mock_init
[Fri Jan 23 17:31:05] dbpmda(10868) Warning: pmdaInit: PMDA mock-pmda: No help text file specified for pmdaText
dbpmda> quit
mock$ make
gcc -fPIC -fno-strict-aliasing -D_GNU_SOURCE -fstack-protector-all -D_FORTIFY_SOURCE=2  -Wall -g -DPCP_DEBUG -DPCP_VERSION=\"3.10.2\" -I../../../src/include -I../../../src/include/pcp   -c -o mock-pmda.o mock-pmda.c
gcc  -Wall -L../../../src/libpcp/src -L../../../src/libpcp_pmda/src -L../../../src/libpcp/src -L../../../src/libpcp_pmda/src -shared -Wl,-soname,mock.so -o mock.so  mock-pmda.o     -lpcp_pmda -lpcp   -ldl 
$ dbpmda 
dbpmda> open dso mock.so mock_init
dbpmda> quit
mock$ diff -Naurp mock-pmda.c.orig mock-pmda.c
--- mock-pmda.c.orig	2015-01-23 17:36:10.209629716 +1100
+++ mock-pmda.c	2015-01-23 17:34:01.767508675 +1100
@@ -122,6 +122,12 @@ mock_fetchCallBack(pmdaMetric *mdesc, un
   return 0;
 }
 
+static int
+mock_text(int ident, int type, char **buffer, pmdaExt *ep)
+{
+    return PM_ERR_TEXT;
+}
+
 void
 mock_control (const char *cmd, ...)
 {
@@ -178,6 +184,7 @@ mock_init(pmdaInterface *dp)
   if (dp->status != 0)
     return;
 
+  dp->version.any.text = mock_text;
   pmdaSetFetchCallBack(dp, mock_fetchCallBack);
   pmdaInit(dp,
            indomtab, sizeof(indomtab)/sizeof(indomtab[0]),

Comment 8 Fedora Update System 2015-01-26 16:24:41 UTC
pcp-3.10.2-1.fc21 has been submitted as an update for Fedora 21.
https://admin.fedoraproject.org/updates/pcp-3.10.2-1.fc21

Comment 9 Fedora Update System 2015-01-26 16:25:55 UTC
pcp-3.10.2-1.fc20 has been submitted as an update for Fedora 20.
https://admin.fedoraproject.org/updates/pcp-3.10.2-1.fc20

Comment 10 Fedora Update System 2015-01-26 17:09:50 UTC
pcp-3.10.2-1.el5 has been submitted as an update for Fedora EPEL 5.
https://admin.fedoraproject.org/updates/pcp-3.10.2-1.el5

Comment 11 Fedora Update System 2015-01-27 02:57:41 UTC
Package pcp-3.10.2-1.fc21:
* should fix your issue,
* was pushed to the Fedora 21 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing pcp-3.10.2-1.fc21'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2015-1199/pcp-3.10.2-1.fc21
then log in and leave karma (feedback).

Comment 12 Fedora Update System 2015-01-30 04:36:34 UTC
pcp-3.10.2-1.fc21 has been pushed to the Fedora 21 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 13 Fedora Update System 2015-02-04 08:00:15 UTC
pcp-3.10.2-1.fc20 has been pushed to the Fedora 20 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 14 Fedora Update System 2015-02-04 21:31:08 UTC
pcp-3.10.2-2.el5 has been submitted as an update for Fedora EPEL 5.
https://admin.fedoraproject.org/updates/pcp-3.10.2-2.el5

Comment 15 Fedora Update System 2015-02-20 20:41:46 UTC
pcp-3.10.2-2.el5 has been pushed to the Fedora EPEL 5 stable repository.  If problems still persist, please make note of it in this bug report.


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