threads / patch / 32170

patchmakefile: hide stderr of curl-config test

Subject: [PATCH] makefile: hide stderr of curl-config test

## tl;dr

2 messages between Nov 22, 2012 and Nov 26, 2012. Diffs are folded; open one to read it.

replies: 1people: 2as markdown or json

Paul Gortmaker· Nov 22, 2012, 03:19 UTC · lore
Currently, if you don't have curl installed, you will get
    $ make distclean 2>&1 | grep curl
    /bin/sh: curl-config: not found
    /bin/sh: curl-config: not found
    /bin/sh: curl-config: not found
    /bin/sh: curl-config: not found
    /bin/sh: curl-config: not found
    $

The intent is not to alarm the user, but just to test if there is a new enough curl installed. However, if you look at search engine suggested completions, the above "error" messages are confusing people into thinking curl is a hard requirement.

This test dates back 7+ years to:
 ---------------------
  commit 0890098780f295f2a58658d1f6b6627e40426c72
  Author: Nick Hengeveld <nickh@reactrix.com>
  Date:   Fri Nov 18 17:08:36 2005 -0800
    Decide whether to build http-push in the Makefile
 ---------------------

It wants to ensure curl is newer than 070908. The oldest machine I could find (RHEL 4.6) is 2007 vintage according to /proc/version data, and it has curl 070C01.

The failure here is to mask stderr in the test. However, since the chance of curl being installed, but too old is essentially nil, lets just check for existence and drop the ancient version threshold check, if for no other reason, than to simplifly the parsing of what the makefile is trying to do by humans.

Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Show changes to Makefile +2 −2
diff --git a/Makefile b/Makefile
index 9bc5e40..56f55f6 100644
--- a/Makefile
+++ b/Makefile
@@ -1573,8 +1573,8 @@ else
 	REMOTE_CURL_NAMES = $(REMOTE_CURL_PRIMARY) $(REMOTE_CURL_ALIASES)
 	PROGRAM_OBJS += http-fetch.o
 	PROGRAMS += $(REMOTE_CURL_NAMES)
-	curl_check := $(shell (echo 070908; curl-config --vernum) | sort -r | sed -ne 2p)
-	ifeq "$(curl_check)" "070908"
+	curl_check := $(shell curl-config --vernum 2>/dev/null)
+	ifneq "$(curl_check)" ""
 		ifndef NO_EXPAT
 			PROGRAM_OBJS += http-push.o
 		endif
-- 
1.8.0
Junio C Hamano· Nov 26, 2012, 18:30 UTC · re: Paul Gortmaker · lore

Re: [PATCH] makefile: hide stderr of curl-config test

Paul Gortmaker <paul.gortmaker@windriver.com> writes:
Show 14 quoted lines
> Currently, if you don't have curl installed, you will get
>
>     $ make distclean 2>&1 | grep curl
>     /bin/sh: curl-config: not found
>     /bin/sh: curl-config: not found
>     /bin/sh: curl-config: not found
>     /bin/sh: curl-config: not found
>     /bin/sh: curl-config: not found
>     $
>
> The intent is not to alarm the user, but just to test if there is
> a new enough curl installed.  However, if you look at search engine
> suggested completions, the above "error" messages are confusing
> people into thinking curl is a hard requirement.

Good observation and identification of an issue to tackle. But why isn't the patch like this?

 	PROGRAMS += $(REMOTE_CURL_NAMES)
-	curl_check := $(shell (echo 070908; curl-config --vernum) | sort -r | sed -ne 2p)
+	curl_check := $(shell (echo 070908; curl-config --vernum) 2>/dev/null | sort -r | sed -ne 2p)
 	ifeq "$(curl_check)" "070908"

Removal of the "reject old libcURL" is logically a separate thing regardless of the "alarming output from make", and it probably is better done as a separate step in a two-patch series. Doing things that way, when somebody objects to this:

> It wants to ensure curl is newer than 070908.  The oldest
> machine I could find (RHEL 4.6) is 2007 vintage according
> to /proc/version data, and it has curl 070C01.

saying that their installation still cares about older libcURL, we can still keep the "remove alarming output from make" bit.

Show 24 quoted lines
>
> The failure here is to mask stderr in the test.  However, since
> the chance of curl being installed, but too old is essentially
> nil, lets just check for existence and drop the ancient version
> threshold check, if for no other reason, than to simplifly the
> parsing of what the makefile is trying to do by humans.
>
> Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
>
> diff --git a/Makefile b/Makefile
> index 9bc5e40..56f55f6 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -1573,8 +1573,8 @@ else
>  	REMOTE_CURL_NAMES = $(REMOTE_CURL_PRIMARY) $(REMOTE_CURL_ALIASES)
>  	PROGRAM_OBJS += http-fetch.o
>  	PROGRAMS += $(REMOTE_CURL_NAMES)
> -	curl_check := $(shell (echo 070908; curl-config --vernum) | sort -r | sed -ne 2p)
> -	ifeq "$(curl_check)" "070908"
> +	curl_check := $(shell curl-config --vernum 2>/dev/null)
> +	ifneq "$(curl_check)" ""
>  		ifndef NO_EXPAT
>  			PROGRAM_OBJS += http-push.o
>  		endif

← back to recent threads