git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* Re: requesting permission to use some Git for Windows code
       [not found] <a730cebb-1782-f32b-0b7c-253bd61475d6@cea.fr>
@ 2017-07-25 13:53 ` Johannes Schindelin
       [not found]   ` <83bce6b8-a5eb-4914-a2d3-edd57050bfaa@googlegroups.com>
  2017-07-28  5:31   ` Brandon Casey
  0 siblings, 2 replies; 4+ messages in thread
From: Johannes Schindelin @ 2017-07-25 13:53 UTC (permalink / raw)
  To: Philippe Joyez; +Cc: Joris van der Hoeven, git-for-windows, git

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

Hi Philippe,

I am not quite certain whether I have replied to this earlier or not.
Under the assumption that I did not, I'll send this mail; Cc:ed to the
mailing lists as discussed privately.

On Fri, 23 Jun 2017, Philippe Joyez wrote:

> This message is to request the permission to use code chunks from Git
> for Windows in GNU TeXmacs <http://texmacs.org/>, to which I contribute.
> The main developer of TeXmacs is Joris van der Hoeven (in cc).
> 
> Context:
> 
> Just like Git, TeXmacs originated on *nix platforms and was subsequently
> ported to windows using MinGW. Naturally, some issues we have in that
> port are the very same Git for Windows has faced.
> 
> One specific problem you have solved and that TeXmacs still hasn't, is
> dealing with unicode filenames. By taking relevant pieces of code in Git
> for windows, I could easily come up with a patch that enables TeXmacs to
> handle unicode filenames in windows.
> 
> Now, the problem is that Git code is GPL V2, while TeXmacs is GPL V3:
> Incorporating my patch in TeXmacs' trunk would be a violation of GPL
> V2... /unless/ we are granted the permission to do so by the authors of
> the code. This is precisely the reason for this message.

It is great that you can make use of the code!

As to the licensing problem, I agree it is a hassle. The biggest obstacle
is that you have to have the consent of all the authors.

You hereby have mine.

> The chunks of code we would like to reuse are from these Git for Windows
> files:
> git-compat-util.h

This file is quite large, maybe you can cut down on the authors to contact
by restricting the `git annotate`/`git log`/`git shortlog` calls to
specific parts, using the `-L <start-line-no>,<end-line-no>` option?

> ctype.c

$ git shortlog -nse ctype.c
     5  Junio C Hamano <gitster@pobox.com>
     4  René Scharfe <l.s.r@web.de>
     2  Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
     1  Ben Walton <bdwalton@gmail.com>
     1  Brandon Casey <drafnel@gmail.com>
     1  Gary V. Vaughan <git@mlists.thewrittenword.com>
     1  Linus Torvalds <torvalds@linux-foundation.org>
     1  Namhyung Kim <namhyung@gmail.com>

I *think* Ben Walton's change (189c860c9ec (kwset: use unsigned char to
store values with high-bit set, 2015-03-02)) is not copyright-able, as it
only changes the type from signed to unsigned. But I am not a lawyer ;-)

Likewise, Namhyung Kim's change (1a191a22959 (ctype.c only wants
git-compat-util.h, 2012-02-10)) only changes which header is included.
That seems to be a too-obvious/too-trivial change to me.

Also, it looks as if removing a comma as was done in 4b05548fc05 (enums:
omit trailing comma for portability, 2010-05-14) by Gary V. Vaughan would
not merit any copyright.

If in doubt, you could simply take the version of ctype.c with those
changes reverted as basis of your work.

You still have to get the consent of Junio, René, Duy, Brandon and Linus
to relicense the file's contents.

> compat ¬
>    mingw.c

I count 35 authors other than myself for that file... Maybe you can narrow
down what you need?

>    mingw.h

Still 29 authors other than me...

>    win32.h

This is more manageable, as it only saw three authors. But then, you could
simply reimplement the functionality, it's just two functions, and I do
not think that get_file_attr() is implemented in the best way: we have a
function called err_win_to_posix() in compat/mingw.c which is much more
complete.

Having said that, err_win_to_posix() is still not implemented in the best
way. The best way is to abuse Windows' own (undocumented) _doserrmap()
function along with the information in the header files winerror.h and
errno.h to generate the mapping. Those two files, as per mingw-w64's
headers, have the very nice preamble:

	/**
	 * This file has no copyright assigned and is placed in the Public Domain.
	 * This file is part of the mingw-w64 runtime package.
	 * No warranty is given; refer to the file DISCLAIMER.PD within this
	 * package.
	 */

Therefore, the result has no copyright assigned and is placed in the
Public Domain and we can do the very same, too.

As I wanted to have a Windows error -> errno mapping that I could
relicense as I see fit, anyway, I took this as an excellent opportunity to
generate exactly that.

Please find the header attached. Here is how I generated that header file:

-- snip --
cat >/tmp/generrmap.c <<EOF &&
#include <windows.h>
#include <stdio.h>

static void map_code(unsigned long code, const char *id);

int _main(int argc, char **argv)
{
	printf("/* This file has no copyright assigned and is placed in the "
		"Public Domain. */\\n"
		"\\n"
		"#ifndef WINERR2ERRNO_H\\n"
		"#define WINERR2ERRNO_H\\n"
		"\\n"
		"static int winerror2errno(long code)\\n"
		"{\\n");
$(sed -n 's/^#define \([^ ]*\) __MSABI_LONG([1-9].*/\tmap_code(\1, "\1");/p' \
	</mingw64/x86_64-w64-mingw32/include/winerror.h)
	printf("\\tdefault: errno = EINVAL;\\n"
		"\\t}\\n"
		"\\n"
		"\\treturn -1; /* Typical return value when errno was set */\\n"
		"}\\n"
		"\\n"
		"#endif /* WINERR2ERRNO_H */\\n");
	fflush(stdout);
	return 0;
}

/* Undocumented function in the MSVCRT */
extern void _dosmaperr(unsigned long code);

static const char *errno2constant(int err, const char *id)
{
	switch (err) {
$(sed -n 's/^#define \([^ ]*\) \([0-9]*\)$/\tcase \2: return "\1";/p' \
	</mingw64/x86_64-w64-mingw32/include/errno.h)
	default:
		fprintf(stderr, "Unhandled err: %d (for %s)\\n", err, id);
		exit(1);
	}
}

static void map_code(unsigned long code, const char *id)
{
	errno = 0;
	_dosmaperr(code);
	if (!errno) {
		fprintf(stderr, "Unhandled id: '%s' (%ld)\\n", id, code);
		exit(1);
	}
	if (errno != EINVAL)
		printf("\\tcase %s: errno = %s;\\n",
			id, errno2constant(errno, id));
}
EOF
gcc -g -nostdlib -o /tmp/generrmap.exe /tmp/generrmap.c -lmsvcr120 &&
/tmp/generrmap
-- snap --

>    win32 ¬
>         dirent.c
>         dirent.h

I encourage you to have a look whether you really need that full-fledged
functionality.

For vaguely related work, I recently reimplemented this differently, for
use in BusyBox-w32, where we really only need to have the file names. The
implementation is a lot cleaner, and I am happy to relicense this to
whatever license you see fit (even BSD):

	https://github.com/git-for-windows/busybox-w32/commit/b76eee3aca

>         lazyload.h

This one was authored by me, and I am happy to relicense it to GPLv3. Or
whatever license, really.

Ciao,
Johannes

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-chdr; name=winerr2errno.h, Size: 3519 bytes --]

/* This file has no copyright assigned and is placed in the Public Domain. */

#ifndef WINERR2ERRNO_H
#define WINERR2ERRNO_H

static int winerror2errno(long code)
{
	case ERROR_FILE_NOT_FOUND: errno = ENOENT;
	case ERROR_PATH_NOT_FOUND: errno = ENOENT;
	case ERROR_TOO_MANY_OPEN_FILES: errno = EMFILE;
	case ERROR_ACCESS_DENIED: errno = EACCES;
	case ERROR_INVALID_HANDLE: errno = EBADF;
	case ERROR_ARENA_TRASHED: errno = ENOMEM;
	case ERROR_NOT_ENOUGH_MEMORY: errno = ENOMEM;
	case ERROR_INVALID_BLOCK: errno = ENOMEM;
	case ERROR_BAD_ENVIRONMENT: errno = E2BIG;
	case ERROR_BAD_FORMAT: errno = ENOEXEC;
	case ERROR_INVALID_DRIVE: errno = ENOENT;
	case ERROR_CURRENT_DIRECTORY: errno = EACCES;
	case ERROR_NOT_SAME_DEVICE: errno = EXDEV;
	case ERROR_NO_MORE_FILES: errno = ENOENT;
	case ERROR_WRITE_PROTECT: errno = EACCES;
	case ERROR_BAD_UNIT: errno = EACCES;
	case ERROR_NOT_READY: errno = EACCES;
	case ERROR_BAD_COMMAND: errno = EACCES;
	case ERROR_CRC: errno = EACCES;
	case ERROR_BAD_LENGTH: errno = EACCES;
	case ERROR_SEEK: errno = EACCES;
	case ERROR_NOT_DOS_DISK: errno = EACCES;
	case ERROR_SECTOR_NOT_FOUND: errno = EACCES;
	case ERROR_OUT_OF_PAPER: errno = EACCES;
	case ERROR_WRITE_FAULT: errno = EACCES;
	case ERROR_READ_FAULT: errno = EACCES;
	case ERROR_GEN_FAILURE: errno = EACCES;
	case ERROR_SHARING_VIOLATION: errno = EACCES;
	case ERROR_LOCK_VIOLATION: errno = EACCES;
	case ERROR_WRONG_DISK: errno = EACCES;
	case ERROR_SHARING_BUFFER_EXCEEDED: errno = EACCES;
	case ERROR_BAD_NETPATH: errno = ENOENT;
	case ERROR_NETWORK_ACCESS_DENIED: errno = EACCES;
	case ERROR_BAD_NET_NAME: errno = ENOENT;
	case ERROR_FILE_EXISTS: errno = EEXIST;
	case ERROR_CANNOT_MAKE: errno = EACCES;
	case ERROR_FAIL_I24: errno = EACCES;
	case ERROR_NO_PROC_SLOTS: errno = EAGAIN;
	case ERROR_DRIVE_LOCKED: errno = EACCES;
	case ERROR_BROKEN_PIPE: errno = EPIPE;
	case ERROR_DISK_FULL: errno = ENOSPC;
	case ERROR_INVALID_TARGET_HANDLE: errno = EBADF;
	case ERROR_WAIT_NO_CHILDREN: errno = ECHILD;
	case ERROR_CHILD_NOT_COMPLETE: errno = ECHILD;
	case ERROR_DIRECT_ACCESS_HANDLE: errno = EBADF;
	case ERROR_SEEK_ON_DEVICE: errno = EACCES;
	case ERROR_DIR_NOT_EMPTY: errno = ENOTEMPTY;
	case ERROR_NOT_LOCKED: errno = EACCES;
	case ERROR_BAD_PATHNAME: errno = ENOENT;
	case ERROR_MAX_THRDS_REACHED: errno = EAGAIN;
	case ERROR_LOCK_FAILED: errno = EACCES;
	case ERROR_ALREADY_EXISTS: errno = EEXIST;
	case ERROR_INVALID_STARTING_CODESEG: errno = ENOEXEC;
	case ERROR_INVALID_STACKSEG: errno = ENOEXEC;
	case ERROR_INVALID_MODULETYPE: errno = ENOEXEC;
	case ERROR_INVALID_EXE_SIGNATURE: errno = ENOEXEC;
	case ERROR_EXE_MARKED_INVALID: errno = ENOEXEC;
	case ERROR_BAD_EXE_FORMAT: errno = ENOEXEC;
	case ERROR_ITERATED_DATA_EXCEEDS_64k: errno = ENOEXEC;
	case ERROR_INVALID_MINALLOCSIZE: errno = ENOEXEC;
	case ERROR_DYNLINK_FROM_INVALID_RING: errno = ENOEXEC;
	case ERROR_IOPL_NOT_ENABLED: errno = ENOEXEC;
	case ERROR_INVALID_SEGDPL: errno = ENOEXEC;
	case ERROR_AUTODATASEG_EXCEEDS_64k: errno = ENOEXEC;
	case ERROR_RING2SEG_MUST_BE_MOVABLE: errno = ENOEXEC;
	case ERROR_RELOC_CHAIN_XEEDS_SEGLIM: errno = ENOEXEC;
	case ERROR_INFLOOP_IN_RELOC_CHAIN: errno = ENOEXEC;
	case ERROR_FILENAME_EXCED_RANGE: errno = ENOENT;
	case ERROR_NESTING_NOT_ALLOWED: errno = EAGAIN;
	case ERROR_NOT_ENOUGH_QUOTA: errno = ENOMEM;
	default: errno = EINVAL;
	}

	return -1; /* Typical return value when errno was set */
}

#endif /* WINERR2ERRNO_H */

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: requesting permission to use some Git for Windows code
       [not found]   ` <83bce6b8-a5eb-4914-a2d3-edd57050bfaa@googlegroups.com>
