File git-02-4e5fe2a6ec5690b51a369d2134a1119962438fd1.patch of Package aaa_base.12401

From 4e5fe2a6ec5690b51a369d2134a1119962438fd1 Mon Sep 17 00:00:00 2001
From: Werner Fink <werner@suse.de>
Date: Tue, 4 Sep 2018 12:22:09 +0200
Subject: [PATCH] Avoid `ls' command in alljava shell scriptlets

with this the error messageses for not existing directories
are gone even for (t)csh.  Also the `-I' option had never
worked as expected due missed shell patterns.

Signed-off-by: Werner Fink <werner@suse.de>
---
 files/etc/profile.d/alljava.csh | 4 +++-
 files/etc/profile.d/alljava.sh  | 6 +++++-
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git files/etc/profile.d/alljava.csh files/etc/profile.d/alljava.csh
index d2d2378..602ee72 100644
--- files/etc/profile.d/alljava.csh
+++ files/etc/profile.d/alljava.csh
@@ -13,7 +13,9 @@ foreach JDIR ( "/usr/lib64/jvm" "/usr/lib/jvm" "/usr/java/latest" "/usr/java" )
 
     if ( ! -d $JDIR ) continue
 
-    foreach JPATH ( $JDIR $JDIR/java `ls -I 'java' -I 'jre' -d $JDIR/*` $JDIR/jre )
+    foreach JPATH ( $JDIR $JDIR/java $JDIR/java-[a-z]* $JDIR/java-[0-9]* $JDIR/jre $JDIR/jre-[a-z]* $JDIR/jre-[0-9]* )
+
+	if ( ! -d $JPATH ) continue
 
         if ( ! -x $JPATH/bin/java ) continue
 
diff --git files/etc/profile.d/alljava.sh files/etc/profile.d/alljava.sh
index 8c92a3f..8a2062a 100644
--- files/etc/profile.d/alljava.sh
+++ files/etc/profile.d/alljava.sh
@@ -15,7 +15,11 @@ for JDIR in /usr/lib64/jvm /usr/lib/jvm /usr/java/latest /usr/java; do
         continue
     fi
 
-    for JPATH in $JDIR $JDIR/java `ls -I 'java' -I 'jre' -d $JDIR/* 2>/dev/null` $JDIR/jre; do
+    for JPATH in $JDIR $JDIR/java $JDIR/java-[a-z]* $JDIR/java-[0-9]* $JDIR/jre $JDIR/jre-[a-z]* $JDIR/jre-[0-9]*; do
+
+    	if ! test -d $JPATH; then
+            continue
+    	fi
 
         if ! test -x $JPATH/bin/java; then
             continue
-- 
2.16.4

openSUSE Build Service is sponsored by