threads / discuss / 38254

Missing inversion in Makefile (ee9be06)

Subject: Missing inversion in Makefile (ee9be06)

## tl;dr

4 messages between Dec 27, 2014 and Feb 10, 2015.

replies: 3people: 2as markdown or json

Philip Oakley· Dec 27, 2014, 17:56 UTC · lore
Hi,

In ee9be06 (perl: detect new files in MakeMaker builds, 2012-07-27) there is a step to detect if there has been an update to the PM.* files, however it appears that the logic is inverted in the comparison.

I need some extra eye's on this to be sure I have it right (I'm trying to debug an old Windows breakage...).

The resultant output of a make dry run included (on my m/c)..:
  find perl -type f -name '*.pm' | sort >perl/PM.stamp+ && \
   { cmp perl/PM.stamp+ perl/PM.stamp >/dev/null 2>/dev/null || mv 
perl/PM.stamp+ perl/PM.stamp; } && \
   rm -f perl/PM.stamp+
  make -C perl  PERL_PATH='/usr/bin/perl' prefix='/c/Documents and 
Settings/Philip' perl.mak

Shouldn't it be `{ ! cmp ` so that when the files are not identical, the move is performed?

https://github.com/git/git/blob/ee9be06770223238c6a22430eb874754dd22dfb0/Makefile#L2097
the code is now at https://github.com/git/git/blob/master/Makefile#L1697

I'd guess that this was something that was tricky to test as once it works it stays working.

On a clean Msysgit development install the PM.stamp file does not exist and the cmp exits with error code 2, while identical files return 0.

Msysgit list also copied should someone there have seen this before. -- Philip

-- 
-- 
*** Please reply-to-all at all times ***
*** (do not pretend to know who is subscribed and who is not) ***
*** Please avoid top-posting. ***
The msysGit Wiki is here: https://github.com/msysgit/msysgit/wiki - Github accounts are free.

You received this message because you are subscribed to the Google
Groups "msysGit" group.
To post to this group, send email to msysgit@googlegroups.com
To unsubscribe from this group, send email to
msysgit+unsubscribe@googlegroups.com
For more options, and view previous threads, visit this group at
http://groups.google.com/group/msysgit?hl=en_US?hl=en

--- 
You received this message because you are subscribed to the Google Groups "Git for Windows" group.
To unsubscribe from this group and stop receiving emails from it, send an email to msysgit+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Johannes Sixt· Dec 27, 2014, 19:07 UTC · re: Philip Oakley · lore

Re: Missing inversion in Makefile (ee9be06)

Am 27.12.2014 um 19:49 schrieb Philip Oakley:
Show 22 quoted lines
> Hi,
> 
> In ee9be06 (perl: detect new files in MakeMaker builds, 2012-07-27)
> there is a step to detect if there has been an update to the PM.* files,
> however it appears that the logic is inverted in the comparison.
> 
> I need some extra eye's on this to be sure I have it right (I'm trying
> to debug an old Windows breakage...).
> 
> The resultant output of a make dry run included (on my m/c)..:
> 
>  find perl -type f -name '*.pm' | sort >perl/PM.stamp+ && \
>   { cmp perl/PM.stamp+ perl/PM.stamp >/dev/null 2>/dev/null || mv
> perl/PM.stamp+ perl/PM.stamp; } && \
>   rm -f perl/PM.stamp+
>  make -C perl  PERL_PATH='/usr/bin/perl' prefix='/c/Documents and
> Settings/Philip' perl.mak
> 
> Shouldn't it be `{ ! cmp ` so that when the files are not identical, the
> move is performed?
> 
> https://github.com/git/git/blob/ee9be06770223238c6a22430eb874754dd22dfb0/Makefile#L2097

The existing code looks correct to me. cmp succeeds when the files are identical and fails when they are different: When it succeeds (files are equal), the mv is not executed. When it fails, either because a file does not exist or they are different, the mv is executed.

-- Hannes
-- 
-- 
*** Please reply-to-all at all times ***
*** (do not pretend to know who is subscribed and who is not) ***
*** Please avoid top-posting. ***
The msysGit Wiki is here: https://github.com/msysgit/msysgit/wiki - Github accounts are free.

You received this message because you are subscribed to the Google
Groups "msysGit" group.
To post to this group, send email to msysgit@googlegroups.com
To unsubscribe from this group, send email to
msysgit+unsubscribe@googlegroups.com
For more options, and view previous threads, visit this group at
http://groups.google.com/group/msysgit?hl=en_US?hl=en

--- 
You received this message because you are subscribed to the Google Groups "Git for Windows" group.
To unsubscribe from this group and stop receiving emails from it, send an email to msysgit+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Philip Oakley· Dec 27, 2014, 19:07 UTC · re: Johannes Sixt · lore

Re: Missing inversion in Makefile (ee9be06)

From: "Johannes Sixt" <j6t@kdbg.org>
Show 33 quoted lines
> Am 27.12.2014 um 19:49 schrieb Philip Oakley:
>> Hi,
>>
>> In ee9be06 (perl: detect new files in MakeMaker builds, 2012-07-27)
>> there is a step to detect if there has been an update to the PM.* 
>> files,
>> however it appears that the logic is inverted in the comparison.
>>
>> I need some extra eye's on this to be sure I have it right (I'm 
>> trying
>> to debug an old Windows breakage...).
>>
>> The resultant output of a make dry run included (on my m/c)..:
>>
>>  find perl -type f -name '*.pm' | sort >perl/PM.stamp+ && \
>>   { cmp perl/PM.stamp+ perl/PM.stamp >/dev/null 2>/dev/null || mv
>> perl/PM.stamp+ perl/PM.stamp; } && \
>>   rm -f perl/PM.stamp+
>>  make -C perl  PERL_PATH='/usr/bin/perl' prefix='/c/Documents and
>> Settings/Philip' perl.mak
>>
>> Shouldn't it be `{ ! cmp ` so that when the files are not identical, 
>> the
>> move is performed?
>>
>> https://github.com/git/git/blob/ee9be06770223238c6a22430eb874754dd22dfb0/Makefile#L2097
>
> The existing code looks correct to me. cmp succeeds when the files are
> identical and fails when they are different: When it succeeds (files 
> are
> equal), the mv is not executed. When it fails, either because a file
> does not exist or they are different, the mv is executed.
>

Thanks. The inverse logic had me confused. It's like 7400's again, for those that remember;-)

I was getting errors from `cd $git_dir && make -n MSVC=1 V=1 2>MakeDryErrs.txt 1>MakeDry.txt` (borrowed from 'msvc-build') which reported the PM.stamp as a problem, with the quoted code being the last part of the MakeDry.txt (and no PM.stamp seen).

Now that I've been poking and investigating the error's stopped! It's all getting rather frustrating. Time to go again on a clean and rebuild..

Philip 
-- 
-- 
*** Please reply-to-all at all times ***
*** (do not pretend to know who is subscribed and who is not) ***
*** Please avoid top-posting. ***
The msysGit Wiki is here: https://github.com/msysgit/msysgit/wiki - Github accounts are free.

You received this message because you are subscribed to the Google
Groups "msysGit" group.
To post to this group, send email to msysgit@googlegroups.com
To unsubscribe from this group, send email to
msysgit+unsubscribe@googlegroups.com
For more options, and view previous threads, visit this group at
http://groups.google.com/group/msysgit?hl=en_US?hl=en

--- 
You received this message because you are subscribed to the Google Groups "Git for Windows" group.
To unsubscribe from this group and stop receiving emails from it, send an email to msysgit+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Philip Oakley· Feb 10, 2015, 22:36 UTC · re: Philip Oakley · lore

Re: [msysGit] Missing inversion in Makefile (ee9be06)

