db plug in for ca client returns incomplete channel name from ca_name(chid)

Bug #541209 reported by Jeff Hill
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
EPICS Base
Fix Released
Medium
Jeff Hill

Bug Description

From John Sinclair:

Is the following a bug or a feature?

The following code behaves differently depending where it is run.

As a stand-alone application, it runs correctly.

When it runs as a thread on a soft IOC, it does not. A comment below
listed as "HERE'S THE PROBLEM" indicates the incorrect behavior.

====================================
This block simply creates a thread
====================================

static char g_arg1[255+1], g_arg2[255+1], g_arg3[255+1];

long epicsShareAPI func(
  char *arg1,
  char *arg2,
  char *arg3
) {

epicsThreadId id;

  strncpy( g_arg1, arg1, 255 );
  g_arg1[255] = 0;

  strncpy( g_arg2, arg2, 255 );
  g_arg2[255] = 0;

  strncpy( g_arg3, arg3, 255 );
  g_arg3[255] = 0;

  id = epicsThreadCreate( "A Thread",
   epicsThreadPriorityLow,
   epicsThreadGetStackSize( epicsThreadStackMedium ),
   aThread, NULL );

  return 0;

}

====================================
Here's the thread
====================================

static void aThread (
  void *arg
) {

int stat;
chid id;

enum ca_preemptive_callback_select {
  ca_disable_preemptive_callback,
  ca_enable_preemptive_callback
};

    stat = ca_context_create ( ca_enable_preemptive_callback );

    stat = ca_search( "pv.LOLO", &id );
    if ( stat != ECA_NORMAL ) {
      printf( "ca_search failed\\n" );
      goto err_return;
    }
    stat = ca_pend_io( 5.0 );
    if ( stat != ECA_NORMAL ) {
      printf( "ca_pend_io failed\\n" );
      goto err_return;
    }

    ====================================
    HERE'S THE PROBLEM
    ====================================

    printf( "Name is [%s]\\n", ca_name(id) );

    ====================================
    ca_name returns "pv" instead of "pv.LOLO"
    ====================================

    ====================================
    However, id is correct. It does map to pv.LOLO.
    (This conclusion is based on other code)
    ====================================

    return;

err_return:

    printf( "Error\\n" );

}

========================================================================

Original Mantis Bug: mantis-148
    http://www.aps.anl.gov/epics/mantis/view_bug_page.php?f_id=148

Tags: ca 3.14
Revision history for this message
Jeff Hill (johill-lanl) wrote :

fixed in R3.14.7

Revision history for this message
Andrew Johnson (anj) wrote :

R3.14.7 Released

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.