On 2/15/20 1:57 AM, Tom Lane wrote:
Hm. So, these oversights are certainly bugs in narrow terms. However, they've all been like that for a *long* time --- the three instances you found date to 2005, 2006, and 2008 according to "git blame". The complete lack of complaints shows that nobody cares. So I think a fairly strong case could be made for going the other way, ie s/$(LN_S)/ln -s/g and get rid of the configure-time cycles wasted in setting up that variable.
Here is a patch which does that. Andreas
diff --git a/configure b/configure index 37aa82dcd4..ea8ec36d3b 100755 --- a/configure +++ b/configure @@ -681,7 +681,6 @@ FLEX BISONFLAGS BISON MKDIR_P -LN_S TAR install_bin INSTALL_DATA @@ -9156,17 +9155,6 @@ $as_echo_n "checking for TAR... " >&6; } $as_echo "$TAR" >&6; } fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5 -$as_echo_n "checking whether ln -s works... " >&6; } -LN_S=$as_ln_s -if test "$LN_S" = "ln -s"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S" >&5 -$as_echo "no, using $LN_S" >&6; } -fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5 $as_echo_n "checking for a thread-safe mkdir -p... " >&6; } if test -z "$MKDIR_P"; then diff --git a/configure.in b/configure.in index 8adb409558..1184f165fa 100644 --- a/configure.in +++ b/configure.in @@ -1001,7 +1001,6 @@ esac AC_SUBST(install_bin) PGAC_PATH_PROGS(TAR, tar) -AC_PROG_LN_S AC_PROG_MKDIR_P # When Autoconf chooses install-sh as mkdir -p program it tries to generate # a relative path to it in each makefile where it substitutes it. This clashes diff --git a/contrib/uuid-ossp/Makefile b/contrib/uuid-ossp/Makefile index 777f988a41..4a14a1eb42 100644 --- a/contrib/uuid-ossp/Makefile +++ b/contrib/uuid-ossp/Makefile @@ -33,4 +33,4 @@ include $(top_srcdir)/contrib/contrib-global.mk endif md5.c sha1.c: % : $(pgcrypto_src)/% - rm -f $@ && $(LN_S) $< . + rm -f $@ && ln -s $< . diff --git a/src/Makefile.global.in b/src/Makefile.global.in index e4db3e80af..e01dec0267 100644 --- a/src/Makefile.global.in +++ b/src/Makefile.global.in @@ -338,7 +338,6 @@ perl_embed_ldflags = @perl_embed_ldflags@ # Miscellaneous AWK = @AWK@ -LN_S = @LN_S@ MSGFMT = @MSGFMT@ MSGFMT_FLAGS = @MSGFMT_FLAGS@ MSGMERGE = @MSGMERGE@ diff --git a/src/Makefile.shlib b/src/Makefile.shlib index 526361f31b..38d10dfbfb 100644 --- a/src/Makefile.shlib +++ b/src/Makefile.shlib @@ -295,12 +295,12 @@ ifdef shlib_major # If we're using major and minor versions, then make a symlink to major-version-only. ifneq ($(shlib), $(shlib_major)) rm -f $(shlib_major) - $(LN_S) $(shlib) $(shlib_major) + ln -s $(shlib) $(shlib_major) endif # Make sure we have a link to a name without any version numbers ifneq ($(shlib), $(shlib_bare)) rm -f $(shlib_bare) - $(LN_S) $(shlib) $(shlib_bare) + ln -s $(shlib) $(shlib_bare) endif endif # shlib_major @@ -435,12 +435,12 @@ ifneq ($(PORTNAME), win32) ifneq ($(shlib), $(shlib_major)) cd '$(DESTDIR)$(libdir)' && \ rm -f $(shlib_major) && \ - $(LN_S) $(shlib) $(shlib_major) + ln -s $(shlib) $(shlib_major) endif ifneq ($(shlib), $(shlib_bare)) cd '$(DESTDIR)$(libdir)' && \ rm -f $(shlib_bare) && \ - $(LN_S) $(shlib) $(shlib_bare) + ln -s $(shlib) $(shlib_bare) endif endif # not win32 endif # not cygwin diff --git a/src/backend/Makefile b/src/backend/Makefile index 9706a95848..2862c03cb8 100644 --- a/src/backend/Makefile +++ b/src/backend/Makefile @@ -167,12 +167,12 @@ generated-headers: $(top_builddir)/src/include/parser/gram.h $(top_builddir)/src $(top_builddir)/src/include/parser/gram.h: parser/gram.h prereqdir=`cd '$(dir $<)' >/dev/null && pwd` && \ cd '$(dir $@)' && rm -f $(notdir $@) && \ - $(LN_S) "$$prereqdir/$(notdir $<)" . + ln -s "$$prereqdir/$(notdir $<)" . $(top_builddir)/src/include/storage/lwlocknames.h: storage/lmgr/lwlocknames.h prereqdir=`cd '$(dir $<)' >/dev/null && pwd` && \ cd '$(dir $@)' && rm -f $(notdir $@) && \ - $(LN_S) "$$prereqdir/$(notdir $<)" . + ln -s "$$prereqdir/$(notdir $<)" . utils/probes.o: utils/probes.d $(SUBDIROBJS) $(DTRACE) $(DTRACEFLAGS) -C -G -s $(call expand_subsys,$^) -o $@ diff --git a/src/backend/catalog/Makefile b/src/backend/catalog/Makefile index f8f0b4841c..59ffe22c61 100644 --- a/src/backend/catalog/Makefile +++ b/src/backend/catalog/Makefile @@ -117,7 +117,7 @@ bki-stamp: genbki.pl Catalog.pm $(POSTGRES_BKI_SRCS) $(POSTGRES_BKI_DATA) $(top_ $(top_builddir)/src/include/catalog/header-stamp: bki-stamp prereqdir=`cd '$(dir $<)' >/dev/null && pwd` && \ cd '$(dir $@)' && for file in $(GENERATED_HEADERS); do \ - rm -f $$file && $(LN_S) "$$prereqdir/$$file" . ; \ + rm -f $$file && ln -s "$$prereqdir/$$file" . ; \ done touch $@ diff --git a/src/backend/utils/Makefile b/src/backend/utils/Makefile index b91028ddfd..f8e13e0f6f 100644 --- a/src/backend/utils/Makefile +++ b/src/backend/utils/Makefile @@ -66,14 +66,14 @@ endif $(top_builddir)/src/include/utils/header-stamp: fmgr-stamp errcodes.h prereqdir=`cd '$(dir $<)' >/dev/null && pwd` && \ cd '$(dir $@)' && for file in fmgroids.h fmgrprotos.h errcodes.h; do \ - rm -f $$file && $(LN_S) "$$prereqdir/$$file" . ; \ + rm -f $$file && ln -s "$$prereqdir/$$file" . ; \ done touch $@ # probes.h is handled differently because it's not in the distribution tarball. $(top_builddir)/src/include/utils/probes.h: probes.h cd '$(dir $@)' && rm -f $(notdir $@) && \ - $(LN_S) "../../../$(subdir)/probes.h" . + ln -s "../../../$(subdir)/probes.h" . .PHONY: install-data diff --git a/src/bin/initdb/Makefile b/src/bin/initdb/Makefile index 7e23754780..edb824bef2 100644 --- a/src/bin/initdb/Makefile +++ b/src/bin/initdb/Makefile @@ -44,7 +44,7 @@ initdb: $(OBJS) | submake-libpq submake-libpgport submake-libpgfeutils # We must pull in localtime.c from src/timezones localtime.c: % : $(top_srcdir)/src/timezone/% - rm -f $@ && $(LN_S) $< . + rm -f $@ && ln -s $< . install: all installdirs $(INSTALL_PROGRAM) initdb$(X) '$(DESTDIR)$(bindir)/initdb$(X)' diff --git a/src/bin/pg_rewind/Makefile b/src/bin/pg_rewind/Makefile index f398c3d848..0be0397806 100644 --- a/src/bin/pg_rewind/Makefile +++ b/src/bin/pg_rewind/Makefile @@ -39,7 +39,7 @@ pg_rewind: $(OBJS) | submake-libpq submake-libpgport $(CC) $(CFLAGS) $^ $(LDFLAGS) $(LDFLAGS_EX) $(LIBS) -o $@$(X) xlogreader.c: % : $(top_srcdir)/src/backend/access/transam/% - rm -f $@ && $(LN_S) $< . + rm -f $@ && ln -s $< . install: all installdirs $(INSTALL_PROGRAM) pg_rewind$(X) '$(DESTDIR)$(bindir)/pg_rewind$(X)' diff --git a/src/bin/pg_waldump/Makefile b/src/bin/pg_waldump/Makefile index 9f333d0c8a..3e610a3322 100644 --- a/src/bin/pg_waldump/Makefile +++ b/src/bin/pg_waldump/Makefile @@ -27,10 +27,10 @@ pg_waldump: $(OBJS) | submake-libpgport $(CC) $(CFLAGS) $^ $(LDFLAGS) $(LDFLAGS_EX) $(LIBS) -o $@$(X) xlogreader.c: % : $(top_srcdir)/src/backend/access/transam/% - rm -f $@ && $(LN_S) $< . + rm -f $@ && ln -s $< . $(RMGRDESCSOURCES): % : $(top_srcdir)/src/backend/access/rmgrdesc/% - rm -f $@ && $(LN_S) $< . + rm -f $@ && ln -s $< . install: all installdirs $(INSTALL_PROGRAM) pg_waldump$(X) '$(DESTDIR)$(bindir)/pg_waldump$(X)' diff --git a/src/interfaces/ecpg/preproc/Makefile b/src/interfaces/ecpg/preproc/Makefile index c4fc23f920..b67af84c7e 100644 --- a/src/interfaces/ecpg/preproc/Makefile +++ b/src/interfaces/ecpg/preproc/Makefile @@ -56,7 +56,7 @@ ecpg: $(OBJS) | submake-libpgport # We symlink typename.c from ecpglib and recompile it here typename.c: % : $(top_srcdir)/src/interfaces/ecpg/ecpglib/% - rm -f $@ && $(LN_S) $< . + rm -f $@ && ln -s $< . # See notes in src/backend/parser/Makefile about the following two rules preproc.h: preproc.c diff --git a/src/test/isolation/Makefile b/src/test/isolation/Makefile index da5e088bdd..bd54348933 100644 --- a/src/test/isolation/Makefile +++ b/src/test/isolation/Makefile @@ -29,7 +29,7 @@ submake-regress: $(MAKE) -C $(top_builddir)/src/test/regress pg_regress.o pg_regress.o: | submake-regress - rm -f $@ && $(LN_S) $(top_builddir)/src/test/regress/pg_regress.o . + rm -f $@ && ln -s $(top_builddir)/src/test/regress/pg_regress.o . pg_isolation_regress$(X): isolation_main.o pg_regress.o $(WIN32RES) $(CC) $(CFLAGS) $^ $(LDFLAGS) $(LDFLAGS_EX) $(LIBS) -o $@