bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Incompatible module license.


From: Bruno Haible
Subject: Re: Incompatible module license.
Date: Wed, 26 Dec 2007 16:30:03 +0100
User-agent: KMail/1.5.4

Hi Jim,

I haven't seen progress on this topic for a week, so permit me to jump in.

> FYI, it happened two months ago, with this change:
> 
>     http://git.sv.gnu.org/gitweb/?p=gnulib.git;a=commitdiff;h=12a195113bbb3
> 
> 2007-10-17  Paul Eggert  <address@hidden>
> 
>       Modify glob.c to use fstatat and dirfd, to simplify it.
>       Suggested by Eric Blake.
>       * lib/glob.c (__fxstatat64) [!_LIBC]: New macro.
>       Don't include <stdbool.h>; not used.
>       (link_exists2_p, glob_in_dir) [!_LIBC]: No longer a special case.
>       (link_exists_p): Simplify implementation, since we can now assume
>       dirfd and fstatat.
>       * modules/glob (Depends-on): Add dirfd, openat.  Remove stdbool.

Yes, confirmed.

> It'd be a shame to revert such a change, just to keep the license
> the same.  Yet, I'm reluctant even to attempt to relicense so much code.

I understand that you want to keep the 'openat' module under GPL.

But reverting Paul's change fixes the problem. Why should it be a shame?
It's just 15 lines of code. The link_exists2_p function has code to
concatenate a directory and a file name; this is exactly what we need
when the 'fstatat' function does not exist.

Eric Blake wrote:
> Sounds like we need to split openat into two modules - an LGPL one that
> does the detection, and a GPL one that provides the replacement; then make
> glob depend on openat-detect instead of openat.

The lib/glob.c code needs only the fstatat() function; its detection is only
one line of *.m4 code. So it's not worth making a separate module for it.

I propose this change. Jim, this also include a license change of the 'dirfd'
module from LGPL to LGPLv2+. The dirfd.[hc] code is trivial; the dirfd.m4
macros are already under an all-permissive license.


2007-12-25  Bruno Haible  <address@hidden>

        Fixup after 2007-10-17 commit. Ensure that 'glob' stays under LGPLv2+.
        * lib/glob.c: Don't include openat.h.
        (link_exists2_p): Add back the code that deals with the
        !GLOB_ALTDIRFUNC case.
        (link_exists_p) [!_LIBC && !HAVE_FSTATAT]: Just call link_exists2_p and
        let it do the filename concatenation.
        * m4/glob.m4 (gl_PREREQ_GLOB): Add check for fstatat.
        * modules/glob (Depends-on): Remove openat.

        * modules/dirfd (License): Change to LGPLv2+.

*** lib/glob.c.orig     2007-12-25 07:21:06.000000000 +0100
--- lib/glob.c  2007-12-25 07:20:23.000000000 +0100
***************
*** 147,153 ****
  
  #ifndef _LIBC
  # include "dirfd.h"
- # include "openat.h"
  #endif
  
  #ifdef _SC_GETPW_R_SIZE_MAX
--- 147,152 ----
***************
*** 1218,1230 ****
  #endif /* !GLOB_ONLY_P */
  
  
  /* We put this in a separate function mainly to allow the memory
     allocated with alloca to be recycled.  */
- #if !defined _LIBC || !defined GLOB_ONLY_P
  static int
  __attribute_noinline__
  link_exists2_p (const char *dir, size_t dirlen, const char *fname,
!               glob_t *pglob)
  {
    size_t fnamelen = strlen (fname);
    char *fullname = __alloca (dirlen + 1 + fnamelen + 1);
--- 1217,1233 ----
  #endif /* !GLOB_ONLY_P */
  
  
+ #if !defined _LIBC || !defined GLOB_ONLY_P
  /* We put this in a separate function mainly to allow the memory
     allocated with alloca to be recycled.  */
  static int
  __attribute_noinline__
  link_exists2_p (const char *dir, size_t dirlen, const char *fname,
!               glob_t *pglob
! # if !defined _LIBC && !HAVE_FSTATAT
!               , int flags
! # endif
!               )
  {
    size_t fnamelen = strlen (fname);
    char *fullname = __alloca (dirlen + 1 + fnamelen + 1);
***************
*** 1233,1238 ****
--- 1236,1248 ----
    mempcpy (mempcpy (mempcpy (fullname, dir, dirlen), "/", 1),
           fname, fnamelen + 1);
  
+ # if !defined _LIBC && !HAVE_FSTATAT
+   if (__builtin_expect ((flags & GLOB_ALTDIRFUNC) == 0, 1))
+     {
+       struct_stat64 st64;
+       return __stat64 (fullname, &st64) == 0;
+     }
+ # endif
    return (*pglob->gl_stat) (fullname, &st) == 0;
  }
  
***************
*** 1241,1246 ****
--- 1251,1257 ----
  link_exists_p (int dfd, const char *dir, size_t dirlen, const char *fname,
               glob_t *pglob, int flags)
  {
+ # if defined _LIBC || HAVE_FSTATAT
    if (__builtin_expect (flags & GLOB_ALTDIRFUNC, 0))
      return link_exists2_p (dir, dirlen, fname, pglob);
    else
***************
*** 1248,1253 ****
--- 1259,1267 ----
        struct_stat64 st64;
        return __fxstatat64 (_STAT_VER, dfd, fname, &st64, 0) == 0;
      }
+ # else
+   return link_exists2_p (dir, dirlen, fname, pglob, flags);
+ # endif
  }
  #endif
  
*** m4/glob.m4.orig     2007-12-25 07:21:06.000000000 +0100
--- m4/glob.m4  2007-12-25 07:15:19.000000000 +0100
***************
*** 1,4 ****
! # glob.m4 serial 9
  dnl Copyright (C) 2005-2007 Free Software Foundation, Inc.
  dnl This file is free software; the Free Software Foundation
  dnl gives unlimited permission to copy and/or distribute it,
--- 1,4 ----
! # glob.m4 serial 10
  dnl Copyright (C) 2005-2007 Free Software Foundation, Inc.
  dnl This file is free software; the Free Software Foundation
  dnl gives unlimited permission to copy and/or distribute it,
***************
*** 82,86 ****
      HAVE_SYS_CDEFS_H=0
    fi
    AC_SUBST([HAVE_SYS_CDEFS_H])
!   AC_CHECK_FUNCS_ONCE([getlogin_r getpwnam_r])dnl
  ])
--- 82,86 ----
      HAVE_SYS_CDEFS_H=0
    fi
    AC_SUBST([HAVE_SYS_CDEFS_H])
!   AC_CHECK_FUNCS_ONCE([fstatat getlogin_r getpwnam_r])dnl
  ])
*** modules/glob.orig   2007-12-25 07:21:06.000000000 +0100
--- modules/glob        2007-12-25 06:54:46.000000000 +0100
***************
*** 16,22 ****
  fnmatch
  getlogin_r
  mempcpy
- openat
  strdup
  sys_stat
  unistd
--- 16,21 ----
*** modules/dirfd.orig  2007-12-25 07:21:06.000000000 +0100
--- modules/dirfd       2007-12-25 06:54:08.000000000 +0100
***************
*** 17,23 ****
  "dirfd.h"
  
  License:
! LGPL
  
  Maintainer:
  Jim Meyering
--- 17,23 ----
  "dirfd.h"
  
  License:
! LGPLv2+
  
  Maintainer:
  Jim Meyering





reply via email to

[Prev in Thread] Current Thread [Next in Thread]