NetBSD Problem Report #21265

Received: (qmail 24529 invoked by uid 605); 22 Apr 2003 21:17:25 -0000
Message-Id: <20030422211720.08A5611152@narn.netbsd.org>
Date: Tue, 22 Apr 2003 21:17:20 +0000 (UTC)
From: NOS@Utel.no
Sender: gnats-bugs-owner@netbsd.org
Reply-To: NOS@Utel.no
To: gnats-bugs@gnats.netbsd.org
Subject: rpcgen produces wrong code
X-Send-Pr-Version: www-1.0

>Number:         21265
>Category:       bin
>Synopsis:       rpcgen produces wrong code
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Apr 22 21:18:00 +0000 2003
>Closed-Date:    
>Last-Modified:  Mon Feb 28 14:59:49 +0000 2011
>Originator:     Nils O. Selåsdal
>Release:        1.6.1
>Organization:
>Environment:
NetBSD netbsd 1.6.1 NetBSD 1.6.1 (GENERIC) #0: Tue Apr  8 12:05:52 UTC 2003     autobuild@tgm.daemon.org:/autobuild/netbsd-1-6/i386/OBJ/autobuild/netbsd-1-6/src/sys/arch/i386/compile/GENERIC i386

>Description:
rpcgen seems to produce bad output for the server stub.
the server stub tries to call the function_version(..) but it should really
call function_version_svc(..). which in the headerfile generated from the .x file has the right prototype. function(..) is what the client is supposed to call.
>How-To-Repeat:

given a simple .x file like:
program H2VXWPROG
{
    version H2VXWVERS
    {
        int SENDSIGNAL(int)  = 1;
    } = 1;
} = 0x20406091;

  rpcgen   -h -o h2vxw.h h2vxw.x 
  the header file will tell that the signature for the server function should be:
  extern  int *sendsignal_1_svc(int *, struct svc_req *);

  rpcgen -m -o h2vxw_svc.c h2vxw.x
  for making the server stub will include "h2vxw.h"
  and do the following:
   case SENDSIGNAL:
                xdr_argument = xdr_int;
                xdr_result = xdr_int;
                local = (char *(*)())sendsignal_1;
  now, in the header file sendsignal_1 is declared as:
  extern  int *sendsignal_1(int *, CLIENT *);
  clearly wrong. it should call the
  extern  int *sendsignal_1_svc(int *, struct svc_req *);

>Fix:

>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: bin-bug-people->fvdl 
Responsible-Changed-By: perry 
Responsible-Changed-When: Wed Apr 23 23:29:42 UTC 2003 
Responsible-Changed-Why:  
Frank is the RPC guru. However, I find the bug report somewhat 
unbelievable -- if this is really wrong behavior, how do any of our 
programs that use rpc work at all? 

From: YAMAMOTO Takashi <yamt@mwd.biglobe.ne.jp>
To: NOS@Utel.no
Cc: gnats-bugs@gnats.netbsd.org, fvdl@netbsd.org
Subject: Re: bin/21265: rpcgen produces wrong code
Date: Wed, 07 May 2003 20:39:39 +0900

 hi,

 >   rpcgen   -h -o h2vxw.h h2vxw.x 
 >   the header file will tell that the signature for the server function should be:
 >   extern  int *sendsignal_1_svc(int *, struct svc_req *);
 > 
 >   rpcgen -m -o h2vxw_svc.c h2vxw.x

 i guess that you should do this with -C.

 although i agree that it's very confusing that our rpcgen generates
 the common header for ansi and pre-ansi while it actually generates
 functions with different names for them...

 YAMAMOTO Takashi

From: Aidan Cully <aidan@kublai.com>
To: gnats-bugs@gnats.netbsd.org
Cc:  
Subject: bin/21265: rpcgen produces wrong code
Date: Sun, 6 Jul 2003 06:21:28 -0400

 It appears that different function names are used for ANSI vs.
 old-style C, on the server.  This seems different from the intent...
 At any rate, this patch would change that.  Is that desirable?

 --aidan
 --- rpc_sample.c.orig	2003-07-06 06:06:23.000000000 -0400
 +++ rpc_sample.c	2003-07-06 06:06:41.000000000 -0400
 @@ -203,10 +203,7 @@
  				return_type(proc);
  				f_print(fout, "*\n");
  			}
 -			if (Cflag)
 -				pvname_svc(proc->proc_name, vp->vers_num);
 -			else
 -				pvname(proc->proc_name, vp->vers_num);
 +			pvname_svc(proc->proc_name, vp->vers_num);
  			printarglist(proc, "result", RQSTP, "struct svc_req *");

  			f_print(fout, "{\n");
 --- rpc_svcout.c.orig	2003-07-06 05:07:46.000000000 -0400
 +++ rpc_svcout.c	2003-07-06 05:08:23.000000000 -0400
 @@ -524,10 +524,7 @@

  			if (newstyle)	/* new style: calls internal routine */
  				f_print(fout, "_");
 -			if (Cflag)
 -				pvname_svc(proc->proc_name, vp->vers_num);
 -			else
 -				pvname(proc->proc_name, vp->vers_num);
 +			pvname_svc(proc->proc_name, vp->vers_num);
  			f_print(fout, ";\n");
  			f_print(fout, "\t\tbreak;\n\n");
  		}
Responsible-Changed-From-To: fvdl->bin-bug-people
Responsible-Changed-By: wiz@NetBSD.org
Responsible-Changed-When: Mon, 28 Feb 2011 14:59:49 +0000
Responsible-Changed-Why:
Reset responsible field for retired developer.


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.