doctool.c patch

edward tailbert@yahoo.com
Thu Dec 7 16:52:00 GMT 2000


DJ,

The code as is doesn't work on the link farms generated by an
all-target-winsup.

The test for using stat vs. lstat is done at compile time due to the test

#ifdef S_ISLNK
#define STAT lstat
#else
#define STAT stat
#endif

Since cygwin has S_ISLNK defined, lstat is used. This works fine for regular
files, but files which are actual symlinks don't pass the
S_ISREG(st.st_mode) test. This appears in the all-target-winsup scenario
above.

The all-target-foo setup generates real directories, but symlinks everything
else. The code as is works fine in the winsup/doc directory, but not in a
full binutils chain. By adding the S_ISLNK test, we can get both situations
to work.

But when I think about it, it's a bit cleaner to follow your suggestion of
changing the lstat to a stat, and use S_ISREG. It's one less comparison and
accomplishes the same thing.

In any case, I understand the reasoning behind the disallowing symlinks,
when you recursively descend a source tree. However, I would argue that
keeping the paradigm of the all-target-foo is probably worth doing. Both
winsup and newlib does that, as well as a number of the gcc subdirectories.
At the moment, the doctool breaks in a unified source tree.

Since I like having the source unified because it allows me to test the
winsup stuff in conjunction with a dozen or so apps, I find it useful.

So, what do you suggest?

-----Original Message-----
From: cygwin-developers-owner@sources.redhat.com
[ mailto:cygwin-developers-owner@sources.redhat.com]On Behalf Of DJ
Delorie
Sent: Thursday, December 07, 2000 12:40 PM
To: tailbert@yahoo.com
Cc: cygwin-developers@sources.redhat.com
Subject: Re: doctool.c patch



> Enclosed is a patch for winsup/doc/doctool.c. I've extended it to allow
> symbolically linked files to be considered as valid source files. This
> allows doctool to find the correct files for those of us who check out the
> entire :/cvs/src tree and use the configure-target-winsup to compile
winsup.

doctool specifically uses lstat to avoid symlinks.  Your patch undoes
that.  If this is really what you want, then you have to consider two
things:

1. The original code is there to avoid symlinks.  Why?  What problems
   could symlinks cause, that the original author already encountered
   and dealt with? (hint: symlinks to directories, symlinks causing
   duplication)

2. If you want symlinks treated as files, just take out the lstat/stat
   logic, and always use stat.

Plus, you dind't include a ChangeLog entry.


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com



More information about the Cygwin-developers mailing list