Thread View: gnu.bash.bug
1 messages
1 total messages
Started by Chip Salzenberg
Tue, 06 Feb 1990 17:38
Bash 1.04 patch: trailing ":" in PATH
Author: Chip Salzenberg
Date: Tue, 06 Feb 1990 17:38
Date: Tue, 06 Feb 1990 17:38
49 lines
1742 bytes
1742 bytes
Bash 1.04 correctly interprets a PATH of ":/bin:/usr/bin" to mean
"search the currect directory first." However, it does not correctly
interpret "/bin:/usr/bin:" which is supposed to mean "search the
current directory last." This patch fixes the bug.
Note that this bug affects CDPATH as well, and this patch fixes it too.
Index: execute_cmd.c
***************
*** 1537,1547 ****
int i, start;
! i = start = *index;
! if ((i >= strlen (string)) || !string) return ((char *)NULL);
! while (string[i] && string[i] != ':') i++;
if (i == start) {
- if (!string[i]) return ((char *)NULL);
- (*index)++;
return (savestring (""));
} else {
--- 1537,1551 ----
int i, start;
! i = *index;
! if ((i >= strlen (string)) || !string)
! return ((char *)NULL);
! if (string[i] == ':')
! i++;
! start = i;
! while (string[i] && string[i] != ':')
! i++;
! *index = i;
if (i == start) {
return (savestring (""));
} else {
***************
*** 1549,1554 ****
strncpy (value, &string[start], (i - start));
value [i - start] = '\0';
- if (string[i]) ++i;
- *index = i;
return (value);
}
--- 1553,1556 ----
--
Chip Salzenberg at ComDev/TCT <chip%tct@ateng.com>, <uunet!ateng!tct!chip>
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads