This is the mail archive of the cygwin@cygwin.com 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]

tetex-bin 2.0.2-1: ctangle/cweave fail to read files in current directory


I was very pleased to see cweb binaries included in version 2.0.2-1
of tetex-bin, but it immediately started causing problems in my
development environment. I use make, which uses the built in rule:

============================================================
# default
CTANGLE = ctangle

%.c: %.w
#  commands to execute (built-in):
       $(CTANGLE) $< - $@
============================================================

This works fine for my vanilla version of ctangle, but with the tetex
version, fails thusly:

============================================================
$ make
ctangle project.w - project.c
This is CTANGLE, Version 3.64 (Web2C 7.4.5)
! Cannot open input file project.w
(That was a fatal error, my friend.)
make: *** [project.c] Error 1
============================================================

A bit of investigation suggests that the problem is in the comm-w2c.ch
change file, where the normal search mechanism (i.e. look in the
current directory, and then in the directory (if any) specified by
the environment variable CWEBINPUTS) is replaced by the Kpathsea
search mechanism, as follows:

============================================================
This version uses the Kpathsea mechanism for searching files.
The directories to be searched for come from three sources:

(a) a user-set environment variable CWEBINPUTS

(b) a line in Kpathsea configuration file texmf.cnf
   e.g. CWEBINPUTS=.:$TEXMF/texmf/cweb//

(c) compile-time default directories .:$TEXMF/texmf/cweb//
   (specified in texmf.in).
============================================================

The upshot of this change is that unless you have . in one of these
places (it seems I haven't) the current directory isn't searched for
the required input files, and the files you expect ctangle to find
aren't found. This is a fundamental change from vanilla ctangle,
and breaks the built in make rules.

So my question is this: could this please be changed to search
the current directory first, before mechanisms (a), (b) and (c) as
specified above? I imagine that the change shouldn't be too difficult,
something like this for <Open input files>:

============================================================
Change the first three lines of the replacement text in change file
comm-w2c.ch:

if ((found_filename=kpse_find_cweb(web_file_name))==NULL ||
   (web_file=fopen(found_filename,"r"))==NULL) {
 fatal("! Cannot open input file ", web_file_name);

to:

if (((web_file=fopen(web_file_name,"r"))==NULL) &&
   ((found_filename=kpse_find_cweb(web_file_name))==NULL ||
    (web_file=fopen(found_filename,"r"))==NULL)) {
 fatal("! Cannot open input file ", web_file_name);
============================================================

with something similar for the change file and any include files.

This change (the suggestion, that is, whether or not I've got the
coding right) should not break anything which is currently using
tetex's ctangle, as far as I can see, except in one case: if a file
is to be read (as a web file, a change file or an include file) which
exists somewhere that Kpathsea can find, and also in the current
directory, with the same name, but different content, currently
the Kpathsea file will be included, whereas with this suggestion,
the file in the current directory will be used. However, I imagine
that this would be unlikely, and, even if it did happen, my suggested
change more closely matches the vanilla ctangle.

[N.b. As these comments focus on common.w, these changes will also
apply to cweave.]

Tim Reid

_________________________________________________________________
On the move? Get Hotmail on your mobile phone http://www.msn.co.uk/msnmobile/mobilehotmail



-- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Bug reporting: http://cygwin.com/bugs.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/


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