{"thread":{"id":"46465","subject":"Re: requesting permission to use some Git for Windows code","startedAt":"2017-07-25T13:53:55Z","lastAt":"2017-07-28T15:26:55Z","messageCount":4,"participants":["Johannes Schindelin","Philippe Joyez","Brandon Casey","Marius Storm-Olsen"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"325037","messageId":"alpine.DEB.2.21.1.1706281259170.84669@virtualbox","threadId":"46465","inReplyTo":"a730cebb-1782-f32b-0b7c-253bd61475d6@cea.fr","subject":"Re: requesting permission to use some Git for Windows code","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2017-07-25T13:53:40Z","receivedAt":"2017-07-25T13:53:55Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi Philippe,\n\nI am not quite certain whether I have replied to this earlier or not.\nUnder the assumption that I did not, I'll send this mail; Cc:ed to the\nmailing lists as discussed privately.\n\nOn Fri, 23 Jun 2017, Philippe Joyez wrote:\n\n> This message is to request the permission to use code chunks from Git\n> for Windows in GNU TeXmacs <http://texmacs.org/>, to which I contribute.\n> The main developer of TeXmacs is Joris van der Hoeven (in cc).\n> \n> Context:\n> \n> Just like Git, TeXmacs originated on *nix platforms and was subsequently\n> ported to windows using MinGW. Naturally, some issues we have in that\n> port are the very same Git for Windows has faced.\n> \n> One specific problem you have solved and that TeXmacs still hasn't, is\n> dealing with unicode filenames. By taking relevant pieces of code in Git\n> for windows, I could easily come up with a patch that enables TeXmacs to\n> handle unicode filenames in windows.\n> \n> Now, the problem is that Git code is GPL V2, while TeXmacs is GPL V3:\n> Incorporating my patch in TeXmacs' trunk would be a violation of GPL\n> V2... /unless/ we are granted the permission to do so by the authors of\n> the code. This is precisely the reason for this message.\n\nIt is great that you can make use of the code!\n\nAs to the licensing problem, I agree it is a hassle. The biggest obstacle\nis that you have to have the consent of all the authors.\n\nYou hereby have mine.\n\n> The chunks of code we would like to reuse are from these Git for Windows\n> files:\n> git-compat-util.h\n\nThis file is quite large, maybe you can cut down on the authors to contact\nby restricting the `git annotate`/`git log`/`git shortlog` calls to\nspecific parts, using the `-L <start-line-no>,<end-line-no>` option?\n\n> ctype.c\n\n$ git shortlog -nse ctype.c\n     5  Junio C Hamano <gitster@pobox.com>\n     4  René Scharfe <l.s.r@web.de>\n     2  Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\n     1  Ben Walton <bdwalton@gmail.com>\n     1  Brandon Casey <drafnel@gmail.com>\n     1  Gary V. Vaughan <git@mlists.thewrittenword.com>\n     1  Linus Torvalds <torvalds@linux-foundation.org>\n     1  Namhyung Kim <namhyung@gmail.com>\n\nI *think* Ben Walton's change (189c860c9ec (kwset: use unsigned char to\nstore values with high-bit set, 2015-03-02)) is not copyright-able, as it\nonly changes the type from signed to unsigned. But I am not a lawyer ;-)\n\nLikewise, Namhyung Kim's change (1a191a22959 (ctype.c only wants\ngit-compat-util.h, 2012-02-10)) only changes which header is included.\nThat seems to be a too-obvious/too-trivial change to me.\n\nAlso, it looks as if removing a comma as was done in 4b05548fc05 (enums:\nomit trailing comma for portability, 2010-05-14) by Gary V. Vaughan would\nnot merit any copyright.\n\nIf in doubt, you could simply take the version of ctype.c with those\nchanges reverted as basis of your work.\n\nYou still have to get the consent of Junio, René, Duy, Brandon and Linus\nto relicense the file's contents.\n\n> compat ¬\n>    mingw.c\n\nI count 35 authors other than myself for that file... Maybe you can narrow\ndown what you need?\n\n>    mingw.h\n\nStill 29 authors other than me...\n\n>    win32.h\n\nThis is more manageable, as it only saw three authors. But then, you could\nsimply reimplement the functionality, it's just two functions, and I do\nnot think that get_file_attr() is implemented in the best way: we have a\nfunction called err_win_to_posix() in compat/mingw.c which is much more\ncomplete.\n\nHaving said that, err_win_to_posix() is still not implemented in the best\nway. The best way is to abuse Windows' own (undocumented) _doserrmap()\nfunction along with the information in the header files winerror.h and\nerrno.h to generate the mapping. Those two files, as per mingw-w64's\nheaders, have the very nice preamble:\n\n\t/**\n\t * This file has no copyright assigned and is placed in the Public Domain.\n\t * This file is part of the mingw-w64 runtime package.\n\t * No warranty is given; refer to the file DISCLAIMER.PD within this\n\t * package.\n\t */\n\nTherefore, the result has no copyright assigned and is placed in the\nPublic Domain and we can do the very same, too.\n\nAs I wanted to have a Windows error -> errno mapping that I could\nrelicense as I see fit, anyway, I took this as an excellent opportunity to\ngenerate exactly that.\n\nPlease find the header attached. Here is how I generated that header file:\n\n-- snip --\ncat >/tmp/generrmap.c <<EOF &&\n#include <windows.h>\n#include <stdio.h>\n\nstatic void map_code(unsigned long code, const char *id);\n\nint _main(int argc, char **argv)\n{\n\tprintf(\"/* This file has no copyright assigned and is placed in the \"\n\t\t\"Public Domain. */\\\\n\"\n\t\t\"\\\\n\"\n\t\t\"#ifndef WINERR2ERRNO_H\\\\n\"\n\t\t\"#define WINERR2ERRNO_H\\\\n\"\n\t\t\"\\\\n\"\n\t\t\"static int winerror2errno(long code)\\\\n\"\n\t\t\"{\\\\n\");\n$(sed -n 's/^#define \\([^ ]*\\) __MSABI_LONG([1-9].*/\\tmap_code(\\1, \"\\1\");/p' \\\n\t</mingw64/x86_64-w64-mingw32/include/winerror.h)\n\tprintf(\"\\\\tdefault: errno = EINVAL;\\\\n\"\n\t\t\"\\\\t}\\\\n\"\n\t\t\"\\\\n\"\n\t\t\"\\\\treturn -1; /* Typical return value when errno was set */\\\\n\"\n\t\t\"}\\\\n\"\n\t\t\"\\\\n\"\n\t\t\"#endif /* WINERR2ERRNO_H */\\\\n\");\n\tfflush(stdout);\n\treturn 0;\n}\n\n/* Undocumented function in the MSVCRT */\nextern void _dosmaperr(unsigned long code);\n\nstatic const char *errno2constant(int err, const char *id)\n{\n\tswitch (err) {\n$(sed -n 's/^#define \\([^ ]*\\) \\([0-9]*\\)$/\\tcase \\2: return \"\\1\";/p' \\\n\t</mingw64/x86_64-w64-mingw32/include/errno.h)\n\tdefault:\n\t\tfprintf(stderr, \"Unhandled err: %d (for %s)\\\\n\", err, id);\n\t\texit(1);\n\t}\n}\n\nstatic void map_code(unsigned long code, const char *id)\n{\n\terrno = 0;\n\t_dosmaperr(code);\n\tif (!errno) {\n\t\tfprintf(stderr, \"Unhandled id: '%s' (%ld)\\\\n\", id, code);\n\t\texit(1);\n\t}\n\tif (errno != EINVAL)\n\t\tprintf(\"\\\\tcase %s: errno = %s;\\\\n\",\n\t\t\tid, errno2constant(errno, id));\n}\nEOF\ngcc -g -nostdlib -o /tmp/generrmap.exe /tmp/generrmap.c -lmsvcr120 &&\n/tmp/generrmap\n-- snap --\n\n>    win32 ¬\n>         dirent.c\n>         dirent.h\n\nI encourage you to have a look whether you really need that full-fledged\nfunctionality.\n\nFor vaguely related work, I recently reimplemented this differently, for\nuse in BusyBox-w32, where we really only need to have the file names. The\nimplementation is a lot cleaner, and I am happy to relicense this to\nwhatever license you see fit (even BSD):\n\n\thttps://github.com/git-for-windows/busybox-w32/commit/b76eee3aca\n\n>         lazyload.h\n\nThis one was authored by me, and I am happy to relicense it to GPLv3. Or\nwhatever license, really.\n\nCiao,\nJohannes\n\n/* This file has no copyright assigned and is placed in the Public Domain. */\n\n#ifndef WINERR2ERRNO_H\n#define WINERR2ERRNO_H\n\nstatic int winerror2errno(long code)\n{\n\tcase ERROR_FILE_NOT_FOUND: errno = ENOENT;\n\tcase ERROR_PATH_NOT_FOUND: errno = ENOENT;\n\tcase ERROR_TOO_MANY_OPEN_FILES: errno = EMFILE;\n\tcase ERROR_ACCESS_DENIED: errno = EACCES;\n\tcase ERROR_INVALID_HANDLE: errno = EBADF;\n\tcase ERROR_ARENA_TRASHED: errno = ENOMEM;\n\tcase ERROR_NOT_ENOUGH_MEMORY: errno = ENOMEM;\n\tcase ERROR_INVALID_BLOCK: errno = ENOMEM;\n\tcase ERROR_BAD_ENVIRONMENT: errno = E2BIG;\n\tcase ERROR_BAD_FORMAT: errno = ENOEXEC;\n\tcase ERROR_INVALID_DRIVE: errno = ENOENT;\n\tcase ERROR_CURRENT_DIRECTORY: errno = EACCES;\n\tcase ERROR_NOT_SAME_DEVICE: errno = EXDEV;\n\tcase ERROR_NO_MORE_FILES: errno = ENOENT;\n\tcase ERROR_WRITE_PROTECT: errno = EACCES;\n\tcase ERROR_BAD_UNIT: errno = EACCES;\n\tcase ERROR_NOT_READY: errno = EACCES;\n\tcase ERROR_BAD_COMMAND: errno = EACCES;\n\tcase ERROR_CRC: errno = EACCES;\n\tcase ERROR_BAD_LENGTH: errno = EACCES;\n\tcase ERROR_SEEK: errno = EACCES;\n\tcase ERROR_NOT_DOS_DISK: errno = EACCES;\n\tcase ERROR_SECTOR_NOT_FOUND: errno = EACCES;\n\tcase ERROR_OUT_OF_PAPER: errno = EACCES;\n\tcase ERROR_WRITE_FAULT: errno = EACCES;\n\tcase ERROR_READ_FAULT: errno = EACCES;\n\tcase ERROR_GEN_FAILURE: errno = EACCES;\n\tcase ERROR_SHARING_VIOLATION: errno = EACCES;\n\tcase ERROR_LOCK_VIOLATION: errno = EACCES;\n\tcase ERROR_WRONG_DISK: errno = EACCES;\n\tcase ERROR_SHARING_BUFFER_EXCEEDED: errno = EACCES;\n\tcase ERROR_BAD_NETPATH: errno = ENOENT;\n\tcase ERROR_NETWORK_ACCESS_DENIED: errno = EACCES;\n\tcase ERROR_BAD_NET_NAME: errno = ENOENT;\n\tcase ERROR_FILE_EXISTS: errno = EEXIST;\n\tcase ERROR_CANNOT_MAKE: errno = EACCES;\n\tcase ERROR_FAIL_I24: errno = EACCES;\n\tcase ERROR_NO_PROC_SLOTS: errno = EAGAIN;\n\tcase ERROR_DRIVE_LOCKED: errno = EACCES;\n\tcase ERROR_BROKEN_PIPE: errno = EPIPE;\n\tcase ERROR_DISK_FULL: errno = ENOSPC;\n\tcase ERROR_INVALID_TARGET_HANDLE: errno = EBADF;\n\tcase ERROR_WAIT_NO_CHILDREN: errno = ECHILD;\n\tcase ERROR_CHILD_NOT_COMPLETE: errno = ECHILD;\n\tcase ERROR_DIRECT_ACCESS_HANDLE: errno = EBADF;\n\tcase ERROR_SEEK_ON_DEVICE: errno = EACCES;\n\tcase ERROR_DIR_NOT_EMPTY: errno = ENOTEMPTY;\n\tcase ERROR_NOT_LOCKED: errno = EACCES;\n\tcase ERROR_BAD_PATHNAME: errno = ENOENT;\n\tcase ERROR_MAX_THRDS_REACHED: errno = EAGAIN;\n\tcase ERROR_LOCK_FAILED: errno = EACCES;\n\tcase ERROR_ALREADY_EXISTS: errno = EEXIST;\n\tcase ERROR_INVALID_STARTING_CODESEG: errno = ENOEXEC;\n\tcase ERROR_INVALID_STACKSEG: errno = ENOEXEC;\n\tcase ERROR_INVALID_MODULETYPE: errno = ENOEXEC;\n\tcase ERROR_INVALID_EXE_SIGNATURE: errno = ENOEXEC;\n\tcase ERROR_EXE_MARKED_INVALID: errno = ENOEXEC;\n\tcase ERROR_BAD_EXE_FORMAT: errno = ENOEXEC;\n\tcase ERROR_ITERATED_DATA_EXCEEDS_64k: errno = ENOEXEC;\n\tcase ERROR_INVALID_MINALLOCSIZE: errno = ENOEXEC;\n\tcase ERROR_DYNLINK_FROM_INVALID_RING: errno = ENOEXEC;\n\tcase ERROR_IOPL_NOT_ENABLED: errno = ENOEXEC;\n\tcase ERROR_INVALID_SEGDPL: errno = ENOEXEC;\n\tcase ERROR_AUTODATASEG_EXCEEDS_64k: errno = ENOEXEC;\n\tcase ERROR_RING2SEG_MUST_BE_MOVABLE: errno = ENOEXEC;\n\tcase ERROR_RELOC_CHAIN_XEEDS_SEGLIM: errno = ENOEXEC;\n\tcase ERROR_INFLOOP_IN_RELOC_CHAIN: errno = ENOEXEC;\n\tcase ERROR_FILENAME_EXCED_RANGE: errno = ENOENT;\n\tcase ERROR_NESTING_NOT_ALLOWED: errno = EAGAIN;\n\tcase ERROR_NOT_ENOUGH_QUOTA: errno = ENOMEM;\n\tdefault: errno = EINVAL;\n\t}\n\n\treturn -1; /* Typical return value when errno was set */\n}\n\n#endif /* WINERR2ERRNO_H */\n"},{"id":"325178","messageId":"4517a3d2-5acb-e7b5-8cd6-0c5fe57811d1@cea.fr","threadId":"46465","inReplyTo":"83bce6b8-a5eb-4914-a2d3-edd57050bfaa@googlegroups.com","subject":"Re: requesting permission to use some Git for Windows code","fromName":"Philippe Joyez","fromEmail":"philippe.joyez@cea.fr","sentAt":"2017-07-27T08:31:08Z","receivedAt":"2017-07-27T08:56:41Z","isPatch":false,"sender":{"key":"philippe.joyez@cea.fr","avatar":null},"body":"\n\nLe 25/07/2017 à 15:53, Johannes Schindelin a écrit :\n>\n> It is great that you can make use of the code!\n>\n> As to the licensing problem, I agree it is a hassle. The biggest obstacle\n> is that you have to have the consent of all the authors.\n>\n> You hereby have mine.\n>\n\nMany thanks Johannes for your positive personal answer but also for the\nvery detailed tips on how to handle this.\n\nLe 27/07/2017 à 06:30, elizaretskii@gmail.com a écrit :\n>\n>\n> An alternative would be for TeXmacs to use the code from GNU Emacs,\n> which also supports Unicode file names on MS-Windows.  Emacs is of\n> course GPL v3+, so there should be no problem with that.\n>\nThanks you too Eli, for bringing up that piece of information; I'll\ndefinitely take a look into it!\n\nPhilippe\n"},{"id":"325214","messageId":"CA+sFfMcAtStAfoc6Zaq7zW3cmYLu1QMX9_mmrRWe=M_GJYDeyw@mail.gmail.com","threadId":"46465","inReplyTo":"alpine.DEB.2.21.1.1706281259170.84669@virtualbox","subject":"Re: requesting permission to use some Git for Windows code","fromName":"Brandon Casey","fromEmail":"drafnel@gmail.com","sentAt":"2017-07-28T05:31:32Z","receivedAt":"2017-07-28T05:31:41Z","isPatch":false,"sender":{"key":"drafnel@gmail.com","avatar":"https://avatars.githubusercontent.com/u/921167?v=4"},"body":"Hi Philippe,\n\nPlease feel free to use my portions of the mentioned works under the GPLv3.\n\n-Brandon\n\nOn Tue, Jul 25, 2017 at 6:53 AM, Johannes Schindelin\n<Johannes.Schindelin@gmx.de> wrote:\n> Hi Philippe,\n>\n> I am not quite certain whether I have replied to this earlier or not.\n> Under the assumption that I did not, I'll send this mail; Cc:ed to the\n> mailing lists as discussed privately.\n>\n> On Fri, 23 Jun 2017, Philippe Joyez wrote:\n>\n>> This message is to request the permission to use code chunks from Git\n>> for Windows in GNU TeXmacs <http://texmacs.org/>, to which I contribute.\n>> The main developer of TeXmacs is Joris van der Hoeven (in cc).\n>>\n>> Context:\n>>\n>> Just like Git, TeXmacs originated on *nix platforms and was subsequently\n>> ported to windows using MinGW. Naturally, some issues we have in that\n>> port are the very same Git for Windows has faced.\n>>\n>> One specific problem you have solved and that TeXmacs still hasn't, is\n>> dealing with unicode filenames. By taking relevant pieces of code in Git\n>> for windows, I could easily come up with a patch that enables TeXmacs to\n>> handle unicode filenames in windows.\n>>\n>> Now, the problem is that Git code is GPL V2, while TeXmacs is GPL V3:\n>> Incorporating my patch in TeXmacs' trunk would be a violation of GPL\n>> V2... /unless/ we are granted the permission to do so by the authors of\n>> the code. This is precisely the reason for this message.\n>\n> It is great that you can make use of the code!\n>\n> As to the licensing problem, I agree it is a hassle. The biggest obstacle\n> is that you have to have the consent of all the authors.\n>\n> You hereby have mine.\n>\n>> The chunks of code we would like to reuse are from these Git for Windows\n>> files:\n>> git-compat-util.h\n>\n> This file is quite large, maybe you can cut down on the authors to contact\n> by restricting the `git annotate`/`git log`/`git shortlog` calls to\n> specific parts, using the `-L <start-line-no>,<end-line-no>` option?\n>\n>> ctype.c\n>\n> $ git shortlog -nse ctype.c\n>      5  Junio C Hamano <gitster@pobox.com>\n>      4  René Scharfe <l.s.r@web.de>\n>      2  Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\n>      1  Ben Walton <bdwalton@gmail.com>\n>      1  Brandon Casey <drafnel@gmail.com>\n>      1  Gary V. Vaughan <git@mlists.thewrittenword.com>\n>      1  Linus Torvalds <torvalds@linux-foundation.org>\n>      1  Namhyung Kim <namhyung@gmail.com>\n>\n> I *think* Ben Walton's change (189c860c9ec (kwset: use unsigned char to\n> store values with high-bit set, 2015-03-02)) is not copyright-able, as it\n> only changes the type from signed to unsigned. But I am not a lawyer ;-)\n>\n> Likewise, Namhyung Kim's change (1a191a22959 (ctype.c only wants\n> git-compat-util.h, 2012-02-10)) only changes which header is included.\n> That seems to be a too-obvious/too-trivial change to me.\n>\n> Also, it looks as if removing a comma as was done in 4b05548fc05 (enums:\n> omit trailing comma for portability, 2010-05-14) by Gary V. Vaughan would\n> not merit any copyright.\n>\n> If in doubt, you could simply take the version of ctype.c with those\n> changes reverted as basis of your work.\n>\n> You still have to get the consent of Junio, René, Duy, Brandon and Linus\n> to relicense the file's contents.\n>\n>> compat ¬\n>>    mingw.c\n>\n> I count 35 authors other than myself for that file... Maybe you can narrow\n> down what you need?\n>\n>>    mingw.h\n>\n> Still 29 authors other than me...\n>\n>>    win32.h\n>\n> This is more manageable, as it only saw three authors. But then, you could\n> simply reimplement the functionality, it's just two functions, and I do\n> not think that get_file_attr() is implemented in the best way: we have a\n> function called err_win_to_posix() in compat/mingw.c which is much more\n> complete.\n>\n> Having said that, err_win_to_posix() is still not implemented in the best\n> way. The best way is to abuse Windows' own (undocumented) _doserrmap()\n> function along with the information in the header files winerror.h and\n> errno.h to generate the mapping. Those two files, as per mingw-w64's\n> headers, have the very nice preamble:\n>\n>         /**\n>          * This file has no copyright assigned and is placed in the Public Domain.\n>          * This file is part of the mingw-w64 runtime package.\n>          * No warranty is given; refer to the file DISCLAIMER.PD within this\n>          * package.\n>          */\n>\n> Therefore, the result has no copyright assigned and is placed in the\n> Public Domain and we can do the very same, too.\n>\n> As I wanted to have a Windows error -> errno mapping that I could\n> relicense as I see fit, anyway, I took this as an excellent opportunity to\n> generate exactly that.\n>\n> Please find the header attached. Here is how I generated that header file:\n>\n> -- snip --\n> cat >/tmp/generrmap.c <<EOF &&\n> #include <windows.h>\n> #include <stdio.h>\n>\n> static void map_code(unsigned long code, const char *id);\n>\n> int _main(int argc, char **argv)\n> {\n>         printf(\"/* This file has no copyright assigned and is placed in the \"\n>                 \"Public Domain. */\\\\n\"\n>                 \"\\\\n\"\n>                 \"#ifndef WINERR2ERRNO_H\\\\n\"\n>                 \"#define WINERR2ERRNO_H\\\\n\"\n>                 \"\\\\n\"\n>                 \"static int winerror2errno(long code)\\\\n\"\n>                 \"{\\\\n\");\n> $(sed -n 's/^#define \\([^ ]*\\) __MSABI_LONG([1-9].*/\\tmap_code(\\1, \"\\1\");/p' \\\n>         </mingw64/x86_64-w64-mingw32/include/winerror.h)\n>         printf(\"\\\\tdefault: errno = EINVAL;\\\\n\"\n>                 \"\\\\t}\\\\n\"\n>                 \"\\\\n\"\n>                 \"\\\\treturn -1; /* Typical return value when errno was set */\\\\n\"\n>                 \"}\\\\n\"\n>                 \"\\\\n\"\n>                 \"#endif /* WINERR2ERRNO_H */\\\\n\");\n>         fflush(stdout);\n>         return 0;\n> }\n>\n> /* Undocumented function in the MSVCRT */\n> extern void _dosmaperr(unsigned long code);\n>\n> static const char *errno2constant(int err, const char *id)\n> {\n>         switch (err) {\n> $(sed -n 's/^#define \\([^ ]*\\) \\([0-9]*\\)$/\\tcase \\2: return \"\\1\";/p' \\\n>         </mingw64/x86_64-w64-mingw32/include/errno.h)\n>         default:\n>                 fprintf(stderr, \"Unhandled err: %d (for %s)\\\\n\", err, id);\n>                 exit(1);\n>         }\n> }\n>\n> static void map_code(unsigned long code, const char *id)\n> {\n>         errno = 0;\n>         _dosmaperr(code);\n>         if (!errno) {\n>                 fprintf(stderr, \"Unhandled id: '%s' (%ld)\\\\n\", id, code);\n>                 exit(1);\n>         }\n>         if (errno != EINVAL)\n>                 printf(\"\\\\tcase %s: errno = %s;\\\\n\",\n>                         id, errno2constant(errno, id));\n> }\n> EOF\n> gcc -g -nostdlib -o /tmp/generrmap.exe /tmp/generrmap.c -lmsvcr120 &&\n> /tmp/generrmap\n> -- snap --\n>\n>>    win32 ¬\n>>         dirent.c\n>>         dirent.h\n>\n> I encourage you to have a look whether you really need that full-fledged\n> functionality.\n>\n> For vaguely related work, I recently reimplemented this differently, for\n> use in BusyBox-w32, where we really only need to have the file names. The\n> implementation is a lot cleaner, and I am happy to relicense this to\n> whatever license you see fit (even BSD):\n>\n>         https://github.com/git-for-windows/busybox-w32/commit/b76eee3aca\n>\n>>         lazyload.h\n>\n> This one was authored by me, and I am happy to relicense it to GPLv3. Or\n> whatever license, really.\n>\n> Ciao,\n> Johannes\n"},{"id":"325219","messageId":"d8fc1fdb-f326-d71d-f496-8293ed14bf68@gmail.com","threadId":"46465","inReplyTo":"CA+sFfMcAtStAfoc6Zaq7zW3cmYLu1QMX9_mmrRWe=M_GJYDeyw@mail.gmail.com","subject":"Re: requesting permission to use some Git for Windows code","fromName":"Marius Storm-Olsen","fromEmail":"mstormo@gmail.com","sentAt":"2017-07-28T15:26:48Z","receivedAt":"2017-07-28T15:26:55Z","isPatch":false,"sender":{"key":"mstormo@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1500?v=4"},"body":"Ditto, on any of my portions, if any left :)\n\n-- \n.marius\n\nOn 7/28/2017 00:31, Brandon Casey wrote:\n> Hi Philippe,\n>\n> Please feel free to use my portions of the mentioned works under the GPLv3.\n>\n> -Brandon\n>\n> On Tue, Jul 25, 2017 at 6:53 AM, Johannes Schindelin\n> <Johannes.Schindelin@gmx.de> wrote:\n>> Hi Philippe,\n>>\n>> I am not quite certain whether I have replied to this earlier or not.\n>> Under the assumption that I did not, I'll send this mail; Cc:ed to the\n>> mailing lists as discussed privately.\n>>\n>> On Fri, 23 Jun 2017, Philippe Joyez wrote:\n>>\n>>> This message is to request the permission to use code chunks from Git\n>>> for Windows in GNU TeXmacs <http://texmacs.org/>, to which I contribute.\n>>> The main developer of TeXmacs is Joris van der Hoeven (in cc).\n>>>\n>>> Context:\n>>>\n>>> Just like Git, TeXmacs originated on *nix platforms and was subsequently\n>>> ported to windows using MinGW. Naturally, some issues we have in that\n>>> port are the very same Git for Windows has faced.\n>>>\n>>> One specific problem you have solved and that TeXmacs still hasn't, is\n>>> dealing with unicode filenames. By taking relevant pieces of code in Git\n>>> for windows, I could easily come up with a patch that enables TeXmacs to\n>>> handle unicode filenames in windows.\n>>>\n>>> Now, the problem is that Git code is GPL V2, while TeXmacs is GPL V3:\n>>> Incorporating my patch in TeXmacs' trunk would be a violation of GPL\n>>> V2... /unless/ we are granted the permission to do so by the authors of\n>>> the code. This is precisely the reason for this message.\n>> It is great that you can make use of the code!\n>>\n>> As to the licensing problem, I agree it is a hassle. The biggest obstacle\n>> is that you have to have the consent of all the authors.\n>>\n>> You hereby have mine.\n>>\n>>> The chunks of code we would like to reuse are from these Git for Windows\n>>> files:\n>>> git-compat-util.h\n>> This file is quite large, maybe you can cut down on the authors to contact\n>> by restricting the `git annotate`/`git log`/`git shortlog` calls to\n>> specific parts, using the `-L <start-line-no>,<end-line-no>` option?\n>>\n>>> ctype.c\n>> $ git shortlog -nse ctype.c\n>>       5  Junio C Hamano <gitster@pobox.com>\n>>       4  René Scharfe <l.s.r@web.de>\n>>       2  Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\n>>       1  Ben Walton <bdwalton@gmail.com>\n>>       1  Brandon Casey <drafnel@gmail.com>\n>>       1  Gary V. Vaughan <git@mlists.thewrittenword.com>\n>>       1  Linus Torvalds <torvalds@linux-foundation.org>\n>>       1  Namhyung Kim <namhyung@gmail.com>\n>>\n>> I *think* Ben Walton's change (189c860c9ec (kwset: use unsigned char to\n>> store values with high-bit set, 2015-03-02)) is not copyright-able, as it\n>> only changes the type from signed to unsigned. But I am not a lawyer ;-)\n>>\n>> Likewise, Namhyung Kim's change (1a191a22959 (ctype.c only wants\n>> git-compat-util.h, 2012-02-10)) only changes which header is included.\n>> That seems to be a too-obvious/too-trivial change to me.\n>>\n>> Also, it looks as if removing a comma as was done in 4b05548fc05 (enums:\n>> omit trailing comma for portability, 2010-05-14) by Gary V. Vaughan would\n>> not merit any copyright.\n>>\n>> If in doubt, you could simply take the version of ctype.c with those\n>> changes reverted as basis of your work.\n>>\n>> You still have to get the consent of Junio, René, Duy, Brandon and Linus\n>> to relicense the file's contents.\n>>\n>>> compat ¬\n>>>     mingw.c\n>> I count 35 authors other than myself for that file... Maybe you can narrow\n>> down what you need?\n>>\n>>>     mingw.h\n>> Still 29 authors other than me...\n>>\n>>>     win32.h\n>> This is more manageable, as it only saw three authors. But then, you could\n>> simply reimplement the functionality, it's just two functions, and I do\n>> not think that get_file_attr() is implemented in the best way: we have a\n>> function called err_win_to_posix() in compat/mingw.c which is much more\n>> complete.\n>>\n>> Having said that, err_win_to_posix() is still not implemented in the best\n>> way. The best way is to abuse Windows' own (undocumented) _doserrmap()\n>> function along with the information in the header files winerror.h and\n>> errno.h to generate the mapping. Those two files, as per mingw-w64's\n>> headers, have the very nice preamble:\n>>\n>>          /**\n>>           * This file has no copyright assigned and is placed in the Public Domain.\n>>           * This file is part of the mingw-w64 runtime package.\n>>           * No warranty is given; refer to the file DISCLAIMER.PD within this\n>>           * package.\n>>           */\n>>\n>> Therefore, the result has no copyright assigned and is placed in the\n>> Public Domain and we can do the very same, too.\n>>\n>> As I wanted to have a Windows error -> errno mapping that I could\n>> relicense as I see fit, anyway, I took this as an excellent opportunity to\n>> generate exactly that.\n>>\n>> Please find the header attached. Here is how I generated that header file:\n>>\n>> -- snip --\n>> cat >/tmp/generrmap.c <<EOF &&\n>> #include <windows.h>\n>> #include <stdio.h>\n>>\n>> static void map_code(unsigned long code, const char *id);\n>>\n>> int _main(int argc, char **argv)\n>> {\n>>          printf(\"/* This file has no copyright assigned and is placed in the \"\n>>                  \"Public Domain. */\\\\n\"\n>>                  \"\\\\n\"\n>>                  \"#ifndef WINERR2ERRNO_H\\\\n\"\n>>                  \"#define WINERR2ERRNO_H\\\\n\"\n>>                  \"\\\\n\"\n>>                  \"static int winerror2errno(long code)\\\\n\"\n>>                  \"{\\\\n\");\n>> $(sed -n 's/^#define \\([^ ]*\\) __MSABI_LONG([1-9].*/\\tmap_code(\\1, \"\\1\");/p' \\\n>>          </mingw64/x86_64-w64-mingw32/include/winerror.h)\n>>          printf(\"\\\\tdefault: errno = EINVAL;\\\\n\"\n>>                  \"\\\\t}\\\\n\"\n>>                  \"\\\\n\"\n>>                  \"\\\\treturn -1; /* Typical return value when errno was set */\\\\n\"\n>>                  \"}\\\\n\"\n>>                  \"\\\\n\"\n>>                  \"#endif /* WINERR2ERRNO_H */\\\\n\");\n>>          fflush(stdout);\n>>          return 0;\n>> }\n>>\n>> /* Undocumented function in the MSVCRT */\n>> extern void _dosmaperr(unsigned long code);\n>>\n>> static const char *errno2constant(int err, const char *id)\n>> {\n>>          switch (err) {\n>> $(sed -n 's/^#define \\([^ ]*\\) \\([0-9]*\\)$/\\tcase \\2: return \"\\1\";/p' \\\n>>          </mingw64/x86_64-w64-mingw32/include/errno.h)\n>>          default:\n>>                  fprintf(stderr, \"Unhandled err: %d (for %s)\\\\n\", err, id);\n>>                  exit(1);\n>>          }\n>> }\n>>\n>> static void map_code(unsigned long code, const char *id)\n>> {\n>>          errno = 0;\n>>          _dosmaperr(code);\n>>          if (!errno) {\n>>                  fprintf(stderr, \"Unhandled id: '%s' (%ld)\\\\n\", id, code);\n>>                  exit(1);\n>>          }\n>>          if (errno != EINVAL)\n>>                  printf(\"\\\\tcase %s: errno = %s;\\\\n\",\n>>                          id, errno2constant(errno, id));\n>> }\n>> EOF\n>> gcc -g -nostdlib -o /tmp/generrmap.exe /tmp/generrmap.c -lmsvcr120 &&\n>> /tmp/generrmap\n>> -- snap --\n>>\n>>>     win32 ¬\n>>>          dirent.c\n>>>          dirent.h\n>> I encourage you to have a look whether you really need that full-fledged\n>> functionality.\n>>\n>> For vaguely related work, I recently reimplemented this differently, for\n>> use in BusyBox-w32, where we really only need to have the file names. The\n>> implementation is a lot cleaner, and I am happy to relicense this to\n>> whatever license you see fit (even BSD):\n>>\n>>          https://github.com/git-for-windows/busybox-w32/commit/b76eee3aca\n>>\n>>>          lazyload.h\n>> This one was authored by me, and I am happy to relicense it to GPLv3. Or\n>> whatever license, really.\n>>\n>> Ciao,\n>> Johannes\n\n"}]}