bug-gnulib
[Top][All Lists]
Advanced

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

[PATCH] Do use readlink if available


From: Bernd Jendrissek
Subject: [PATCH] Do use readlink if available
Date: Thu, 21 Jun 2012 01:04:28 +0200

The main effect of this patch is to make gnulib-tool not spam the
terminal with failures from ls. Despite the copious stderr output,
files still get linked correctly.

2012-06-20  Bernd Jendrissek  <address@hidden>

        gnulib-tool: Use readlink if it is available.
        * gnulib-tool (func_readlink): Choose function more appropriately

>From 99adfd9832c9115540f014b1a62e2673982365b5 Mon Sep 17 00:00:00 2001
From: Bernd Jendrissek <address@hidden>
Date: Wed, 20 Jun 2012 22:46:18 +0200
Subject: [PATCH] type -p is not portable.

Running under dash, type -p readlink fails because dash doesn't
understand -p. That causes gnulib-tool to fall back to ls to read
symlinks, despite readlink being available. That, in turn, spams the
terminal when func_ln_if_changed's DEST argument doesn't exist.

The output from type goes to /dev/null anyway, so asking for -p has no
purpose.
---
 gnulib-tool |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/gnulib-tool b/gnulib-tool
index 16f9b2f..6213f50 100755
--- a/gnulib-tool
+++ b/gnulib-tool
@@ -591,7 +591,7 @@ func_warning ()

 # func_readlink SYMLINK
 # outputs the target of the given symlink.
-if (type -p readlink) > /dev/null 2>&1; then
+if (type readlink) > /dev/null 2>&1; then
   func_readlink ()
   {
     # Use the readlink program from GNU coreutils.
-- 
1.7.1



reply via email to

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