curl / Mailing Lists / curl-library / Single Mail

curl-library

7.61.0 winbuild problems

From: Konstantin Vlasov <flint_at_flint-inc.ru>
Date: Tue, 24 Jul 2018 19:59:46 +0300

Hi,

Today I tried switching from libcurl 7.59.0 to 7.61.0 and found that it failed
to build from sources under Windows.

To cut the long story short, there is a potential problem in gen_resp_file.bat.
When the OUTFILE does not exist initially, the batch runs only `for', `if' and
`echo' statements which are shell built-ins and do not affect ERRORLEVEL.
Therefore, if for any reason ERRORLEVEL was non-zero before the bat script
starts, it remains the same when the script exits, and nmake considers it a
fatal error and stops build, despite the fact there were no actual errors
whatsoever.

I'm not yet sure how it happened that ERRORLEVEL was non-zero by the time
gen_resp_file.bat was started. Even when it is 0 before I run nmake, it becomes
1 when the $(MODE) rule starts to execute. But even putting that question aside,
this is not right to check an exit code from a script that does not change the
exit code at all.

I have been able to work around that issue by adding `ver >nul' command at the
beginning of the gen_resp_file.bat (after the "echo off"), to reset ERRORLEVEL
to zero. I suggest to implement something like this in your code as well, to
avoid this issue. Another possible workaround would be to ignore exit code of
this batch calls in the Makefile, but it's too risky. In the future the script
might be expanded and become more "error-able" than now, so the "ver" trick is
more preferrable from my point of view, since it has no undesirable side-effects
for the future expansion of either batch, or Makefile rules.

-- 
Bye.                                    With best regards,
                                        Konstantin Vlasov.
-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette:   https://curl.haxx.se/mail/etiquette.html
Received on 2018-07-24