[WM] Webmake not finding certain images.
jlm17
jlm17 at lucent.com
Mon May 10 13:33:09 IST 2004
I think this solves a very specific problem. The problem is setting the image size, on a deferred
page, with no cache of the image already, and the image is not found in the current directory, but a
directory relative to the directory the output file will be put in.
If anyone wants to test, I have attached three files that are minimized to exemplify this problem.
The directory structure should be like this:
somedir/images/some_image.jpg
somedir/src/makefile2.wmk
somedir/src/index.wmk
somedir/src/guard_ssh.wmk
Change the image name in guard_ssh.wmk to be the name of some image you put into the somedir/images
directory.
cd into somedir/src.
Run this command webmake -F -f makefile2.wmk
The output should go into .. and the error I have been getting should appear. If you apply my fix
the error will go away.
Robert Echlin wrote:
> Hi, jlm,
>
> I had this problem with relative paths like htmlout, but changed the
> path to \really\long\path\htmlout and it worked fine.
> YMMV, I am using MS Win2KServer.
>
> I tested making the changes you suggested, but it did not make any
> difference in my case, so I changed it back.
>
> Robert
>
> jlm17 wrote:
>
>> I believe I have fixed this problem, though I don't have a firm grasp
>> of exactly why it is happening. I am having a hard time understanding
>> what the functions do, because none of them are commented.
>>
>> All I did was move this line:
>>
>> $self->_subst_close();
>>
>> in the finish_deferred_files function down to right after the call to
>> make_file_finish().
>>
>> The chain of logic is as follows.
>>
>> By calling that close function early, we loose context as to which
>> file we are processing currently. This then means we don't know what
>> the output filename is, so we can't add the output file's directory
>> path to the list of search paths for finding the image who's size we
>> want to figure out.
>>
>> I output all my html to .. (Yea, the source directory is a
>> subdirectory of my publish directory), and my image dir is ../images.
>>
>> So here's a diff (The dotdots line was from Ralph's suggestion):
>>
>> 1807c1807
>> < my $dotdots = $self->{current_subst}->{dotdots} || '';
>> ---
>> > my $dotdots = $self->{current_subst}->{dotdots};
>> 2253a2254
>> > $self->_subst_close();
>> 2274d2274
>> < $self->_subst_close();
>>
>>
>> jlm17 wrote:
>>
>>> Tracing the problem, I see that in the add_image_size function in
>>> Main.pm, when the problem will occur,
>>> $self->{current_subst}->{filename} is (!E), when the problem doesn't
>>> occur, the value is the name of the output file.
>>>
>>> jlm17 wrote:
>>>
>>>> Very odd. The problem isn't as general as I thought. I'm still
>>>> working on a minimal example that creates this problem, but so far
>>>> if I remove my breadcrumbs, the error goes away. Just four lines:
>>>>
>>>> <template name="breadcrumbs_node">
>>>> <a href="${url}">$[${name}.title]</a>
>>>> </template>
>>>> <breadcrumbs name="breadcrumbs" map="sitemap"
>>>> level="breadcrumbs_node"/>
>>>>
>>>> jlm17 wrote:
>>>>
>>>>> Well, that got rid of some of the errors, but the most important
>>>>> one is still there:
>>>>>
>>>>> ${IMGSIZE}: cannot find image file
>>>>> "images/atria_acct_local_admin_add-small.gif" in "(html-cleaner)"
>>>>>
>>>>> Ralph Pape wrote:
>>>>>
>>>>>> Hi jlm17,
>>>>>>
>>>>>> jlm17 wrote:
>>>>>>
>>>>>>> I am getting some errors with webmake like this:
>>>>>>>
>>>>>>> Use of uninitialized value in string eq at
>>>>>>> /usr/lib/perl5/site_perl/5.8.0/HTML/WebMake/Main.pm line 1732.
>>>>>>> Use of uninitialized value in string eq at
>>>>>>> /usr/lib/perl5/site_perl/5.8.0/HTML/WebMake/Main.pm line 1732.
>>>>>>> ${IMGSIZE}: cannot find image file "images/cygwina.jpg" in
>>>>>>> "(html-cleaner)"
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> [...]
>>>>>>
>>>>>> On W2K with Activeperl 5.8.3 I found the same. The fix for this is
>>>>>> editing Main.pm on line 1807, because $dotdots must be not
>>>>>> undefined. Else we run into this "undefined" errors caused in the
>>>>>> second line of the erfcatdir function.
>>>>>>
>>>>>> Change this:
>>>>>> my $dotdots = $self->{current_subst}->{dotdots};
>>>>>>
>>>>>> to this
>>>>>> my $dotdots = $self->{current_subst}->{dotdots} || '';
>>>>>>
>>>>>> Greetings Ralph
>>>>>>
>>>>>> _______________________________________________
>>>>>> Webmake-talk mailing list
>>>>>> Webmake-talk at taint.org
>>>>>> http://webmake.taint.org/mailman/listinfo/webmake-talk
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> Webmake-talk mailing list
>>>>> Webmake-talk at taint.org
>>>>> http://webmake.taint.org/mailman/listinfo/webmake-talk
>>>>
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> Webmake-talk mailing list
>>>> Webmake-talk at taint.org
>>>> http://webmake.taint.org/mailman/listinfo/webmake-talk
>>>
>>>
>>>
>>> _______________________________________________
>>> Webmake-talk mailing list
>>> Webmake-talk at taint.org
>>> http://webmake.taint.org/mailman/listinfo/webmake-talk
>>
>>
>> _______________________________________________
>> Webmake-talk mailing list
>> Webmake-talk at taint.org
>> http://webmake.taint.org/mailman/listinfo/webmake-talk
>>
>
-------------- next part --------------
<content name="guard_ssh">
<wmmeta name="up" value="index"/>
<html>
<body>
$[breadcrumbs]
<img src="images/cygwina.jpg">
</body>
</html>
</content>
-------------- next part --------------
<content name="index">
<html>
<body>
$[breadcrumbs]
</body>
</html>
</content>
-------------- next part --------------
<webmake>
<include file="index.wmk"/>
<include file="guard_ssh.wmk"/>
<for name="page" values="guard_ssh index ">
<out name="${page}" file="../${page}.html">
${${page}}
</out>
</for>
<template name="sitemap_node">
</template>
<template name="sitemap_leaf">
</template>
<sitemap name="sitemap" node="sitemap_node" leaf="sitemap_leaf" rootname="index"/>
<template name="breadcrumbs_node">
${url}
</template>
<breadcrumbs name="breadcrumbs" map="sitemap" level="breadcrumbs_node"/>
More information about the Webmake-talk
mailing list