[vim/vim] Error introduced to make xxd in patch 1827 (Issue #12991)

67 views
Skip to first unread message

Steven Martin

unread,
Aug 31, 2023, 6:38:38 PM8/31/23
to vim/vim, Subscribed

Steps to reproduce

  1. On Windows/Cygwin
  2. cd to vim repository
  3. git pull and branch v9.0.1827 or later
  4. make # This will succeed
  5. make install # This will fail due to STDOUT_FILENO not defined error

Error occurs when compiling xxd.c

gcc  -ggdb -O2 -pipe -w -fstack-protector-strong --param=ssp-buffer-size=4 -fstack-protector-strong -D_REENTRANT -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -L/usr/local/lib -Wl,--as-needed -DUNIX -o xxd xxd.c
xxd.c: In function ‘main’:
xxd.c:569:18: error: ‘STDOUT_FILENO’ undeclared (first use in this function)
  569 |   color = isatty(STDOUT_FILENO);
      |                  ^~~~~~~~~~~~~
xxd.c:569:18: note: each undeclared identifier is reported only once for each function it appears in
make[1]: *** [Makefile:4: xxd] Error 1
make[1]: Leaving directory '/home/smartin/src/github/vim/src/xxd'
make: *** [Makefile:2065: xxd/xxd.exe] Error 2

Expected behaviour

xxd should compile and be installed as before

Version of Vim

9.0.1827

Environment

Operating System: Cygwin (Windows)

Logs and stack traces

This was introduced with 1827 by adding the following lines to xxd.c:

568-#ifdef UNIX
569:  color = isatty(STDOUT_FILENO);
570-#endif

For UNIX this was added:
#include <unistd.h> 

However, this also needs to be in the Cygwin section, here is my fix:

diff --git a/src/xxd/xxd.c b/src/xxd/xxd.c
index 590cd44aad..5c6e549da3 100644
--- a/src/xxd/xxd.c
+++ b/src/xxd/xxd.c
@@ -87,6 +87,9 @@
 #endif
 #if defined(WIN32) || defined(CYGWIN)
 # include <io.h>       /* for setmode() */
+# if defined(CYGWIN)
+#  include <unistd.h>
+# endif
 #else
 # ifdef UNIX
 #  include <unistd.h>


Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/12991@github.com>

Christian Brabandt

unread,
Sep 1, 2023, 12:45:12 PM9/1/23
to vim/vim, Subscribed

Closed #12991 as completed via f6fc255.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issue/12991/issue_event/10259217422@github.com>

Reply all
Reply to author
Forward
0 new messages