public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: Ramsay Jones <ramsay@ramsayjones•plus.com>
To: "Torsten Bögershausen" <tboegi@web•de>, "Jeff King" <peff@peff•net>
Cc: Junio C Hamano <gitster@pobox•com>,
	git@vger•kernel.org, adam@dinwoodie•org
Subject: Re: Compiler warning under cygwin/mingw
Date: Thu, 3 Mar 2016 03:33:19 +0000	[thread overview]
Message-ID: <56D7B07F.4010001@ramsayjones.plus.com> (raw)
In-Reply-To: <56D43A61.3090503@ramsayjones.plus.com>

[-- Attachment #1: Type: text/plain, Size: 3377 bytes --]



On 29/02/16 12:32, Ramsay Jones wrote:
> 
> 
> On 29/02/16 10:40, Torsten Bögershausen wrote:
>> That compiles OK, thanks.
>>
>>
>> Sorry for high-jacking this thread, but while compiling under CYGWIN,
>> found one warning:
>>
>>    LINK git-credential-store.exe
>>     CC daemon.o
>> daemon.c: In function ‘drop_privileges’:
>> daemon.c:1136:15: warning: implicit declaration of function ‘initgroups’ [-Wimplicit-function-declaration]
>>   if (cred && (initgroups(cred->pass->pw_name, cred->gid) ||
> 
> Yeah, this has been there for a while - except it depends on which version
> of the header files you have. (Some may not see the warning).
> 
> I have 'fixed' this twice before, then updated my installation and
> a change to the system headers broke it again! (The headers are
> currently 'broken'). So, I got tired of fixing it up and have left
> it a while - you never know a new update may fix it! ;-)
> 
> [I personally don't use the git daemon on cygwin, so I don't know
> if this a problem in practice.]

BTW, I forgot to mention that I have had a patch in my local repo for
ages which addresses this issue. However, although this patch fixes
the problem for me, with the header files I currently have installed, it
would just as easily _introduce_ this warning for those that don't
currently see it! ;-)

I suppose that I could send a patch which sets NO_INITGROUPS in the
Makefile, until the system header files are fixed. What do you think?

The correct solution is to fix the <grp.h> header file. I have been
a bit reluctant to tackle that, because I'm not familiar with the
cygwin project development process. Since Newlib is an upstream
project to cygwin, should I go there first/instead?

Anyway, I had a quick squint at the header and I think it needs to
be changed something like the diff below. (I've also attached the
new grp.h file).

[Note: I didn't know what to do about _PATH_GROUP, setgrfile(),
group_from_gid() and setgroupent(), so I punted on those!]

Now, If only we knew someone who could try introducing such a fix
to the cygwin project ...

ATB,
Ramsay Jones
-- >8 --
diff --git a/usr/include/grp.h b/grp.h
index c3a5a67..f2f1902 100644
--- a/usr/include/grp.h
+++ b/grp.h
@@ -67,25 +67,27 @@ extern "C" {
 #ifndef __INSIDE_CYGWIN__
 struct group	*getgrgid (gid_t);
 struct group	*getgrnam (const char *);
+#if defined __POSIX_VISIBLE || defined __BSD_VISIBLE
 int		 getgrnam_r (const char *, struct group *,
 			char *, size_t, struct group **);
 int		 getgrgid_r (gid_t, struct group *,
 			char *, size_t, struct group **);
-#ifndef _POSIX_SOURCE
-struct group	*getgrent (void);
+#endif
+#if defined __BSD_VISIBLE || defined _XOPEN_SOURCE_EXTENDED
 void		 setgrent (void);
+#if __XSI_VISIBLE >= 700
+struct group	*getgrent (void);
 void		 endgrent (void);
+#endif
+#endif
+#if defined __BSD_VISIBLE
+int		 initgroups (const char *, gid_t);
+#endif
 #ifndef __CYGWIN__
-void		 setgrfile (const char *);
-#endif /* !__CYGWIN__ */
-#ifndef _XOPEN_SOURCE
-#ifndef __CYGWIN__
+void		 setgrfile (const char *); /* 4.3BSD-Reno & Minix */
 char		*group_from_gid (gid_t, int);
-int		 setgroupent (int);
+int		 setgroupent (int); /* 4.3BSD-Reno & Mac OS X */
 #endif /* !__CYGWIN__ */
-int		 initgroups (const char *, gid_t);
-#endif /* !_XOPEN_SOURCE */
-#endif /* !_POSIX_SOURCE */
 #endif /* !__INSIDE_CYGWIN__ */
 
 #ifdef __cplusplus

[-- Attachment #2: grp.h --]
[-- Type: text/x-chdr, Size: 3511 bytes --]

/*	$NetBSD: grp.h,v 1.7 1995/04/29 05:30:40 cgd Exp $	*/

/*-
 * Copyright (c) 1989, 1993
 *	The Regents of the University of California.  All rights reserved.
 * (c) UNIX System Laboratories, Inc.
 * All or some portions of this file are derived from material licensed
 * to the University of California by American Telephone and Telegraph
 * Co. or Unix System Laboratories, Inc. and are reproduced herein with
 * the permission of UNIX System Laboratories, Inc.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 * 3. All advertising materials mentioning features or use of this software
 *    must display the following acknowledgement:
 *	This product includes software developed by the University of
 *	California, Berkeley and its contributors.
 * 4. Neither the name of the University nor the names of its contributors
 *    may be used to endorse or promote products derived from this software
 *    without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 *
 *	@(#)grp.h	8.2 (Berkeley) 1/21/94
 */

#ifndef _GRP_H_
#define	_GRP_H_

#include <sys/cdefs.h>
#include <sys/types.h>
#ifdef __CYGWIN__
#include <cygwin/grp.h>
#endif

#if !defined(_POSIX_SOURCE) && !defined(_XOPEN_SOURCE)
#define	_PATH_GROUP		"/etc/group"
#endif

struct group {
	char	*gr_name;		/* group name */
	char	*gr_passwd;		/* group password */
	gid_t	gr_gid;			/* group id */
	char	**gr_mem;		/* group members */
};

#ifdef __cplusplus
extern "C" {
#endif

#ifndef __INSIDE_CYGWIN__
struct group	*getgrgid (gid_t);
struct group	*getgrnam (const char *);
#if defined __POSIX_VISIBLE || defined __BSD_VISIBLE
int		 getgrnam_r (const char *, struct group *,
			char *, size_t, struct group **);
int		 getgrgid_r (gid_t, struct group *,
			char *, size_t, struct group **);
#endif
#if defined __BSD_VISIBLE || defined _XOPEN_SOURCE_EXTENDED
void		 setgrent (void);
#if __XSI_VISIBLE >= 700
struct group	*getgrent (void);
void		 endgrent (void);
#endif
#endif
#if defined __BSD_VISIBLE
int		 initgroups (const char *, gid_t);
#endif
#ifndef __CYGWIN__
void		 setgrfile (const char *); /* 4.3BSD-Reno & Minix */
char		*group_from_gid (gid_t, int);
int		 setgroupent (int); /* 4.3BSD-Reno & Mac OS X */
#endif /* !__CYGWIN__ */
#endif /* !__INSIDE_CYGWIN__ */

#ifdef __cplusplus
}
#endif

#endif /* !_GRP_H_ */

  reply	other threads:[~2016-03-03  3:33 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-29  6:30 50a6c8ef - xmalloc_array Torsten Bögershausen
2016-02-29  9:28 ` [PATCH] compat/mingw: brown paper bag fix for 50a6c8e Jeff King
2016-02-29  9:56   ` Torsten Bögershausen
2016-02-29 10:02     ` Jeff King
2016-02-29 10:40       ` Compiler warning under cygwin/mingw (was: fix for 50a6c8e) Torsten Bögershausen
2016-02-29 10:47         ` Jeff King
2016-02-29 14:05           ` SZEDER Gábor
2016-04-12 23:20             ` Compiler warning under cygwin/mingw Junio C Hamano
2016-05-10 18:29             ` [PATCH 0/6] modernize t1500 Junio C Hamano
2016-02-29 12:32         ` Compiler warning under cygwin/mingw Ramsay Jones
2016-03-03  3:33           ` Ramsay Jones [this message]
2016-03-03  5:25             ` Ramsay Jones
2016-02-29 19:10       ` [PATCH] compat/mingw: brown paper bag fix for 50a6c8e Junio C Hamano
2016-02-29 21:36         ` Jeff King
2016-03-01  5:49           ` Torsten Bögershausen
2016-03-01  5:54             ` Jeff King
2016-03-01 13:52               ` Johannes Schindelin
2016-02-29 13:01   ` Johannes Schindelin
  -- strict thread matches above, loose matches on Subject: below --
2016-05-10  5:20 [PATCH 0/6] modernize t1500 Eric Sunshine
2016-05-10  5:20 ` [PATCH 1/6] t1500: test_rev_parse: facilitate future test enhancements Eric Sunshine
2016-05-10  5:20 ` [PATCH 2/6] t1500: reduce dependence upon global state Eric Sunshine
2016-05-10  5:20 ` [PATCH 3/6] t1500: avoid changing working directory outside of tests Eric Sunshine
2016-05-10  5:20 ` [PATCH 4/6] t1500: avoid setting configuration options " Eric Sunshine
2016-05-10  6:34   ` Eric Sunshine
2016-05-10 18:02     ` Junio C Hamano
2016-05-10  5:20 ` [PATCH 5/6] t1500: avoid setting environment variables " Eric Sunshine
2016-05-10 18:39   ` Jeff King
2016-05-10 19:12     ` Eric Sunshine
2016-05-10 19:19       ` Junio C Hamano
2016-05-10 19:48       ` Eric Sunshine
2016-05-10 19:59         ` Eric Sunshine
2016-05-10 20:41           ` Jeff King
2016-05-10 20:07         ` Junio C Hamano
2016-05-10 21:01         ` SZEDER Gábor
2016-05-10 21:11           ` Junio C Hamano
2016-05-10 21:19             ` Eric Sunshine
2016-05-10  5:20 ` [PATCH 6/6] t1500: be considerate to future potential tests Eric Sunshine
2016-05-10  6:07 ` [PATCH 0/6] modernize t1500 Junio C Hamano
2016-05-10 18:10   ` Junio C Hamano
2016-05-10 18:26     ` Junio C Hamano
2016-05-16 17:39       ` Eric Sunshine
2016-05-16 18:52         ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=56D7B07F.4010001@ramsayjones.plus.com \
    --to=ramsay@ramsayjones$(echo .)plus.com \
    --cc=adam@dinwoodie$(echo .)org \
    --cc=git@vger$(echo .)kernel.org \
    --cc=gitster@pobox$(echo .)com \
    --cc=peff@peff$(echo .)net \
    --cc=tboegi@web$(echo .)de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox