bug-make
[Top][All Lists]
Advanced

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

Bug with SCCS Suffix Rules


From: Jerome Reybert
Subject: Bug with SCCS Suffix Rules
Date: Wed, 19 Feb 2020 17:56:42 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:73.0) Gecko/20100101 Thunderbird/73.0

I am facing what to seem to be a bug in Gnu make, since at least make 3.82, and still present in 4.2.1.

Consider the following Makefile

--
FILES := cat cat.sh
prefix := /foo
INSTALLED_FILES := $(patsubst %,$(prefix)/%,$(FILES))
all: $(INSTALLED_FILES)
$(INSTALLED_FILES): $(prefix)/% : %
    @echo $@
--

Both cat and cat.shfiles exist, and cat.sh is newer than cat (if not, the issue does not appear).

$ make -C test
make: Entering directory `/work1/jreybert/tmp/make_bug/test'
cat cat.sh >cat
chmod a+x cat
/foo/cat
/foo/cat.sh
make: Leaving directory `/work1/jreybert/tmp/make_bug/test'
 ======== Golden =========
golden/cat: GIF image data, version 89a, 350 x 204
golden/cat.sh: a /usr/bin/env bash script, ASCII text executable
 ======== Test =========
test/cat: a /usr/bin/env bash script, ASCII text executable
test/cat.sh: a /usr/bin/env bash script, ASCII text executable

I can see that make overwrites cat
> cat cat.sh >cat
> chmod a+x cat

I also noticed that the bug appears only if cat.sh is newer that cat.

I believe that my Makefile is well written, but I may be wrong.

Adding .SUFFIXES: or calling make -r fixes my issue.

You can easily clone and test the test case here:
https://gitlab.com/jreybert/make_sccs_bug

Regards

Jérôme Reybert



reply via email to

[Prev in Thread] Current Thread [Next in Thread]