- resolves: #841431
ignore cached man pages if they don't exist anymore
This commit is contained in:
		
							parent
							
								
									750ea55889
								
							
						
					
					
						commit
						3e9a45f9e9
					
				
							
								
								
									
										123
									
								
								man-db-2.6.2-invalid-cache.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										123
									
								
								man-db-2.6.2-invalid-cache.patch
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,123 @@ | |||||||
|  | diff -upr man-db-2.6.2.orig/src/check_mandirs.c man-db-2.6.2/src/check_mandirs.c
 | ||||||
|  | --- man-db-2.6.2.orig/src/check_mandirs.c	2011-07-09 20:53:38.000000000 +0200
 | ||||||
|  | +++ man-db-2.6.2/src/check_mandirs.c	2012-07-31 13:05:45.967640117 +0200
 | ||||||
|  | @@ -190,8 +190,7 @@ void test_manfile (const char *file, con
 | ||||||
|  |  			   comp extensions */ | ||||||
|  |  			abs_filename = make_filename (path, NULL, | ||||||
|  |  						      exists, "man"); | ||||||
|  | -			debug ("test_manfile(): stat %s\n", abs_filename);
 | ||||||
|  | -			if (stat (abs_filename, &physical) == -1) {
 | ||||||
|  | +			if (abs_filename == NULL || stat (abs_filename, &physical) == -1) {
 | ||||||
|  |  				if (!opt_test) | ||||||
|  |  					dbdelete (manpage_base, exists); | ||||||
|  |  			} else { | ||||||
|  | diff -upr man-db-2.6.2.orig/src/filenames.c man-db-2.6.2/src/filenames.c
 | ||||||
|  | --- man-db-2.6.2.orig/src/filenames.c	2011-10-09 01:19:00.000000000 +0200
 | ||||||
|  | +++ man-db-2.6.2/src/filenames.c	2012-07-31 12:31:10.436885216 +0200
 | ||||||
|  | @@ -27,6 +27,7 @@
 | ||||||
|  |   | ||||||
|  |  #include <string.h> | ||||||
|  |  #include <stdlib.h> | ||||||
|  | +#include <unistd.h>
 | ||||||
|  |   | ||||||
|  |  #include "xvasprintf.h" | ||||||
|  |   | ||||||
|  | @@ -61,6 +62,11 @@ char *make_filename (const char *path, c
 | ||||||
|  |  	if (in->comp && *in->comp != '-')	/* Is there an extension? */ | ||||||
|  |  		file = appendstr (file, ".", in->comp, NULL); | ||||||
|  |   | ||||||
|  | +	if (access (file, R_OK) != 0) {
 | ||||||
|  | +		free (file);
 | ||||||
|  | +		return NULL;
 | ||||||
|  | +	}
 | ||||||
|  | +
 | ||||||
|  |  	return file; | ||||||
|  |  } | ||||||
|  |   | ||||||
|  | diff -upr man-db-2.6.2.orig/src/man.c man-db-2.6.2/src/man.c
 | ||||||
|  | --- man-db-2.6.2.orig/src/man.c	2012-05-15 01:24:17.000000000 +0200
 | ||||||
|  | +++ man-db-2.6.2/src/man.c	2012-07-31 13:04:48.629069419 +0200
 | ||||||
|  | @@ -3103,6 +3103,9 @@ static int add_candidate (struct candida
 | ||||||
|  |  			name = req_name; | ||||||
|  |   | ||||||
|  |  		filename = make_filename (path, name, source, cat ? "cat" : "man"); | ||||||
|  | +		if (filename == NULL) {
 | ||||||
|  | +			return 0;
 | ||||||
|  | +		}
 | ||||||
|  |  		ult = ult_src (filename, path, NULL, | ||||||
|  |  			       get_ult_flags (from_db, source->id), NULL); | ||||||
|  |  		free (filename); | ||||||
|  | @@ -3309,6 +3312,9 @@ static int display_filesystem (struct ca
 | ||||||
|  |  { | ||||||
|  |  	char *filename = make_filename (candp->path, NULL, candp->source, | ||||||
|  |  					candp->cat ? "cat" : "man"); | ||||||
|  | +	if (filename == NULL) {
 | ||||||
|  | +		return 0;
 | ||||||
|  | +	}
 | ||||||
|  |  	/* source->name is never NULL thanks to add_candidate() */ | ||||||
|  |  	char *title = appendstr (NULL, candp->source->name, | ||||||
|  |  				 "(", candp->source->ext, ")", NULL); | ||||||
|  | @@ -3392,14 +3398,14 @@ static int display_database (struct cand
 | ||||||
|  |   | ||||||
|  |  	if (in->id < STRAY_CAT) {	/* There should be a src page */ | ||||||
|  |  		file = make_filename (candp->path, name, in, "man"); | ||||||
|  | -		debug ("Checking physical location: %s\n", file);
 | ||||||
|  | +		if (file != NULL) {
 | ||||||
|  | +			debug ("Checking physical location: %s\n", file);
 | ||||||
|  |   | ||||||
|  | -		if (access (file, R_OK) == 0) {
 | ||||||
|  |  			const char *man_file; | ||||||
|  |  			char *cat_file; | ||||||
|  |   | ||||||
|  |  			man_file = ult_src (file, candp->path, NULL, | ||||||
|  | -					    get_ult_flags (1, in->id), NULL);
 | ||||||
|  | +						get_ult_flags (1, in->id), NULL);
 | ||||||
|  |  			if (man_file == NULL) { | ||||||
|  |  				free (title); | ||||||
|  |  				return found; /* zero */ | ||||||
|  | @@ -3416,7 +3422,7 @@ static int display_database (struct cand
 | ||||||
|  |  			free (lang); | ||||||
|  |  			lang = NULL; | ||||||
|  |  		} /* else {drop through to the bottom and return 0 anyway} */ | ||||||
|  | -	} else 
 | ||||||
|  | +	} else
 | ||||||
|  |   | ||||||
|  |  #endif /* NROFF_MISSING */ | ||||||
|  |   | ||||||
|  | @@ -3441,9 +3447,9 @@ static int display_database (struct cand
 | ||||||
|  |  		} | ||||||
|  |   | ||||||
|  |  		file = make_filename (candp->path, name, in, "cat"); | ||||||
|  | -		debug ("Checking physical location: %s\n", file);
 | ||||||
|  | -
 | ||||||
|  | -		if (access (file, R_OK) != 0) {
 | ||||||
|  | +		if (file != NULL) {
 | ||||||
|  | +			debug ("Checking physical location: %s\n", file);
 | ||||||
|  | +		} else {
 | ||||||
|  |  			char *catpath; | ||||||
|  |  			catpath = get_catpath (candp->path, | ||||||
|  |  					       global_manpath ? SYSTEM_CAT | ||||||
|  | @@ -3453,10 +3459,10 @@ static int display_database (struct cand
 | ||||||
|  |  				file = make_filename (catpath, name, | ||||||
|  |  						      in, "cat"); | ||||||
|  |  				free (catpath); | ||||||
|  | -				debug ("Checking physical location: %s\n",
 | ||||||
|  | -				       file);
 | ||||||
|  | -
 | ||||||
|  | -				if (access (file, R_OK) != 0) {
 | ||||||
|  | +				if (file != NULL) {
 | ||||||
|  | +					debug ("Checking physical location: %s\n",
 | ||||||
|  | +						   file);
 | ||||||
|  | +				} else {
 | ||||||
|  |  					/* don't delete here,  | ||||||
|  |  					   return==0 will do that */ | ||||||
|  |  					free (title); | ||||||
|  | @@ -3520,6 +3526,8 @@ static int maybe_update_file (const char
 | ||||||
|  |  		real_name = name; | ||||||
|  |   | ||||||
|  |  	file = make_filename (manpath, real_name, info, "man"); | ||||||
|  | +	if (file == NULL)
 | ||||||
|  | +		return 0;
 | ||||||
|  |  	if (lstat (file, &buf) != 0) | ||||||
|  |  		return 0; | ||||||
|  |  	if (buf.st_mtime == info->_st_mtime) | ||||||
| @ -4,7 +4,7 @@ | |||||||
| Summary: Tools for searching and reading man pages | Summary: Tools for searching and reading man pages | ||||||
| Name: man-db | Name: man-db | ||||||
| Version: 2.6.2 | Version: 2.6.2 | ||||||
| Release: 4%{?dist} | Release: 5%{?dist} | ||||||
| # project man-db  GPLv2+ | # project man-db  GPLv2+ | ||||||
| # Gnulib part     GPLv3+ | # Gnulib part     GPLv3+ | ||||||
| License: GPLv2+ and GPLv3+ | License: GPLv2+ and GPLv3+ | ||||||
| @ -21,6 +21,7 @@ Patch2: man-db-2.6.1-wildcards.patch | |||||||
| Patch3: man-db-2.6.1-so-links.patch | Patch3: man-db-2.6.1-so-links.patch | ||||||
| Patch4: man-db-2.6.1-locale-fallback.patch | Patch4: man-db-2.6.1-locale-fallback.patch | ||||||
| Patch5: man-db-2.6.2-gnulib.patch | Patch5: man-db-2.6.2-gnulib.patch | ||||||
|  | Patch6: man-db-2.6.2-invalid-cache.patch | ||||||
| 
 | 
 | ||||||
| Obsoletes: man < 2.0 | Obsoletes: man < 2.0 | ||||||
| Provides: man = %{version} | Provides: man = %{version} | ||||||
| @ -47,6 +48,7 @@ manual pages. | |||||||
| %patch3 -p1 -b .so-links | %patch3 -p1 -b .so-links | ||||||
| %patch4 -p1 -b .locale-fallback | %patch4 -p1 -b .locale-fallback | ||||||
| %patch5 -p1 -b .gnulib-fix | %patch5 -p1 -b .gnulib-fix | ||||||
|  | %patch6 -p1 -b .invalid-cache | ||||||
| 
 | 
 | ||||||
| %build | %build | ||||||
| %configure\ | %configure\ | ||||||
| @ -120,6 +122,10 @@ install -D -p -m 0644 %{SOURCE2} $RPM_BUILD_ROOT/etc/sysconfig/man-db | |||||||
| %lang(it)   %{_datadir}/man/it/man*/* | %lang(it)   %{_datadir}/man/it/man*/* | ||||||
| 
 | 
 | ||||||
| %changelog | %changelog | ||||||
|  | * Tue Jul 31 2012 Peter Schiffer <pschiffe@redhat.com> - 2.6.2-5 | ||||||
|  | - resolves: #841431 | ||||||
|  |   ignore cached man pages if they don't exist anymore | ||||||
|  | 
 | ||||||
| * Fri Jul 20 2012 Dan Horák <dan[at]danny.cz> - 2.6.2-4 | * Fri Jul 20 2012 Dan Horák <dan[at]danny.cz> - 2.6.2-4 | ||||||
| - fully patch the autotools files, fixes FTBFS due updated automake | - fully patch the autotools files, fixes FTBFS due updated automake | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user