Re: [PATCH v2 1/5] Makefile: rename objects in-place, don't clobber

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Mar 30 2021, Junio C Hamano wrote:

> Ævar Arnfjörð Bjarmason <avarab@xxxxxxxxx> writes:
>
>>> Really, does anybody else use "$(CC) -o $@" in such a way in their
>>> Makefile?  Having to do this smells simply crazy (I am not saying
>>> you are crazy---the platform that forces you to write such a thing
>>> is crazy).
>>
>> Yes, if you do say a Google search for "Cannot open or remove a file
>> containing a running program" you'll find that there's 15k results of
>> people basically (re)discovering this problem in porting their software
>> to AIX, and the solutions being some variant of "yes AIX sucks, just use
>> this 'cmd >x+ && mv x+ x' trick".
>
> What I meant was if there are well known upstream projects whose
> Makefile actually use
>
> 	$(CC) -o $@+ ...
> 	mv $@+ $@
>
> I wouldn't be surprised if AIX community maintained collections of
> patches to many projects to turn
>
> 	$(CC) -o $@ ...
>
> in the Makefiles taken from upstream projects into
>
> 	$(CC) -o $@+ ...
> 	mv $@+ $@
>
> to work AIX around.  As an upstream, however, I am not interested in
> forcing that pattern on users of other platforms.

Who's going to notice or care? We have some mixture of clobbering, "mv
$@+ $@" etc. now in our Makefile for various rules and I think unless
you're debugging those specific rules you won't notice.

The case of the $@+ being left behind is quite obscure, and with *+ in
our .gitignore won't be noticed (e.g. by a "git add ." or something).

> In any case, I do not care too much about the "I am building a new
> binary while running, without installing, the one I built" use case
> and do not agree with the idea of making the Makefile ugly only to
> support such a use case.  That is where my comments are coming from
> on this topic.  FWIW, AIX developers who do not do the "build, run
> without installing, and rebuild while the old one is still running"
> will not need the "$(CC) -o $@+ && mv $@+ $@" either, right?

I daresay that uses cases of:

 * The tests break, you login to the CI to run gdb, fix a small bug,
   compile (doesn't work), but being forced to close that gdb session
   would be annoying (e.g. maybe I'm just looking at a data in a struct
   I didn't change).

 * Ditto, but maybe debugging two things at the same time, having an
   open "cat-file --batch" session etc.

Aren't something obscure to someone wanting to work on a codebase. I'm
submitting these because this is an active impediment to me submitting
portability patches on AIX, of which I already have some:

    git log --grep=AIX --author=Ævar origin/master

Anything that makes that less painful is a win, and the tiny amount of
Makefile complexity seems worth it to me.




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux