On Wed, Aug 30, 2006 at 06:35:21PM +0200, Corinna Vinschen wrote:
> Cygwin 1.5.21, OpenSSL 0.9.8b


Thanks for testing.

[...]
> Actually, OpenSSH didn't use Cygwin's glob() implementation before
> (which is a relatively old NetBSD derived implementation), because the
> configure test for gl_matchc failed up to 4.3p2. The AC_EGREP_CPP
> autoconf test failed, while the new AC_TRY_COMPILE test in 4.4p1 now
> works, so starting with 4.4p1, OpenSSH uses Cygwin's glob function.
>
> But why does it core dump? The reason is that the old glob implementation
> in Cygwin doesn't know about the GLOB_NOMATCH return code. In case there's
> no match, it returns 0, with gl_matchc set to 0 and gl_pathv set to NULL.


I'm wondering if we should test for GLOB_NOMATCH in configure and use
the glob in openbsd-compat if it's not found. This would avoid having
to carry additional diffs in -portable.

Index: configure.ac
================================================== =================
RCS file: /usr/local/src/security/openssh/cvs/openssh_cvs/configure.ac,v
retrieving revision 1.356
diff -u -p -r1.356 configure.ac
--- configure.ac 30 Aug 2006 17:24:41 -0000 1.356
+++ configure.ac 1 Sep 2006 00:59:14 -0000
@@ -982,6 +982,8 @@ AC_TRY_COMPILE(
]
)

+AC_CHECK_DECLS(GLOB_NOMATCH, , , [#include ])
+
AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
AC_RUN_IFELSE(
[AC_LANG_SOURCE([[
Index: openbsd-compat/glob.c
================================================== =================
RCS file: /usr/local/src/security/openssh/cvs/openssh_cvs/openbsd-compat/glob.c,v
retrieving revision 1.22
diff -u -p -r1.22 glob.c
--- openbsd-compat/glob.c 6 Aug 2006 11:25:25 -0000 1.22
+++ openbsd-compat/glob.c 1 Sep 2006 00:59:14 -0000
@@ -47,7 +47,8 @@
#include

#if !defined(HAVE_GLOB) || !defined(GLOB_HAS_ALTDIRFUNC) || \
- !defined(GLOB_HAS_GL_MATCHC)
+ !defined(GLOB_HAS_GL_MATCHC) || \
+ !defined(HAVE_DECL_GLOB_NOMATCH) || HAVE_DECL_GLOB_NOMATCH == 0

static long
get_arg_max(void)
Index: openbsd-compat/glob.h
================================================== =================
RCS file: /usr/local/src/security/openssh/cvs/openssh_cvs/openbsd-compat/glob.h,v
retrieving revision 1.8
diff -u -p -r1.8 glob.h
--- openbsd-compat/glob.h 10 Nov 2005 06:03:23 -0000 1.8
+++ openbsd-compat/glob.h 1 Sep 2006 00:59:14 -0000
@@ -38,7 +38,8 @@
/* OPENBSD ORIGINAL: include/glob.h */

#if !defined(HAVE_GLOB_H) || !defined(GLOB_HAS_ALTDIRFUNC) || \
- !defined(GLOB_HAS_GL_MATCHC)
+ !defined(GLOB_HAS_GL_MATCHC) || \
+ !defined(HAVE_DECL_GLOB_NOMATCH) || HAVE_DECL_GLOB_NOMATCH == 0

#ifndef _GLOB_H_
#define _GLOB_H_

--
Darren Tucker (dtucker at zip.com.au)
GPG key 8FF4FA69 / D9A3 86E9 7EEE AF4B B2D4 37C9 C982 80C7 8FF4 FA69
Good judgement comes with experience. Unfortunately, the experience
usually comes from bad judgement.
_______________________________________________
openssh-unix-dev mailing list
openssh-unix-dev@mindrot.org
http://lists.mindrot.org/mailman/lis...enssh-unix-dev