commit:     79683c888a48734c9aac355a8b91fa69bb38c8d0
Author:     Lars Wendler <polynomial-c <AT> gentoo <DOT> org>
AuthorDate: Wed Apr 11 09:54:27 2018 +0000
Commit:     Lars Wendler <polynomial-c <AT> gentoo <DOT> org>
CommitDate: Wed Apr 11 09:58:52 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=79683c88

sys-block/di: Avoid using non POSIX compliant "echo -n ... \c"

Package-Manager: Portage-2.3.28, Repoman-2.3.9

 sys-block/di/di-4.45.ebuild                |   1 +
 sys-block/di/files/di-4.45-no_echo-n.patch | 172 +++++++++++++++++++++++++++++
 2 files changed, 173 insertions(+)

diff --git a/sys-block/di/di-4.45.ebuild b/sys-block/di/di-4.45.ebuild
index c910d5e247d..0f2ee5708aa 100644
--- a/sys-block/di/di-4.45.ebuild
+++ b/sys-block/di/di-4.45.ebuild
@@ -19,6 +19,7 @@ DEPEND="nls? ( sys-devel/gettext )"
 
 PATCHES=(
        "${FILESDIR}"/${PN}-4.33-build.patch
+       "${FILESDIR}"/${PN}-4.45-no_echo-n.patch
 )
 
 src_configure() {

diff --git a/sys-block/di/files/di-4.45-no_echo-n.patch 
b/sys-block/di/files/di-4.45-no_echo-n.patch
new file mode 100644
index 00000000000..c0c1b1e0f2a
--- /dev/null
+++ b/sys-block/di/files/di-4.45-no_echo-n.patch
@@ -0,0 +1,172 @@
+Neither "echo -n" nor "echo ... \c" is POSIX compliant.
+
+See "man 1p echo" section "APPLICATION USAGE" or
+https://www.in-ulm.de/%7Emascheck/various/echo+printf/
+
+--- di-4.45/C/tests.d/rpmbuild.sh
++++ di-4.45/C/tests.d/rpmbuild.sh
+@@ -12,13 +12,13 @@
+ locatecmd locrpmbuild rpmbuild
+ 
+ if [ "${locrpmbuild}" = "" ];then
+-  echo ${EN} " skipped${EC}" >&5
++  printf '%s' " skipped" >&5
+   exit 0
+ fi
+ 
+ rvers=`rpmbuild --version | tr -cd '0-9' | sed 's/^\(...\).*/\1/'`
+ if [ $rvers -lt 470 ]; then
+-  echo ${EN} " old version skipped${EC}" >&5
++  printf '%s' " old version skipped" >&5
+   exit 0
+ fi
+ 
+--- di-4.45/mkconfig/bin/shellfuncs.sh
++++ di-4.45/mkconfig/bin/shellfuncs.sh
+@@ -28,17 +28,6 @@
+   echo "mkconfig version ${_MKCONFIG_VERSION}"
+ }
+ 
+-setechovars () {
+-  EN='-n'
+-  EC=''
+-  if [ "`echo -n test`" = "-n test" ]; then
+-    EN=''
+-    EC='\c'
+-  fi
+-  export EN
+-  export EC
+-}
+-
+ dosubst () {
+   subvar=$1
+   shift
+--- di-4.45/mkconfig/bin/testfuncs.sh
++++ di-4.45/mkconfig/bin/testfuncs.sh
+@@ -19,14 +19,14 @@
+ 
+ chkccompiler () {
+   if [ "${CC}" = "" ]; then
+-    echo ${EN} " no C compiler; skipped${EC}" >&5
++    printf '%s' " no C compiler; skipped" >&5
+     exit 0
+   fi
+ }
+ 
+ chkdcompiler () {
+   if [ "${DC}" = "" ]; then
+-    echo ${EN} " no D compiler; skipped${EC}" >&5
++    printf '%s' " no D compiler; skipped" >&5
+     exit 0
+   fi
+ }
+--- di-4.45/mkconfig/mkconfig.sh
++++ di-4.45/mkconfig/mkconfig.sh
+@@ -154,7 +154,7 @@
+   tlabel=$2
+ 
+   echo "   $ifleveldisp[${tname}] ${tlabel} ... " >&9
+-  echo ${EN} "${ifleveldisp}${tlabel} ... ${EC}" >&1
++  printf '%s' "${ifleveldisp}${tlabel} ... " >&1
+ }
+ 
+ _doexport () {
+--- di-4.45/mkconfig/units/c-main.sh
++++ di-4.45/mkconfig/units/c-main.sh
+@@ -559,7 +559,7 @@
+       eval $cmd
+       echo "## dcl(C): ${dcl}" >&9
+       c=`echo ${dcl} | sed 's/[^,]*//g'`
+-      ccount=`echo ${EN} "$c${EC}" | wc -c`
++      ccount=`printf '%s' "$c" | wc -c`
+       domath ccount "$ccount + 1"  # 0==1 also, unfortunately
+       c=`echo ${dcl} | sed 's/^[^(]*(//'`
+       c=`echo ${c} | sed 's/)[^)]*$//'`
+--- di-4.45/mkconfig/units/d-main.sh
++++ di-4.45/mkconfig/units/d-main.sh
+@@ -1680,7 +1680,7 @@
+       echo "## tdcl(D): ${tdcl}" >&9
+       if [ $argflag = 1 ]; then
+         c=`echo ${tdcl} | sed 's/[^,]*//g'`
+-        ccount=`echo ${EN} "$c${EC}" | wc -c`
++        ccount=`printf '%s' "$c" | wc -c`
+         domath ccount "$ccount + 1"  # 0==1 also, unfortunately
+         c=`echo ${tdcl} | sed 's/^[^(]*(//'`
+         c=`echo ${c} | sed 's/)[^)]*$//'`
+--- di-4.45/tests.d/buildsh.sh
++++ di-4.45/tests.d/buildsh.sh
+@@ -43,7 +43,7 @@
+       fi
+     fi
+ 
+-    echo ${EN} " ${d}${EC}" >&5
++    printf '%s' " ${d}" >&5
+     ${MAKE:-make} ${TMAKEFLAGS} realclean
+     ${MAKE:-make} ${TMAKEFLAGS} -e prefix=${instdir} all > make.log 2>&1
+     rc=$?
+--- di-4.45/tests.d/diarg.sh
++++ di-4.45/tests.d/diarg.sh
+@@ -93,7 +93,7 @@
+   tdir=$_MKCONFIG_RUNTOPDIR/$d
+ 
+   if [ -x ${tdir}/di ]; then
+-    echo ${EN} " ${d}${EC}" >&5
++    printf '%s' " ${d}" >&5
+     # most all unix
+     ${tdir}/di -n -f M / 2>/dev/null | grep '^/[ ]*$' > /dev/null 2>&1
+     rc=$?
+@@ -135,7 +135,7 @@
+     done
+ 
+     if [ $lrc -ne 0 ]; then
+-      echo ${EN} "*${EC}" >&5
++      printf '%s' "*" >&5
+       grc=1
+     fi
+   else
+--- di-4.45/tests.d/disort.sh
++++ di-4.45/tests.d/disort.sh
+@@ -41,7 +41,7 @@
+     fi
+   )
+   if [ -x $tdir/di ]; then
+-    echo ${EN} " ${d}${EC}" >&5
++    printf '%s' " ${d}" >&5
+     echo "## regular sort first, then di sort"
+     echo "by special"
+     ${tdir}/di -n -a -f S | sort > s1
+@@ -118,12 +118,12 @@
+ 
+     rm -f s1 s2
+     if [ $grc -ne 0 ]; then
+-      echo ${EN} "*${EC}" >&5
++      printf '%s' "*" >&5
+     fi
+   else
+     if [ $d = C ]; then
+       echo "## no di executable found for dir $d"
+-      echo ${EN} "*${EC}" >&5
++      printf '%s' "*" >&5
+       grc=1
+     fi
+   fi
+--- di-4.45/tests.d/ditot.sh
++++ di-4.45/tests.d/ditot.sh
+@@ -27,7 +27,7 @@
+     fi
+   )
+   if [ -x ${tdir}/di ]; then
+-    echo ${EN} " ${d}${EC}" >&5
++    printf '%s' " ${d}" >&5
+     for format in $FORMATS; do
+       echo "Checking format: $format"
+       # have to exclude zfs, null (dragonflybsd)
+@@ -37,7 +37,7 @@
+       didata=`${tdir}/di -n -d1 -f $format -t -a -x 
null,zfs,ctfs,objfs,sharefs 2>/dev/null `
+       summtot=`(echo "0 ";echo $didata | sed 's/  */ + /g'; echo " - p") | dc`
+       if [ $summtot -ne 0 ]; then
+-        echo ${EN} "*${EC}" >&5
++        printf '%s' "*" >&5
+         echo "## format: $format failed"
+         grc=1
+       fi

Reply via email to