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).
This commit is contained in:
Paul Smith 2005-06-25 23:00:17 +00:00
parent 6cdaff0948
commit f388233b03
10 changed files with 51 additions and 17 deletions

View file

@ -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.

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

5
make.h
View file

@ -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>

3
read.c
View file

@ -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 = '$';

View file

@ -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);
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,7 +1366,8 @@ name_mtime (char *name)
EINTRLOOP (e, lstat (lpath, &st));
if (e)
{
/* Eh? Just take what we have. */
/* Just take what we have so far. */
if (errno != ENOENT && errno != ENOTDIR)
perror_with_name ("lstat: ", lpath);
break;
}

View file

@ -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.

View file

@ -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;