Johannes Schindelin <johannes.schinde...@gmx.de> writes:

> This is the offending part from last night's build:
>
> -- snipsnap --
> 2016-11-16T00:31:57.5321220Z copy.c: In function 'copy_dir_1':
> 2016-11-16T00:31:57.5321220Z copy.c:369:8: error: implicit declaration of 
> function 'lchown' [-Werror=implicit-function-declaration]
> 2016-11-16T00:31:57.5321220Z     if (lchown(dest, source_stat.st_uid, 
> source_stat.st_gid) < 0)
> 2016-11-16T00:31:57.5321220Z         ^~~~~~
> 2016-11-16T00:31:57.5321220Z copy.c:391:7: error: implicit declaration of 
> function 'mknod' [-Werror=implicit-function-declaration]
> 2016-11-16T00:31:57.5321220Z    if (mknod(dest, source_stat.st_mode, 
> source_stat.st_rdev) < 0)
> 2016-11-16T00:31:57.5321220Z        ^~~~~
> 2016-11-16T00:31:57.5321220Z copy.c:405:7: error: implicit declaration of 
> function 'utimes' [-Werror=implicit-function-declaration]
> 2016-11-16T00:31:57.5321220Z    if (utimes(dest, times) < 0)
> 2016-11-16T00:31:57.5321220Z        ^~~~~~
> 2016-11-16T00:31:57.5321220Z copy.c:407:7: error: implicit declaration of 
> function 'chown' [-Werror=implicit-function-declaration]
> 2016-11-16T00:31:57.5321220Z    if (chown(dest, source_stat.st_uid, 
> source_stat.st_gid) < 0) {
> 2016-11-16T00:31:57.5321220Z        ^~~~~
> 2016-11-16T00:31:57.7982432Z     CC ctype.o
> 2016-11-16T00:31:58.1418929Z cc1.exe: all warnings being treated as errors
> 2016-11-16T00:31:58.6368128Z make: *** [Makefile:1988: copy.o] Error 1

That looks like a part of the new 'instead of run_command("cp -R"),
let's borrow code from somewhere and do that ourselves' in the
nd/worktree-move topic.

The offending part is this:

+       if (S_ISBLK(source_stat.st_mode) ||
+           S_ISCHR(source_stat.st_mode) ||
+           S_ISSOCK(source_stat.st_mode) ||
+           S_ISFIFO(source_stat.st_mode)) {
+               if (mknod(dest, source_stat.st_mode, source_stat.st_rdev) < 0)
+                       return error_errno(_("can't create '%s'"), dest);
+       } else
+               return error(_("unrecognized file '%s' with mode %x"),
+                            source, source_stat.st_mode);

I think all of this is meant to be used to copy what is in the
working tree, and what is in the working tree is meant to be tracked
by Git, none of the four types that triggers mknod() would be
relevant for our purpose.  The simplest and cleanest would be to
make the above to return error("unsupported filetype").

I do not mind run_command("cp -R") and get rid of this code
altogether; that might be a more portable and sensible approach.

Reply via email to