1 *** ../bash-2.05b-patched/builtins/common.c Fri Jun 28 12:24:31 2002
2 --- builtins/common.c Thu Sep 30 22:25:20 2004
10 ! if (the_current_working_directory)
11 ! free (the_current_working_directory);
13 the_current_working_directory = (char *)NULL;
20 if (no_symbolic_links)
22 ! FREE (the_current_working_directory);
23 the_current_working_directory = (char *)NULL;
27 if (the_current_working_directory == 0)
29 ! the_current_working_directory = (char *)xmalloc (PATH_MAX);
30 ! the_current_working_directory[0] = '\0';
31 ! directory = getcwd (the_current_working_directory, PATH_MAX);
34 ! fprintf (stderr, "%s: could not get current directory: %s: %s\n",
35 (for_whom && *for_whom) ? for_whom : get_name_for_error (),
36 ! bash_getcwd_errstr, strerror (errno));
38 ! free (the_current_working_directory);
39 ! the_current_working_directory = (char *)NULL;
43 if (the_current_working_directory == 0)
45 ! the_current_working_directory = getcwd (0, 0);
46 ! if (the_current_working_directory == 0)
48 ! fprintf (stderr, _("%s: error retrieving current directory: %s: %s\n"),
49 (for_whom && *for_whom) ? for_whom : get_name_for_error (),
50 ! _(bash_getcwd_errstr), strerror (errno));
53 *** ../bash-2.05b-patched/builtins/cd.def Mon Jul 15 14:51:39 2002
54 --- builtins/cd.def Sun Nov 7 15:13:42 2004
57 the_current_working_directory () */
63 the_current_working_directory () */
71 FREE (the_current_working_directory);
72 the_current_working_directory = (char *)NULL;
73 ! tdir = get_working_directory ("cd");
77 FREE (the_current_working_directory);
78 the_current_working_directory = (char *)NULL;
79 ! tdir = get_working_directory (caller);
85 directory = tcwd ? (verbatim_pwd ? sh_physpath (tcwd, 0) : tcwd)
86 : get_working_directory ("pwd");
88 + /* Try again using getcwd() if canonicalization fails (for instance, if
89 + the file system has changed state underneath bash). */
90 + if (tcwd && directory == 0)
91 + directory = resetpwd ("pwd");
99 ! int err, canon_failed;
105 ! int err, canon_failed, r;
110 if (posixly_correct && nolinks == 0 && canon_failed)
116 if (posixly_correct && nolinks == 0 && canon_failed)
118 ! #if defined ENAMETOOLONG
119 ! if (errno != ENOENT && errno != ENAMETOOLONG)
121 ! if (errno != ENOENT)
128 shell's idea of the_current_working_directory. */
133 ! FREE (the_current_working_directory);
134 ! the_current_working_directory = tdir;
139 shell's idea of the_current_working_directory. */
142 ! t = resetpwd ("cd");
144 ! set_working_directory (tdir);
147 + set_working_directory (tdir);
156 /* We're not in physical mode (nolinks == 0), but we failed to change to
160 if (chdir (newdir) == 0)
162 ! tdir = resetpwd ();
175 if (chdir (newdir) == 0)
177 ! t = resetpwd ("cd");
179 ! set_working_directory (tdir);
197 *** ../bash-2.05b-patched/aclocal.m4 Tue Jun 25 09:45:43 2002
198 --- aclocal.m4 Sat Oct 9 15:03:28 2004
202 AC_DEFUN(BASH_FUNC_GETCWD,
203 ! [AC_MSG_CHECKING([if getcwd() calls popen()])
204 ! AC_CACHE_VAL(bash_cv_getcwd_calls_popen,
209 AC_DEFUN(BASH_FUNC_GETCWD,
210 ! [AC_MSG_CHECKING([if getcwd() will dynamically allocate memory])
211 ! AC_CACHE_VAL(bash_cv_getcwd_malloc,
227 - popen(command, type)
228 - const char *command;
232 - return (FILE *)NULL;
235 - FILE *_popen(command, type)
236 - const char *command;
239 - return (popen (command, type));
261 ! exit (popen_called);
263 ! ], bash_cv_getcwd_calls_popen=no, bash_cv_getcwd_calls_popen=yes,
264 ! [AC_MSG_WARN(cannot check whether getcwd calls popen if cross compiling -- defaulting to no)
265 ! bash_cv_getcwd_calls_popen=no]
267 ! AC_MSG_RESULT($bash_cv_getcwd_calls_popen)
268 ! if test $bash_cv_getcwd_calls_popen = yes; then
269 AC_DEFINE(GETCWD_BROKEN)
277 ! xpwd = getcwd(0, 0);
280 ! ], bash_cv_getcwd_malloc=yes, bash_cv_getcwd_malloc=no,
281 ! [AC_MSG_WARN(cannot check whether getcwd allocates memory when cross-compiling -- defaulting to no)
282 ! bash_cv_getcwd_malloc=no]
284 ! AC_MSG_RESULT($bash_cv_getcwd_malloc)
285 ! if test $bash_cv_getcwd_malloc = no; then
286 AC_DEFINE(GETCWD_BROKEN)