@ 2017-07-27  8:31     ` Philippe Joyez
  0 siblings, 0 replies; 4+ messages in thread
From: Philippe Joyez @ 2017-07-27  8:31 UTC (permalink / raw)
  To: elizaretskii, git-for-windows; +Cc: vdhoeven, git



Le 25/07/2017 à 15:53, Johannes Schindelin a écrit :
>
> It is great that you can make use of the code!
>
> As to the licensing problem, I agree it is a hassle. The biggest obstacle
> is that you have to have the consent of all the authors.
>
> You hereby have mine.
>

Many thanks Johannes for your positive personal answer but also for the
very detailed tips on how to handle this.

Le 27/07/2017 à 06:30, elizaretskii@gmail.com a écrit :
>
>
> An alternative would be for TeXmacs to use the code from GNU Emacs,
> which also supports Unicode file names on MS-Windows.  Emacs is of
> course GPL v3+, so there should be no problem with that.
>
Thanks you too Eli, for bringing up that piece of information; I'll
definitely take a look into it!

Philippe

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: requesting permission to use some Git for Windows code
  2017-07-25 13:53 ` requesting permission to use some Git for Windows code Johannes Schindelin
       [not found]   ` <83bce6b8-a5eb-4914-a2d3-edd57050bfaa@googlegroups.com>
@ 2017-07-28  5:31   ` Brandon Casey
  2017-07-28 15:26     ` Marius Storm-Olsen
  1 sibling, 1 reply; 4+ messages in thread
From: Brandon Casey @ 2017-07-28  5:31 UTC (permalink / raw)
  To: Philippe Joyez
  Cc: Joris van der Hoeven, git-for-windows, git@vger.kernel.org,
	Johannes Schindelin

Hi Philippe,

Please feel free to use my portions of the mentioned works under the GPLv3.

-Brandon

On Tue, Jul 25, 2017 at 6:53 AM, Johannes Schindelin
<Johannes.Schindelin@gmx.de> wrote:
> Hi Philippe,
>
> I am not quite certain whether I have replied to this earlier or not.
> Under the assumption that I did not, I'll send this mail; Cc:ed to the
> mailing lists as discussed privately.
>
> On Fri, 23 Jun 2017, Philippe Joyez wrote:
>
>> This message is to request the permission to use code chunks from Git
>> for Windows in GNU TeXmacs <http://texmacs.org/>, to which I contribute.
>> The main developer of TeXmacs is Joris van der Hoeven (in cc).
>>
>> Context:
>>
>> Just like Git, TeXmacs originated on *nix platforms and was subsequently
>> ported to windows using MinGW. Naturally, some issues we have in that
>> port are the very same Git for Windows has faced.
>>
>> One specific problem you have solved and that TeXmacs still hasn't, is
>> dealing with unicode filenames. By taking relevant pieces of code in Git
>> for windows, I could easily come up with a patch that enables TeXmacs to
>> handle unicode filenames in windows.
>>
>> Now, the problem is that Git code is GPL V2, while TeXmacs is GPL V3:
>> Incorporating my patch in TeXmacs' trunk would be a violation of GPL
>> V2... /unless/ we are granted the permission to do so by the authors of
>> the code. This is precisely the reason for this message.
>
> It is great that you can make use of the code!
>
> As to the licensing problem, I agree it is a hassle. The biggest obstacle
> is that you have to have the consent of all the authors.
>
> You hereby have mine.
>
>> The chunks of code we would like to reuse are from these Git for Windows
>> files:
>> git-compat-util.h
>
> This file is quite large, maybe you can cut down on the authors to contact
> by restricting the `git annotate`/`git log`/`git shortlog` calls to
> specific parts, using the `-L <start-line-no>,<end-line-no>` option?
>
>> ctype.c
>
> $ git shortlog -nse ctype.c
>      5  Junio C Hamano <gitster@pobox.com>
>      4  René Scharfe <l.s.r@web.de>
>      2  Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
>      1  Ben Walton <bdwalton@gmail.com>
>      1  Brandon Casey <drafnel@gmail.com>
>      1  Gary V. Vaughan <git@mlists.thewrittenword.com>
>      1  Linus Torvalds <torvalds@linux-foundation.org>
>      1  Namhyung Kim <namhyung@gmail.com>
>
> I *think* Ben Walton's change (189c860c9ec (kwset: use unsigned char to
> store values with high-bit set, 2015-03-02)) is not copyright-able, as it
> only changes the type from signed to unsigned. But I am not a lawyer ;-)
>
> Likewise, Namhyung Kim's change (1a191a22959 (ctype.c only wants
> git-compat-util.h, 2012-02-10)) only changes which header is included.
> That seems to be a too-obvious/too-trivial change to me.
>
> Also, it looks as if removing a comma as was done in 4b05548fc05 (enums:
> omit trailing comma for portability, 2010-05-14) by Gary V. Vaughan would
> not merit any copyright.
>
> If in doubt, you could simply take the version of ctype.c with those
> changes reverted as basis of your work.
>
> You still have to get the consent of Junio, René, Duy, Brandon and Linus
> to relicense the file's contents.
>
>> compat ¬
>>    mingw.c
>
> I count 35 authors other than myself for that file... Maybe you can narrow
> down what you need?
>
>>    mingw.h
>
> Still 29 authors other than me...
>
>>    win32.h
>
> This is more manageable, as it only saw three authors. But then, you could
> simply reimplement the functionality, it's just two functions, and I do
> not think that get_file_attr() is implemented in the best way: we have a
> function called err_win_to_posix() in compat/mingw.c which is much more
> complete.
>
> Having said that, err_win_to_posix() is still not implemented in the best
> way. The best way is to abuse Windows' own (undocumented) _doserrmap()
> function along with the information in the header files winerror.h and
> errno.h to generate the mapping. Those two files, as per mingw-w64's
> headers, have the very nice preamble:
>
>         /**
>          * This file has no copyright assigned and is placed in the Public Domain.
>          * This file is part of the mingw-w64 runtime package.
>          * No warranty is given; refer to the file DISCLAIMER.PD within this
>          * package.
>          */
>
> Therefore, the result has no copyright assigned and is placed in the
> Public Domain and we can do the very same, too.
>
> As I wanted to have a Windows error -> errno mapping that I could
> relicense as I see fit, anyway, I took this as an excellent opportunity to
> generate exactly that.
>
> Please find the header attached. Here is how I generated that header file:
>
> -- snip --
> cat >/tmp/generrmap.c <<EOF &&
> #include <windows.h>
> #include <stdio.h>
>
> static void map_code(unsigned long code, const char *id);
>
> int _main(int argc, char **argv)
> {
>         printf("/* This file has no copyright assigned and is placed in the "
>                 "Public Domain. */\\n"
>                 "\\n"
>                 "#ifndef WINERR2ERRNO_H\\n"
>                 "#define WINERR2ERRNO_H\\n"
>                 "\\n"
>                 "static int winerror2errno(long code)\\n"
>                 "{\\n");
> $(sed -n 's/^#define \([^ ]*\) __MSABI_LONG([1-9].*/\tmap_code(\1, "\1");/p' \
>         </mingw64/x86_64-w64-mingw32/include/winerror.h)
>         printf("\\tdefault: errno = EINVAL;\\n"
>                 "\\t}\\n"
>                 "\\n"
>                 "\\treturn -1; /* Typical return value when errno was set */\\n"
>                 "}\\n"
>                 "\\n"
>                 "#endif /* WINERR2ERRNO_H */\\n");
>         fflush(stdout);
>         return 0;
> }
>
> /* Undocumented function in the MSVCRT */
> extern void _dosmaperr(unsigned long code);
>
> static const char *errno2constant(int err, const char *id)
> {
>         switch (err) {
> $(sed -n 's/^#define \([^ ]*\) \([0-9]*\)$/\tcase \2: return "\1";/p' \
>         </mingw64/x86_64-w64-mingw32/include/errno.h)
>         default:
>                 fprintf(stderr, "Unhandled err: %d (for %s)\\n", err, id);
>                 exit(1);
>         }
> }
>
> static void map_code(unsigned long code, const char *id)
> {
>         errno = 0;
>         _dosmaperr(code);
>         if (!errno) {
>                 fprintf(stderr, "Unhandled id: '%s' (%ld)\\n", id, code);
>                 exit(1);
>         }
>         if (errno != EINVAL)
>                 printf("\\tcase %s: errno = %s;\\n",
>                         id, errno2constant(errno, id));
> }
> EOF
> gcc -g -nostdlib -o /tmp/generrmap.exe /tmp/generrmap.c -lmsvcr120 &&
> /tmp/generrmap
> -- snap --
>
>>    win32 ¬
>>         dirent.c
>>         dirent.h
>
> I encourage you to have a look whether you really need that full-fledged
> functionality.
>
> For vaguely related work, I recently reimplemented this differently, for
> use in BusyBox-w32, where we really only need to have the file names. The
> implementation is a lot cleaner, and I am happy to relicense this to
> whatever license you see fit (even BSD):
>
>         https://github.com/git-for-windows/busybox-w32/commit/b76eee3aca
>
>>         lazyload.h
>
> This one was authored by me, and I am happy to relicense it to GPLv3. Or
> whatever license, really.
>
> Ciao,
> Johannes

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: requesting permission to use some Git for Windows code
  2017-07-28  5:31   ` Brandon Casey
@ 2017-07-28 15:26     ` Marius Storm-Olsen
  0 siblings, 0 replies; 4+ messages in thread
From: Marius Storm-Olsen @ 2017-07-28 15:26 UTC (permalink / raw)
  To: Brandon Casey, Philippe Joyez
  Cc: Joris van der Hoeven, git-for-windows, git@vger.kernel.org,
	Johannes Schindelin

Ditto, on any of my portions, if any left :)

-- 
.marius

On 7/28/2017 00:31, Brandon Casey wrote:
> Hi Philippe,
>
> Please feel free to use my portions of the mentioned works under the GPLv3.
>
> -Brandon
>
> On Tue, Jul 25, 2017 at 6:53 AM, Johannes Schindelin
> <Johannes.Schindelin@gmx.de> wrote:
>> Hi Philippe,
>>
>> I am not quite certain whether I have replied to this earlier or not.
>> Under the assumption that I did not, I'll send this mail; Cc:ed to the
>> mailing lists as discussed privately.
>>
>> On Fri, 23 Jun 2017, Philippe Joyez wrote:
>>
>>> This message is to request the permission to use code chunks from Git
>>> for Windows in GNU TeXmacs <http://texmacs.org/>, to which I contribute.
>>> The main developer of TeXmacs is Joris van der Hoeven (in cc).
>>>
>>> Context:
>>>
>>> Just like Git, TeXmacs originated on *nix platforms and was subsequently
>>> ported to windows using MinGW. Naturally, some issues we have in that
>>> port are the very same Git for Windows has faced.
>>>
>>> One specific problem you have solved and that TeXmacs still hasn't, is
>>> dealing with unicode filenames. By taking relevant pieces of code in Git
>>> for windows, I could easily come up with a patch that enables TeXmacs to
>>> handle unicode filenames in windows.
>>>
>>> Now, the problem is that Git code is GPL V2, while TeXmacs is GPL V3:
>>> Incorporating my patch in TeXmacs' trunk would be a violation of GPL
>>> V2... /unless/ we are granted the permission to do so by the authors of
>>> the code. This is precisely the reason for this message.
>> It is great that you can make use of the code!
>>
>> As to the licensing problem, I agree it is a hassle. The biggest obstacle
>> is that you have to have the consent of all the authors.
>>
>> You hereby have mine.
>>
>>> The chunks of code we would like to reuse are from these Git for Windows
>>> files:
>>> git-compat-util.h
>> This file is quite large, maybe you can cut down on the authors to contact
>> by restricting the `git annotate`/`git log`/`git shortlog` calls to
>> specific parts, using the `-L <start-line-no>,<end-line-no>` option?
>>
>>> ctype.c
>> $ git shortlog -nse ctype.c
>>       5  Junio C Hamano <gitster@pobox.com>
>>       4  René Scharfe <l.s.r@web.de>
>>       2  Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
>>       1  Ben Walton <bdwalton@gmail.com>
>>       1  Brandon Casey <drafnel@gmail.com>
>>       1  Gary V. Vaughan <git@mlists.thewrittenword.com>
>>       1  Linus Torvalds <torvalds@linux-foundation.org>
>>       1  Namhyung Kim <namhyung@gmail.com>
>>
>> I *think* Ben Walton's change (189c860c9ec (kwset: use unsigned char to
>> store values with high-bit set, 2015-03-02)) is not copyright-able, as it
>> only changes the type from signed to unsigned. But I am not a lawyer ;-)
>>
>> Likewise, Namhyung Kim's change (1a191a22959 (ctype.c only wants
>> git-compat-util.h, 2012-02-10)) only changes which header is included.
>> That seems to be a too-obvious/too-trivial change to me.
>>
>> Also, it looks as if removing a comma as was done in 4b05548fc05 (enums:
>> omit trailing comma for portability, 2010-05-14) by Gary V. Vaughan would
>> not merit any copyright.
>>
>> If in doubt, you could simply take the version of ctype.c with those
>> changes reverted as basis of your work.
>>
>> You still have to get the consent of Junio, René, Duy, Brandon and Linus
>> to relicense the file's contents.
>>
>>> compat ¬
>>>     mingw.c
>> I count 35 authors other than myself for that file... Maybe you can narrow
>> down what you need?
>>
>>>     mingw.h
>> Still 29 authors other than me...
>>
>>>     win32.h
>> This is more manageable, as it only saw three authors. But then, you could
>> simply reimplement the functionality, it's just two functions, and I do
>> not think that get_file_attr() is implemented in the best way: we have a
>> function called err_win_to_posix() in compat/mingw.c which is much more
>> complete.
>>
>> Having said that, err_win_to_posix() is still not implemented in the best
>> way. The best way is to abuse Windows' own (undocumented) _doserrmap()
>> function along with the information in the header files winerror.h and
>> errno.h to generate the mapping. Those two files, as per mingw-w64's
>> headers, have the very nice preamble:
>>
>>          /**
>>           * This file has no copyright assigned and is placed in the Public Domain.
>>           * This file is part of the mingw-w64 runtime package.
>>           * No warranty is given; refer to the file DISCLAIMER.PD within this
>>           * package.
>>           */
>>
>> Therefore, the result has no copyright assigned and is placed in the
>> Public Domain and we can do the very same, too.
>>
>> As I wanted to have a Windows error -> errno mapping that I could
>> relicense as I see fit, anyway, I took this as an excellent opportunity to
>> generate exactly that.
>>
>> Please find the header attached. Here is how I generated that header file:
>>
>> -- snip --
>> cat >/tmp/generrmap.c <<EOF &&
>> #include <windows.h>
>> #include <stdio.h>
>>
>> static void map_code(unsigned long code, const char *id);
>>
>> int _main(int argc, char **argv)
>> {
>>          printf("/* This file has no copyright assigned and is placed in the "
>>                  "Public Domain. */\\n"
>>                  "\\n"
>>                  "#ifndef WINERR2ERRNO_H\\n"
>>                  "#define WINERR2ERRNO_H\\n"
>>                  "\\n"
>>                  "static int winerror2errno(long code)\\n"
>>                  "{\\n");
>> $(sed -n 's/^#define \([^ ]*\) __MSABI_LONG([1-9].*/\tmap_code(\1, "\1");/p' \
>>          </mingw64/x86_64-w64-mingw32/include/winerror.h)
>>          printf("\\tdefault: errno = EINVAL;\\n"
>>                  "\\t}\\n"
>>                  "\\n"
>>                  "\\treturn -1; /* Typical return value when errno was set */\\n"
>>                  "}\\n"
>>                  "\\n"
>>                  "#endif /* WINERR2ERRNO_H */\\n");
>>          fflush(stdout);
>>          return 0;
>> }
>>
>> /* Undocumented function in the MSVCRT */
>> extern void _dosmaperr(unsigned long code);
>>
>> static const char *errno2constant(int err, const char *id)
>> {
>>          switch (err) {
>> $(sed -n 's/^#define \([^ ]*\) \([0-9]*\)$/\tcase \2: return "\1";/p' \
>>          </mingw64/x86_64-w64-mingw32/include/errno.h)
>>          default:
>>                  fprintf(stderr, "Unhandled err: %d (for %s)\\n", err, id);
>>                  exit(1);
>>          }
>> }
>>
>> static void map_code(unsigned long code, const char *id)
>> {
>>          errno = 0;
>>          _dosmaperr(code);
>>          if (!errno) {
>>                  fprintf(stderr, "Unhandled id: '%s' (%ld)\\n", id, code);
>>                  exit(1);
>>          }
>>          if (errno != EINVAL)
>>                  printf("\\tcase %s: errno = %s;\\n",
>>                          id, errno2constant(errno, id));
>> }
>> EOF
>> gcc -g -nostdlib -o /tmp/generrmap.exe /tmp/generrmap.c -lmsvcr120 &&
>> /tmp/generrmap
>> -- snap --
>>
>>>     win32 ¬
>>>          dirent.c
>>>          dirent.h
>> I encourage you to have a look whether you really need that full-fledged
>> functionality.
>>
>> For vaguely related work, I recently reimplemented this differently, for
>> use in BusyBox-w32, where we really only need to have the file names. The
>> implementation is a lot cleaner, and I am happy to relicense this to
>> whatever license you see fit (even BSD):
>>
>>          https://github.com/git-for-windows/busybox-w32/commit/b76eee3aca
>>
>>>          lazyload.h
>> This one was authored by me, and I am happy to relicense it to GPLv3. Or
>> whatever license, really.
>>
>> Ciao,
>> Johannes


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-07-28 15:26 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <a730cebb-1782-f32b-0b7c-253bd61475d6@cea.fr>
2017-07-25 13:53 ` requesting permission to use some Git for Windows code Johannes Schindelin
     [not found]   ` <83bce6b8-a5eb-4914-a2d3-edd57050bfaa@googlegroups.com>
2017-07-27  8:31     ` Philippe Joyez
2017-07-28  5:31   ` Brandon Casey
2017-07-28 15:26     ` Marius Storm-Olsen

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).