Bug 188247 - [rpc] [patch] include/rpcsvc/yp_prot.h: remove typedef of bool.
Summary: [rpc] [patch] include/rpcsvc/yp_prot.h: remove typedef of bool.
Status: Open
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: 10.0-RELEASE
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-bugs (Nobody)
URL:
Keywords: patch
Depends on:
Blocks:
 
Reported: 2014-04-04 02:20 UTC by Yasuhiro Kimura
Modified: 2022-10-17 12:35 UTC (History)
2 users (show)

See Also:


Attachments
patch-src_include_rpcsvc_yp_prot.h (442 bytes, text/plain)
2014-04-04 02:20 UTC, Yasuhiro Kimura
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Yasuhiro Kimura freebsd_committer freebsd_triage 2014-04-04 02:20:00 UTC
	
	There have been typedef of bool in rpcsvc/yp_prot.h since it
	is added to source tree in August 1994. But there is also
	definition of bool in stdbool.h, and they conflict when both
	headers are used. An acutual example of conflict is building
	Zsh on NIS client of 10.x or later. It is already repoted as
	following PR.

	ports/183253: [PATCH] shells/zsh: fail to build on 10.0-BETA1
	http://www.freebsd.org/cgi/query-pr.cgi?pr=ports/183253

	While stdbool.h and bool definition in it are requirement of
	C99 standard, it seems bool typedef in ryp_prot.h is not
	necessarily required. So removing the latter is a solution.

	There are some reasons that removing bool typedef from
	yp_prot.h doesn't seems to cause problem.

	* Building and installing FreeBSD seems to work fine without
          it. I applied attached patch to 8.4-RELEASE, 9.2-RELEASE and
          10.0-RELEASE source tree and tried regular rebuilding steps
          described in /usr/src/Makefile. All rebuild succeeded
          without error, and all of reinstalled systems seems to work
          fine.
	* NetBSD have already removed it in October 2007, and since
          then they have been done well.
Comment 1 Bruce Evans freebsd_committer freebsd_triage 2014-04-04 08:57:41 UTC
On Fri, 4 Apr 2014, Yasuhiro KIMURA wrote:

>> Description:
>
> 	There have been typedef of bool in rpcsvc/yp_prot.h since it
> 	is added to source tree in August 1994. But there is also
> 	definition of bool in stdbool.h, and they conflict when both
> 	headers are used. An acutual example of conflict is building
> 	Zsh on NIS client of 10.x or later. It is already repoted as
> 	following PR.
>
> 	ports/183253: [PATCH] shells/zsh: fail to build on 10.0-BETA1
> 	http://www.freebsd.org/cgi/query-pr.cgi?pr=ports/183253
>
> 	While stdbool.h and bool definition in it are requirement of
> 	C99 standard, it seems bool typedef in ryp_prot.h is not
> 	necessarily required. So removing the latter is a solution.

rpc seems to have been only partly converted from using bool to using
bool_t.

> 	There are some reasons that removing bool typedef from
> 	yp_prot.h doesn't seems to cause problem.

Many places still use bool.  E.g.:

    rpc/rpcb_prot.x
    rpcsvc/klm_prot.x
    rpcsvc/nfx_prot.x
    rpcsvc/nis.x
    rpcsvc/nis_callback.x
    rpcsvc/nlm_prot.x
    rpcsvc/rquota.x
    rpcsvc/yp.x
    rpcsvc/ypprot.h (this definition)
    rpcsvc/ypxfrd.x

None of these places include stdbool.h, and neither does your patch, so
it is unclear how anything works.

> 	* Building and installing FreeBSD seems to work fine without
>          it. I applied attached patch to 8.4-RELEASE, 9.2-RELEASE and
>          10.0-RELEASE source tree and tried regular rebuilding steps
>          described in /usr/src/Makefile. All rebuild succeeded
>          without error, and all of reinstalled systems seems to work
>          fine.
> 	* NetBSD have already removed it in October 2007, and since
>          then they have been done well.
>
> --- patch-src_include_rpcsvc_yp_prot.h begins here ---
> Index: include/rpcsvc/yp_prot.h
> ===================================================================
> --- include/rpcsvc/yp_prot.h	(revision 260673)
> +++ include/rpcsvc/yp_prot.h	(working copy)
> @@ -67,11 +67,6 @@
>  * YPPROC_MAPLIST	takes (char *), returns (struct ypmaplist *).
>  */
>
> -#ifndef BOOL_DEFINED
> -typedef u_int bool;
> -#define BOOL_DEFINED
> -#endif
> -
> /* Program and version symbols, magic numbers */
>
> #define YPPROG		((u_long)100004)
> --- patch-src_include_rpcsvc_yp_prot.h ends here ---

Including stdbool.h should work in most cases, but the standard bool
can be almost anything.  It might have a different size.  Then there
might be ABI breakage from using it.  The fake version in stdbool.h
for compilers that don't support it has type int.  This has the same
size, but different signedness.

Bruce
Comment 2 Pavel Timofeev 2015-03-04 14:49:46 UTC
I'm interested in this PR, because squid's NIS auth helper can't be built normally until this PR isn't solved.
Comment 3 Eitan Adler freebsd_committer freebsd_triage 2018-05-20 23:50:51 UTC
For bugs matching the following conditions:
- Status == In Progress
- Assignee == "bugs@FreeBSD.org"
- Last Modified Year <= 2017

Do
- Set Status to "Open"
Comment 4 Graham Perrin freebsd_committer freebsd_triage 2022-10-17 12:35:58 UTC
Keyword: 

    patch
or  patch-ready

– in lieu of summary line prefix: 

    [patch]

* bulk change for the keyword
* summary lines may be edited manually (not in bulk). 

Keyword descriptions and search interface: 

    <https://bugs.freebsd.org/bugzilla/describekeywords.cgi>