Bug 12964 - The FcStrCopyFilename function contradicts its documentation
Summary: The FcStrCopyFilename function contradicts its documentation
Status: RESOLVED FIXED
Alias: None
Product: fontconfig
Classification: Unclassified
Component: library (show other bugs)
Version: 2.4
Hardware: All All
: medium normal
Assignee: Keith Packard
QA Contact:
URL:
Whiteboard:
Keywords:
: 12965 (view as bug list)
Depends on:
Blocks:
 
Reported: 2007-10-26 12:18 UTC by David
Modified: 2007-11-03 22:32 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments

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: 

http://linuxtesting.org/results/report?num=S0595
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>)

026fe895e487d0a9607a8506ab8be2ff6022ea19
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.