This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Fonts reorganization and additions


On 9/13/2015 12:10 PM, Ken Brown wrote:
On 9/11/2015 3:59 PM, Yaakov Selkowitz wrote:
The first thing that should be checked is if the code in setup which
allows it to unpack files with "illegal" characters in Windows also
makes sure to create parent directories.  Based on these reports my
*guess* is it doesn't but I haven't looked yet.

I'm not very familiar with the setup code, but I think I may have found
the problem.  The function mkdir_p() in mkdir.cc contains the following,
starting at line 99:

   for (c = path; *c; c++)
     {
       if (*c == ':')
     slash = 0;
       if (*c == '/' || *c == '\\')
     slash = c;
     }

   if (!slash)
     return 0;

If I understand this correctly, the function will return success without
having created the leading directory if the path name contains a colon
and doesn't contain a slash after the last colon.  I guess the
assumption is that there is no "leading directory" to be created in this
case.  [This part of the code was written in 2000, when a colon could
not be part of a file name.]

I hope someone who understands the setup code better than I do can take
a look at this.  I'm not confident that I understand all the uses of
mkdir_p() or all possible reasons why its in_path argument might contain
a colon.

The following patch fixes the problem:

diff --git a/mkdir.cc b/mkdir.cc
index dabc256..84bb176 100644
--- a/mkdir.cc
+++ b/mkdir.cc
@@ -98,8 +98,6 @@ mkdir_p (int isadir, const char *in_path, mode_t mode)

   for (c = path; *c; c++)
     {
-      if (*c == ':')
-       slash = 0;
       if (*c == '/' || *c == '\\')
        slash = c;
     }

I don't know if this might cause some other problem, but it seems OK in limited testing.

Ken


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]