Date: Tue, 6 Oct 1998 15:30:44 +0300 (IDT) From: Eli Zaretskii X-Sender: eliz AT is To: Olivier Perron cc: M DOT A DOT Bukin AT ino DOT nsk DOT ru, nate AT cartsys DOT com, djgpp AT delorie DOT com Subject: Re: /dev/null problems with bash when rebuild from sources In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Reply-To: djgpp AT delorie DOT com On Tue, 6 Oct 1998, Olivier Perron wrote: > Here are some results: because of the value of SYSROOT being "C:", > dosutil_expand_path expands /dev/null to c:/dev/null. > Then a call to 'open' is performed with "c:/dev/null" as first argument. > It is this call which fails. > > A little test program easily shows that 'stat' and 'open' effectively fail > with "c:/dev/null" but not with "/dev/null". Seems like the problem is in `putpath', then. But I thought that the version of `putpath' in the patched libc is already corrected. Nate? I append below the corrected version of putpath.c. Compile it, put putpath.o into libc.a, relink, and Bash should work with /dev/null. /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */ #include #include #include #include #include #include #include void _put_path(const char *path) { _put_path2(path, 0); } void _put_path2(const char *path, int offset) { int o, space = _go32_info_block.size_of_transfer_buffer - offset; const char *p = path; if (path == 0) { errno = EFAULT; abort(); } if (p[0] && p[1] == ':') p += 2; if (strcmp(p, "/dev/null") == 0) path = "nul"; else if (strcmp(p, "/dev/tty") == 0) path = "con"; else if (strncmp(p, "/dev/", 5) == 0 && p[5] != 0) path = p + 5; _farsetsel(_dos_ds); /* collapse multiple slashes to a single slash */ for (o=__tb+offset; *path; path++) { if (path[0] != '/' || path[1] != '/') { _farnspokeb(o, *path); o++; if (--space < 2) /* safety check */ break; } } /* remove trailing slash if it doesn't represent the root directory */ if (o-2 >= __tb+offset && _farnspeekb(o-1) == '/' && _farnspeekb(o-2) != ':') o--; /* null terminate it */ _farnspokeb(o, 0); }