diff options
author | Paul Smith <psmith@gnu.org> | 2005-06-25 23:00:17 +0000 |
---|---|---|
committer | Paul Smith <psmith@gnu.org> | 2005-06-25 23:00:17 +0000 |
commit | f388233b033ccae26e567fb573fd3d7a87c71744 (patch) | |
tree | 1c51defb3a7e907880bb538ce9fd19bf6333d7d2 | |
parent | 6cdaff0948bbec3220d5cb071f79d5f2e1c9b083 (diff) | |
download | gunmake-f388233b033ccae26e567fb573fd3d7a87c71744.tar.gz |
Fix Savannah bug # 13478. If -L is given, take the latest mtime for a
symlink even if it is "dangling" (it doesn't resolve to a real file).
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | glob/ChangeLog | 5 | ||||
-rw-r--r-- | glob/fnmatch.h | 4 | ||||
-rw-r--r-- | glob/glob.c | 5 | ||||
-rw-r--r-- | glob/glob.h | 2 | ||||
-rw-r--r-- | make.h | 7 | ||||
-rw-r--r-- | read.c | 3 | ||||
-rw-r--r-- | remake.c | 18 | ||||
-rw-r--r-- | tests/ChangeLog | 3 | ||||
-rw-r--r-- | tests/scripts/options/symlinks | 13 |
10 files changed, 51 insertions, 17 deletions
@@ -1,5 +1,13 @@ 2005-06-25 Paul D. Smith <psmith@gnu.org> + * make.h [WINDOWS32]: #include <direct.h>. + Fixes Savannah bug #13478. + + * remake.c (name_mtime): If the stat() of a file fails and the -L + option was given and the file is a symlink, take the best mtime of + the symlink we can get as the mtime of the file and don't fail. + Fixes Savannah bug #13280. + Fix Savannah bug #1454. * read.c (find_char_unquote): Accept a new argument IGNOREVARS. diff --git a/glob/ChangeLog b/glob/ChangeLog index e4879b5..18c3172 100644 --- a/glob/ChangeLog +++ b/glob/ChangeLog @@ -1,3 +1,8 @@ +2005-06-25 Paul D. Smith <psmith@gnu.org> + + * fnmatch.h, glob.h [WINDOWS32]: Fix ifdefs in headers. + Fixes Savannah bug #13477. + 2005-03-11 Paul D. Smith <psmith@gnu.org> * glob.c (glob_in_dir): Change FNM_CASEFOLD to be enabled if diff --git a/glob/fnmatch.h b/glob/fnmatch.h index cc3ec37..54cbf59 100644 --- a/glob/fnmatch.h +++ b/glob/fnmatch.h @@ -24,7 +24,7 @@ extern "C" { #endif #if defined __cplusplus || (defined __STDC__ && __STDC__) || defined WINDOWS32 -# if !defined __GLIBC__ || !defined __P +# if !defined __GLIBC__ # undef __P # define __P(protos) protos # endif @@ -37,7 +37,7 @@ extern "C" { #endif /* C++ or ANSI C. */ #ifndef const -# if (defined __STDC__ && __STDC__) || defined __cplusplus +# if (defined __STDC__ && __STDC__) || defined __cplusplus || defined WINDOWS32 # define __const const # else # define __const diff --git a/glob/glob.c b/glob/glob.c index 80d667c..20c48f7 100644 --- a/glob/glob.c +++ b/glob/glob.c @@ -299,11 +299,8 @@ static int glob_in_dir __P ((const char *pattern, const char *directory, static int prefix_array __P ((const char *prefix, char **array, size_t n)); static int collated_compare __P ((const __ptr_t, const __ptr_t)); -#ifdef VMS -/* these compilers like prototypes */ #if !defined _LIBC || !defined NO_GLOB_PATTERN_P -int __glob_pattern_p (const char *pattern, int quote); -#endif +int __glob_pattern_p __P ((const char *pattern, int quote)); #endif /* Find the end of the sub-pattern in a brace expression. We define diff --git a/glob/glob.h b/glob/glob.h index ca523f7..b307c25 100644 --- a/glob/glob.h +++ b/glob/glob.h @@ -24,7 +24,7 @@ extern "C" { #undef __ptr_t #if defined __cplusplus || (defined __STDC__ && __STDC__) || defined WINDOWS32 -# if !defined __GLIBC__ || !defined __P +# if !defined __GLIBC__ # undef __P # undef __PMT # define __P(protos) protos @@ -358,6 +358,11 @@ extern int strcmpi (const char *,const char *); # define PATH_SEPARATOR_CHAR ':' #endif +/* This is needed for getcwd() and chdir(). */ +#if defined(_MSC_VER) || defined(__BORLANDC__) +# include <direct.h> +#endif + #ifdef WINDOWS32 # include <fcntl.h> # include <malloc.h> @@ -481,7 +486,7 @@ extern long int lseek (); #ifdef HAVE_GETCWD # if !defined(VMS) && !defined(__DECC) extern char *getcwd (); -#endif +# endif #else extern char *getwd (); # define getcwd(buf, len) getwd (buf) @@ -2187,9 +2187,6 @@ find_char_unquote (char *string, int stop1, int stop2, int blank, { unsigned int string_len = 0; register char *p = string; - int pcount = 0; - char openparen; - char closeparen; if (ignorevars) ignorevars = '$'; @@ -1328,13 +1328,18 @@ name_mtime (char *name) int e; EINTRLOOP (e, stat (name, &st)); - if (e != 0) + if (e == 0) + mtime = FILE_TIMESTAMP_STAT_MODTIME (name, st); + else if (errno == ENOENT || errno == ENOTDIR) + mtime = NONEXISTENT_MTIME; + else { - if (errno != ENOENT && errno != ENOTDIR) - perror_with_name ("stat: ", name); + perror_with_name ("stat: ", name); return NONEXISTENT_MTIME; } - mtime = FILE_TIMESTAMP_STAT_MODTIME (name, st); + + /* If we get here we either found it, or it doesn't exist. + If it doesn't exist see if we can use a symlink mtime instead. */ #ifdef MAKE_SYMLINKS #ifndef S_ISLNK @@ -1361,8 +1366,9 @@ name_mtime (char *name) EINTRLOOP (e, lstat (lpath, &st)); if (e) { - /* Eh? Just take what we have. */ - perror_with_name ("lstat: ", lpath); + /* Just take what we have so far. */ + if (errno != ENOENT && errno != ENOTDIR) + perror_with_name ("lstat: ", lpath); break; } diff --git a/tests/ChangeLog b/tests/ChangeLog index fa6420d..143bc2f 100644 --- a/tests/ChangeLog +++ b/tests/ChangeLog @@ -1,5 +1,8 @@ 2005-06-25 Paul D. Smith <psmith@gnu.org> + * scripts/options/symlinks: Test symlinks to non-existent files. + Tests fix for Savannah bug #13280. + * scripts/misc/general3: Test semicolons in variable references. Tests fix for Savannah bug #1454. diff --git a/tests/scripts/options/symlinks b/tests/scripts/options/symlinks index 4dcc67a..d63e222 100644 --- a/tests/scripts/options/symlinks +++ b/tests/scripts/options/symlinks @@ -42,6 +42,19 @@ if (eval { symlink("",""); 1 }) { run_make_test(undef, '-L', "make targ from sym"); rmfiles('targ', 'dep', 'sym', 'dep1'); + + # Check handling when symlinks point to non-existent files. Without -L we + # should get an error: with -L we should use the timestamp of the symlink. + + symlink("../$dirname/dep", 'sym'); + run_make_test('targ: sym ; @echo make $@ from $<', '', + "#MAKE#: *** No rule to make target `sym', needed by `targ'. Stop.", 512); + + run_make_test('targ: sym ; @echo make $@ from $<', '-L', + 'make targ from sym'); + + + rmfiles('targ', 'sym'); } 1; |