Another go at this XY-Problem...
From: "Philip Oakley" <philipoakley@iee.org>
Sent: Saturday, December 27, 2014 8:17 PM
Show 38 quoted lines
> From: "Johannes Sixt" <j6t@kdbg.org>
>> Am 27.12.2014 um 19:49 schrieb Philip Oakley:
>>> Hi,
>>>
>>> In ee9be06 (perl: detect new files in MakeMaker builds, 2012-07-27)
>>> there is a step to detect if there has been an update to the PM.* 
>>> files,
>>> however it appears that the logic is inverted in the comparison.
>>>
>>> I need some extra eye's on this to be sure I have it right (I'm 
>>> trying
>>> to debug an old Windows breakage...).
>>>
>>> The resultant output of a make dry run included (on my m/c)..:
>>>
>>>  find perl -type f -name '*.pm' | sort >perl/PM.stamp+ && \
>>>   { cmp perl/PM.stamp+ perl/PM.stamp >/dev/null 2>/dev/null || mv
>>> perl/PM.stamp+ perl/PM.stamp; } && \
>>>   rm -f perl/PM.stamp+
>>>  make -C perl  PERL_PATH='/usr/bin/perl' prefix='/c/Documents and
>>> Settings/Philip' perl.mak
>>>
>>> Shouldn't it be `{ ! cmp ` so that when the files are not identical, 
>>> the
>>> move is performed?
>>>
>>> https://github.com/git/git/blob/ee9be06770223238c6a22430eb874754dd22dfb0/Makefile#L2097
>>
>> The existing code looks correct to me. cmp succeeds when the files 
>> are
>> identical and fails when they are different: When it succeeds (files 
>> are
>> equal), the mv is not executed. When it fails, either because a file
>> does not exist or they are different, the mv is executed.
>>
> Thanks. The inverse logic had me confused.
> It's like 7400's again, for those that remember;-)
>
Here's where the real problem starts...
Show 9 quoted lines
> I was getting errors from
> `cd $git_dir && make -n MSVC=1 V=1 2>MakeDryErrs.txt 1>MakeDry.txt` 
> (borrowed from 'msvc-build') which reported the PM.stamp as a problem, 
> with the quoted code being the last part of the MakeDry.txt (and no 
> PM.stamp seen).
>
> Now that I've been poking and investigating the error's stopped! It's 
> all getting rather frustrating. Time to go again on a clean and 
> rebuild..

I'm trying to get the msysgit msvc-build script[1], which essentially implements the Git 'compat/vcbuild/README', to work again in terms of creating a Visual Studio [2008] project file (.sln).

If I run the code (find perl -type f -name '*.pm' ...) manually then the PM.stamp file is created allowing future dry-runs to succeed - hence some of my confusion.

The script uses git's 'contrib/buildsystems/engine.pl' to parse the 
output of:
 `make -n MSVC=1 V=1 2>\dev\null` [2]

This appears to no longer work because the -n (dry-run) option fails to run the required 'perl/PM.stamp' during the dry-run. At least that's now my understanding.

The https://www.gnu.org/software/make/manual/html_node/Instead-of-Execution.html page indicates that adding a + to the right rule would be needed to also run the PM.stamp process during dry-run.

At the moment I'm getting (on my old WinXP machine, using Msysgit 1.9.5 as a basis)

$ make -n MSVC=1 V=1 1>makedry.txt make[1]: *** No rule to make target `PM.stamp', needed by `perl.mak'. Stop. make: *** [perl/perl.mak] Error 2

i.e. PM.stamp was not created so can't be the target of the dry-run make rule.

The makedry.txt file generated ends with the
find perl -type f -name '*.pm' | sort >perl/PM.stamp+ && \
 { cmp perl/PM.stamp+ perl/PM.stamp >/dev/null 2>/dev/null || mv 
perl/PM.stamp+ perl/PM.stamp; } && \
 rm -f perl/PM.stamp+
make -C perl  PERL_PATH='/usr/bin/perl' prefix='/c/Documents and 
Settings/Philip' perl.mak
make[1]: Entering directory `/c/msysgit195/git/perl'
make -C .. GIT-CFLAGS
make[2]: Entering directory `/c/msysgit195/git'
FLAGS='compat/vcbuild/scripts/clink.pl:  -Imsvcgit/32bits/include [...]
     if test x"$FLAGS" != x"`cat GIT-CFLAGS 2>/dev/null`" ; then \
  echo >&2 "    * new build flags"; \
  echo "$FLAGS" >GIT-CFLAGS; \
            fi
make[2]: Leaving directory `/c/msysgit195/git'
make[1]: Leaving directory `/c/msysgit195/git/perl'

i.e. the commands for the PM.stamp process are listed, rather than executed as may have been hoped.

I've tried hacking the plus(+) prefix onto the "perl/PM.stamp: FORCE" rule, but it gave the same error.

What would be the right way of making a dry-run produce a suitable complete output? Make files are not something I normally delve into.

-- Philip

[1] https://github.com/msysgit/msysgit/blob/master/bin/msvc-build [2] https://github.com/git/git/blob/master/contrib/buildsystems/engine.pl#L75

← back to recent threads