Bug 12964

Summary: The FcStrCopyFilename function contradicts its documentation
Product: fontconfig Reporter: David <ssdk>
Component: libraryAssignee: Keith Packard <keithp>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: medium    
Version: 2.4   
Hardware: All   
OS: All   
i915 platform: i915 features:

Description David 2007-10-26 12:18:54 UTC
The description of the function FcStrCopyFilename states: "Just like FcStrCopy except that it converts any leading '~' characters in s to the value of the HOME environment variable". Meanwhile the description of the function FcStrCopy states: "Allocates memory, copies s and returns the resulting buffer". But, if the name of the input file is not a full path and its first character is not '~', the function FcStrCopyFilename adds the current directory to the returning value.

For example, if the current work directory of the program is '/home/ssdk/Testing/FcStringUtils/', the call of the function FcStrCopyFilename with the parameter '123' returns the string '/home/ssdk/Testing/FcStringUtils/123', what contradicts the documentation.

The detailed bug description can be found at: 

Comment 1 Keith Packard 2007-11-03 22:31:31 UTC
FcStrCopyFilename does a lot more than the documentation mentions. I've updated the docs to reflect its full scope:

<function>FcStrCopyFilename</function> constructs an absolute pathname from
<parameter>s</parameter>. It converts any leading '~' characters in
to the value of the HOME environment variable, and any relative paths are
converted to absolute paths using the current working directory. Sequences
of '/' characters are converted to a single '/', and names containing the
current directory '.' or parent directory '..' are correctly reconstructed.
Returns NULL if '~' is the leading character and HOME is unset or disabled
(see <function>FcConfigEnableHome</function>)

Comment 2 Keith Packard 2007-11-03 22:32:13 UTC
*** Bug 12965 has been marked as a duplicate of this bug. ***

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.