diff, patch: add config.h and -I. to fix 'stdin does not exist'#153
Conversation
Both packages' source files include <config.h> when HAVE_CONFIG_H is defined, but neither mkfile had -I. so cpp couldn't find config.h, causing the Plan9 'stdin does not exist' pipeline error. Add minimal config.h to each build directory with the HAVE_* flags appropriate for Plan9/APE (sigaction, fork, stat fields; no stack overflow recovery). Add -I. to CFLAGS so the build-dir config.h is found before any system headers. https://claude.ai/code/session_01WGAwvvTwDg2yknFkmZ3qzs
There was a problem hiding this comment.
Code Review
This pull request introduces configuration headers and build script updates to support GNU diffutils and patch on Plan 9/APE. Specifically, it adds config.h files for both tools and modifies their mkfile configurations to include the local directory in the compiler's search path. A critical correction was identified in the diff configuration where certain structure members were incorrectly marked as available, which would lead to compilation failures in the APE environment.
| #define HAVE_STRUCT_DIRENT_D_TYPE 1 | ||
| #define HAVE_TM_GMTOFF 1 |
There was a problem hiding this comment.
The Plan 9 APE environment does not provide the d_type member in struct dirent (defined in <dirent.h>) nor the tm_gmtoff member in struct tm (defined in <time.h>). Defining these macros as 1 will cause compilation errors when the source code attempts to access these non-existent fields. These should be undefined for the APE port.
| #define HAVE_STRUCT_DIRENT_D_TYPE 1 | |
| #define HAVE_TM_GMTOFF 1 | |
| #undef HAVE_STRUCT_DIRENT_D_TYPE | |
| #undef HAVE_TM_GMTOFF |
Both packages' source files include <config.h> when HAVE_CONFIG_H is defined, but neither mkfile had -I. so cpp couldn't find config.h, causing the Plan9 'stdin does not exist' pipeline error.
Add minimal config.h to each build directory with the HAVE_* flags appropriate for Plan9/APE (sigaction, fork, stat fields; no stack overflow recovery). Add -I. to CFLAGS so the build-dir config.h is found before any system headers.
https://claude.ai/code/session_01WGAwvvTwDg2yknFkmZ3qzs