Bug 3091 - xserver refuses non-empty fontdir
Summary: xserver refuses non-empty fontdir
Status: RESOLVED FIXED
Alias: None
Product: xorg
Classification: Unclassified
Component: Server/General (show other bugs)
Version: unspecified
Hardware: x86 (IA32) Windows (All)
: high normal
Assignee: Xorg Project Team
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-04-21 07:25 UTC by Alexander Gottwald
Modified: 2007-01-23 17:34 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments
3091.patch (1.17 KB, patch)
2007-01-18 13:09 UTC, Simon Law
no flags Details | Splinter Review
3091-2.patch (1.70 KB, patch)
2007-01-18 13:41 UTC, Simon Law
no flags Details | Splinter Review

Description Alexander Gottwald 2005-04-21 07:25:14 UTC
I have setup a fontdir with fonts.dir (0 entries) and fonts.alias (>0 entries)
xset fp+ fontdir causes an error. adding some entries to fonts.dir does work.

Is this intentional behaviour or should the check for an empty fontdir include
fonts.alias too?
Comment 1 Simon Law 2007-01-18 13:09:46 UTC
Created attachment 8439 [details] [review]
3091.patch

This patch makes libXfont recognize that a properly formatted fonts.dir file in
a directory with no fonts is still acceptable.	It also makes libXfont parse
fonts.alias, which is the desired behaviour.
Comment 2 Simon Law 2007-01-18 13:40:09 UTC
Comment on attachment 8439 [details] [review]
3091.patch

diff --git a/src/fontfile/dirfile.c b/src/fontfile/dirfile.c
index f390391..3159a5e 100644
--- a/src/fontfile/dirfile.c
+++ b/src/fontfile/dirfile.c
@@ -62,7 +62,7 @@ FontFileReadDirectory (char *directory, FontDirectoryPtr
*pdir)
     char	*ptr;
     FILE	*file;
     int	 count,
-		 i,
+		 num_fonts,
		 status;
     struct stat	statb;
     static char format[24] = "";
@@ -90,8 +90,6 @@ FontFileReadDirectory (char *directory, FontDirectoryPtr
*pdir)
     strcat(dir_file, FontDirFile);
     file = fopen(dir_file, "rt");
     if (file) {
-	Bool found_font = FALSE;
-
 #ifndef WIN32	      
	if (fstat (fileno(file), &statb) == -1)
 #else
@@ -101,12 +99,12 @@ FontFileReadDirectory (char *directory, FontDirectoryPtr
*pdir)
	     fclose(file);
	    return BadFontPath;
	 }
-	count = fscanf(file, "%d\n", &i);
+	count = fscanf(file, "%d\n", &num_fonts);
	if ((count == EOF) || (count != 1)) {
	    fclose(file);
	    return BadFontPath;
	}
-	dir = FontFileMakeDir(directory, i);
+	dir = FontFileMakeDir(directory, num_fonts);
	if (dir == NULL) {
	    fclose(file);
	    return BadFontPath;
@@ -128,13 +126,13 @@ FontFileReadDirectory (char *directory, FontDirectoryPtr
*pdir)
		fclose(file);
		return BadFontPath;
	    }
-	    if (FontFileAddFontFile (dir, font_name, file_name))
-		found_font = TRUE;
-	}
-	if (!found_font) {
-	    FontFileFreeDir (dir);
-	    fclose(file);
-	    return BadFontPath;
+
+	    /*
+	     * We blindly try to load all the font files specified.
+	     * In theory, we might want to warn that some of the fonts
+	     * couldn't be loaded.
+	     */
+	    FontFileAddFontFile (dir, font_name, file_name);
	}
	fclose(file);
Comment 3 Simon Law 2007-01-18 13:41:37 UTC
Created attachment 8440 [details] [review]
3091-2.patch

This patch just makes libXfont accept any syntactically valid fonts.dir,
instead of failing out if it finds no fonts.
Comment 4 Daniel Stone 2007-01-18 13:51:13 UTC
patch #2 pushed


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.