Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 455583 - make doesnt use RM macro to remove intermediate files
Summary: make doesnt use RM macro to remove intermediate files
Alias: None
Product: Fedora
Classification: Fedora
Component: make
Version: 10
Hardware: All
OS: Linux
Target Milestone: ---
Assignee: Petr Machata
QA Contact: Fedora Extras Quality Assurance
Depends On:
TreeView+ depends on / blocked
Reported: 2008-07-16 13:09 UTC by JW
Modified: 2015-05-05 01:34 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2008-11-27 11:00:35 UTC

Attachments (Terms of Use)

Description JW 2008-07-16 13:09:54 UTC
Description of problem:
Intermediate files specified with .INTERMEDIATE rule are removed using
unlink(2)rather than invoking whatever the RM macro is currently set to.  Make
misleadingly echoes the blatant lie "rm ..." when the unlink is performed.  It
does not invoke 'rm'.

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1. Create Makefile viz:

RM=rm -i
all: a
    touch $@

2. make -n
Actual results:
touch a
rm a

Expected results:
touch a
rm -i a

Additional info:

Comment 1 Petr Machata 2008-09-15 19:25:57 UTC
I'm not sure make is supposed to do that.  The goal is to remove the file, not to launch $(RM); at least I don't see anything to the effect in the manual.  The "rm a" that appears is in my opinion more of a hint, default value of $(RM) is "rm -f", not "rm".  I'm inclined to NOTABUG this.

Comment 2 Bug Zapper 2008-11-26 11:00:25 UTC
This message is a reminder that Fedora 8 is nearing its end of life.
Approximately 30 (thirty) days from now Fedora will stop maintaining
and issuing updates for Fedora 8.  It is Fedora's policy to close all
bug reports from releases that are no longer maintained.  At that time
this bug will be closed as WONTFIX if it remains open with a Fedora 
'version' of '8'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version prior to Fedora 8's end of life.

Bug Reporter: Thank you for reporting this issue and we are sorry that 
we may not be able to fix it before Fedora 8 is end of life.  If you 
would still like to see this bug fixed and are able to reproduce it 
against a later version of Fedora please change the 'version' of this 
bug to the applicable version.  If you are unable to change the version, 
please add a comment here and someone will do it for you.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events.  Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

The process we are following is described here:

Comment 3 Petr Machata 2008-11-26 13:32:15 UTC
My point from Comment #1 still stands.  The goal is to remove intermediate files, not to run arbitrary user-defined commands.  I'm notabuging this.

Comment 4 JW 2008-11-26 13:45:24 UTC
I think you need to understand the circumstances which might require control over the actual 'rm'. Some unix variants have a 'rm' command that will by default remove a single file without prompting but which will, by default, not remove multiple files without prompting (this is in the absence of -i or -f options).

The intent is not to invoke arbitrary commands.

The intent is to allow the user to control the way in which commands are performed.

Every other action which physically alters a filesystem is controllable in ones Makefile.

I am therefore of the opinion that you are completely wrong in your judgement. And I am therefore reopening this bug.

Comment 5 Petr Machata 2008-11-26 14:31:20 UTC
make uses unlink syscall to remove files.  Configuring the way files should be removed seems redundant to me, and actually running the $(RM) process for each file you need deleted is a waste of resources.

This issue is beyond me as a package maintainer.  I'll have to ask you to take it upstream.  If they decide it's a good idea, I'll happily include the patch in Fedora.

Comment 6 JW 2008-11-26 14:40:06 UTC
(In reply to comment #5)
> ... and actually running the $(RM) process for each
> file you need deleted is a waste of resources.

Really?  So perhaps 'make' is a 'waste of resources' because anyone can type the commands on their command-line and thereby save resources.  Or perhaps all compilers are a 'waste of resources' because anyone could hand-code the assembler instructions.

Are you really so bereft of ideas that you have to conjure up such lame reasoning to (lazily) eradicate a bug?

Comment 7 Petr Machata 2008-11-26 14:47:14 UTC
Launching separate process to delete a file is a waste of resources compared to mere unlink, yes.  I'm eagerly awaiting your upstream patches that will prove that it actually /does/ make sense to do that.

Comment 8 JW 2008-11-27 02:47:53 UTC
(In reply to comment #7)
> Launching separate process to delete a file is a waste of resources compared to
> mere unlink, yes.

Please explain, then, why the RM macro exists and why it defaults to "rm -f" and why it is used sometimes and not other times.

If, as you claim, it is all about a "waste of resources", then why is it ok for the resources to be wasted when the RM macro is actually used, and not at other times?

I find it hard to believe and apparently intelligent person (and a Algol/Java developer at that) can actually think that executing rm is a waste of resources.  You cannot possibly be serious.

Comment 9 Petr Machata 2008-11-27 11:00:35 UTC
The reason $(RM) exists is the same why there is default for $(CC), $(CXX), etc.  It's for portable use in actual make rules, should you need to delete a file.  In scripts, there's no other way.  make, however, can afford to remove intermediate files by unlinking them.

Also don't get too attached to my wasted resources line of reasoning.  It's true all right, but not the only reason I don't want to implement what you ask.  (Even though I would have spent less time actually writing the patch than I already spent bickering about this feature request.)

Note You need to log in before you can comment on or make changes to this bug.