On 3/5/12 5:21 PM, fabrizio gennari wrote: > Hello. > > I tried to build bash-4.2 for the DJGPP (GNU for MS-DOS) > platform. It had been done before, but the latest available version was > 2.04. > > Something interesting has been found in the process. First: > version.c protects the use of snprintf with #if defined > (HAVE_SNPRINTF). But HAVE_SNPRINTF is always defined, only it is > defined as 0 if snprintf is not available. Here is a patch to fix that.
It's interesting that djgpp would somehow require this. snprintf *is* always available; if libc doesn't provide it, bash uses the replacement function in lib/sh/snprintf.c. There are other places in the code (e.g., builtins/mapfile.c) where it uses snprintf unconditionally. I'd be more interested in why the replacement function is apparently not being used here. > Second, the variable > job_control is only declared when JOB_CONTROL is #define'd. Yet, there > is one case where its use is not protected by a suitable #if. Here's a > patch to fix that. This is bash-4.2 patch 18. > Third, a comment in posixdir.h says "Posix does not > require that the d_ino field be present, and some systems do not > provide it". But the #if statement immediately above seems to implay > that all non-Posix systems have it, because it assumes that it is > always present if _POSIX_SOURCE is not defined. The following patch > conditions the use of d_ino to the fact that configure successfully > tests it, independently of _POSIX_SOURCE. Also, it avoids using > d_fileno not only when d_ino is broken, but also when it is missing > altogether. Thanks. This is good. It's always better to use feature checks instead of relying on something like _POSIX_SOURCE. > > If the above patches were applied, it would be a big step > towards having a new version of bash for DJGPP. It wouldn't be enough, > because DJGPP does not support the signals SIGCHLD and SIGWINCH and the > flag SA_RESTART. And the code would improve anyway, because they fixed > some little-tested cases. I'll take a look at where these are used without testing for their presence. Chet -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, ITS, CWRU c...@case.edu http://cnswww.cns.cwru.edu/~chet/