Blame SOURCES/rear-bz1652828-bz1652853.patch

f25f8e
diff --git a/usr/share/rear/build/GNU/Linux/100_copy_as_is.sh b/usr/share/rear/build/GNU/Linux/100_copy_as_is.sh
f25f8e
index 9c4212ae..873e244e 100644
f25f8e
--- a/usr/share/rear/build/GNU/Linux/100_copy_as_is.sh
f25f8e
+++ b/usr/share/rear/build/GNU/Linux/100_copy_as_is.sh
f25f8e
@@ -54,9 +54,13 @@ Log "copy_as_is_executables = ${copy_as_is_executables[@]}"
f25f8e
 # add them to the LIBS list if they are not yet included in the copied files:
f25f8e
 Log "Adding required libraries of executables in all the copied files to LIBS"
f25f8e
 local required_library=""
f25f8e
-for required_library in $( RequiredSharedOjects "${copy_as_is_executables[@]}" ) ; do
f25f8e
-    # Skip when the required library was already actually copied by 'tar' above:
f25f8e
-    grep -q "$required_library" $copy_as_is_filelist_file && continue
f25f8e
+for required_library in $( RequiredSharedObjects "${copy_as_is_executables[@]}" ) ; do
f25f8e
+    # Skip when the required library was already actually copied by 'tar' above.
f25f8e
+    # grep for a full line (copy_as_is_filelist_file contains 1 file name per line)
f25f8e
+    # to avoid that libraries get skipped when their library path is a substring
f25f8e
+    # of another already copied library, e.g. do not skip /path/to/lib when
f25f8e
+    # /other/path/to/lib was already copied, cf. https://github.com/rear/rear/pull/1976
f25f8e
+    grep -q "^${required_library}\$" $copy_as_is_filelist_file && continue
f25f8e
     # Skip when the required library is already in LIBS:
f25f8e
     IsInArray "$required_library" "${LIBS[@]}" && continue
f25f8e
     Log "Adding required library '$required_library' to LIBS"
f25f8e
diff --git a/usr/share/rear/build/GNU/Linux/390_copy_binaries_libraries.sh b/usr/share/rear/build/GNU/Linux/390_copy_binaries_libraries.sh
f25f8e
index f7809bc7..ed02dea9 100644
f25f8e
--- a/usr/share/rear/build/GNU/Linux/390_copy_binaries_libraries.sh
f25f8e
+++ b/usr/share/rear/build/GNU/Linux/390_copy_binaries_libraries.sh
f25f8e
@@ -62,16 +62,16 @@ Log "Binaries being copied: ${all_binaries[@]}"
f25f8e
 copy_binaries "$ROOTFS_DIR/bin" "${all_binaries[@]}"
f25f8e
 
f25f8e
 # Copy libraries:
f25f8e
-# It is crucial to also have all LIBS itself in all_libs because RequiredSharedOjects()
f25f8e
+# It is crucial to also have all LIBS itself in all_libs because RequiredSharedObjects()
f25f8e
 # outputs only those libraries that are required by a library but not the library itself
f25f8e
 # so that without all LIBS itself in all_libs those libraries in LIBS are missing that
f25f8e
 # are not needed by a binary in all_binaries (all_binaries were already copied above).
f25f8e
-# RequiredSharedOjects outputs the required shared objects on STDOUT.
f25f8e
+# RequiredSharedObjects outputs the required shared objects on STDOUT.
f25f8e
 # The output are absolute paths to the required shared objects.
f25f8e
 # The output can also be symbolic links (also as absolute paths).
f25f8e
 # In case of symbolic links only the link but not the link target is output.
f25f8e
 # Therefore for symbolic links also the link target gets copied below.
f25f8e
-local all_libs=( "${LIBS[@]}" $( RequiredSharedOjects "${all_binaries[@]}" "${LIBS[@]}" ) )
f25f8e
+local all_libs=( "${LIBS[@]}" $( RequiredSharedObjects "${all_binaries[@]}" "${LIBS[@]}" ) )
f25f8e
 
f25f8e
 Log "Libraries being copied: ${all_libs[@]}"
f25f8e
 local lib=""
f25f8e
diff --git a/usr/share/rear/build/OPALPBA/Linux-i386/391_list_executable_dependencies.sh b/usr/share/rear/build/OPALPBA/Linux-i386/391_list_executable_dependencies.sh
f25f8e
index 9803200d..8cb27d78 100644
f25f8e
--- a/usr/share/rear/build/OPALPBA/Linux-i386/391_list_executable_dependencies.sh
f25f8e
+++ b/usr/share/rear/build/OPALPBA/Linux-i386/391_list_executable_dependencies.sh
f25f8e
@@ -8,7 +8,7 @@ if is_true $KEEP_BUILD_DIR; then
f25f8e
     executable_dependencies_list="$TMP_DIR/executable-dependencies"
f25f8e
 
f25f8e
     for executable in "${executables[@]}"; do
f25f8e
-        dependents=( $(RequiredSharedOjects "$ROOTFS_DIR/$executable") )
f25f8e
+        dependents=( $(RequiredSharedObjects "$ROOTFS_DIR/$executable") )
f25f8e
         echo "$executable: ${dependents[*]}"
f25f8e
     done > "$executable_dependencies_list"
f25f8e
 
f25f8e
diff --git a/usr/share/rear/build/default/980_verify_rootfs.sh b/usr/share/rear/build/default/980_verify_rootfs.sh
f25f8e
index f8b3e8e9..d03e5f34 100644
f25f8e
--- a/usr/share/rear/build/default/980_verify_rootfs.sh
f25f8e
+++ b/usr/share/rear/build/default/980_verify_rootfs.sh
f25f8e
@@ -51,6 +51,11 @@ if test "$BACKUP" = "SESAM" ; then
f25f8e
     # related libraries
f25f8e
     export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$SESAM_LD_LIBRARY_PATH
f25f8e
 fi
f25f8e
+if test "$BACKUP" = "NBU" ; then
f25f8e
+    # Use a NBU-specific LD_LIBRARY_PATH to find NBU libraries
f25f8e
+    # see https://github.com/rear/rear/issues/1974
f25f8e
+    export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$NBU_LD_LIBRARY_PATH
f25f8e
+fi
f25f8e
 # Actually test all binaries for 'not found' libraries.
f25f8e
 # Find all binaries and libraries also e.g. those that are copied via COPY_AS_IS into other paths:
f25f8e
 for binary in $( find $ROOTFS_DIR -type f -executable -printf '/%P\n' ); do
f25f8e
diff --git a/usr/share/rear/conf/default.conf b/usr/share/rear/conf/default.conf
f25f8e
index 0f0d0675..796f228a 100644
f25f8e
--- a/usr/share/rear/conf/default.conf
f25f8e
+++ b/usr/share/rear/conf/default.conf
f25f8e
@@ -1467,7 +1467,8 @@ OBDR_BLOCKSIZE=2048
f25f8e
 ##
f25f8e
 #
f25f8e
 COPY_AS_IS_NBU=( /usr/openv/bin/vnetd /usr/openv/bin/vopied /usr/openv/lib /usr/openv/netbackup /usr/openv/var/auth/[mn]*.txt )
f25f8e
-COPY_AS_IS_EXCLUDE_NBU=( "/usr/openv/netbackup/logs/*" "/usr/openv/netbackup/bin/bpjava*" "/usr/openv/netbackup/bin/xbp" )
f25f8e
+COPY_AS_IS_EXCLUDE_NBU=( "/usr/openv/netbackup/logs/*" "/usr/openv/netbackup/bin/bpjava*" /usr/openv/netbackup/bin/xbp /usr/openv/netbackup/bin/private /usr/openv/lib/java /usr/openv/lib/shared/vddk /usr/openv/netbackup/baremetal )
f25f8e
+NBU_LD_LIBRARY_PATH="/usr/openv/lib"
f25f8e
 PROGS_NBU=( )
f25f8e
 
f25f8e
 ##
f25f8e
diff --git a/usr/share/rear/lib/_input-output-functions.sh b/usr/share/rear/lib/_input-output-functions.sh
f25f8e
index d5eed43e..bdbf593d 100644
f25f8e
--- a/usr/share/rear/lib/_input-output-functions.sh
f25f8e
+++ b/usr/share/rear/lib/_input-output-functions.sh
f25f8e
@@ -324,10 +324,11 @@ function LogToSyslog () {
f25f8e
 # see https://github.com/rear/rear/issues/729
f25f8e
 function has_binary () {
f25f8e
     for bin in $@ ; do
f25f8e
-        # Suppress success output via stdout (but keep failure output via stderr):
f25f8e
-        if type $bin 1>/dev/null ; then
f25f8e
-            return 0
f25f8e
-        fi
f25f8e
+        # Suppress success output via stdout which is crucial when has_binary is called
f25f8e
+        # in other functions that provide their intended function results via stdout
f25f8e
+        # to not pollute intended function results with intermixed has_binary stdout
f25f8e
+        # (e.g. the RequiredSharedObjects function) but keep failure output via stderr:
f25f8e
+        type $bin 1>/dev/null && return 0
f25f8e
     done
f25f8e
     return 1
f25f8e
 }
f25f8e
diff --git a/usr/share/rear/lib/linux-functions.sh b/usr/share/rear/lib/linux-functions.sh
f25f8e
index 6a767367..3fb44e6d 100644
f25f8e
--- a/usr/share/rear/lib/linux-functions.sh
f25f8e
+++ b/usr/share/rear/lib/linux-functions.sh
f25f8e
@@ -100,13 +100,13 @@ function FindStorageDrivers () {
f25f8e
 
f25f8e
 # Determine all required shared objects (shared/dynamic libraries)
f25f8e
 # for programs and/or shared objects (binaries) specified in $@.
f25f8e
-# RequiredSharedOjects outputs the required shared objects on STDOUT.
f25f8e
+# RequiredSharedObjects outputs the required shared objects on STDOUT.
f25f8e
 # The output are absolute paths to the required shared objects.
f25f8e
 # The output can also be symbolic links (also as absolute paths).
f25f8e
 # In case of symbolic links only the link but not the link target is output.
f25f8e
-function RequiredSharedOjects () {
f25f8e
-    has_binary ldd || Error "Cannot run RequiredSharedOjects() because there is no ldd binary"
f25f8e
-    Log "RequiredSharedOjects: Determining required shared objects"
f25f8e
+function RequiredSharedObjects () {
f25f8e
+    has_binary ldd || Error "Cannot run RequiredSharedObjects() because there is no ldd binary"
f25f8e
+    Log "RequiredSharedObjects: Determining required shared objects"
f25f8e
     # It uses 'ldd' to determine all required shared objects because 'ldd' outputs
f25f8e
     # also transitively required shared objects i.e. libraries needed by libraries,
f25f8e
     # e.g. for /usr/sbin/parted also the libraries needed by the libparted library:
f25f8e
@@ -164,10 +164,11 @@ function RequiredSharedOjects () {
f25f8e
     #  2. Line: "        lib (mem-addr)"                 -> virtual library
f25f8e
     #  3. Line: "        lib => not found"               -> print error to stderr
f25f8e
     #  4. Line: "        lib => /path/to/lib (mem-addr)" -> print $3 '/path/to/lib'
f25f8e
-    #  5. Line: "        /path/to/lib (mem-addr)"        -> print $1 '/path/to/lib'
f25f8e
+    #  5. Line: "        /path/to/lib => /path/to/lib2 (mem-addr)" -> print $3 '/path/to/lib2'
f25f8e
+    #  6. Line: "        /path/to/lib (mem-addr)"        -> print $1 '/path/to/lib'
f25f8e
     ldd "$@" | awk ' /^\t.+ => not found/ { print "Shared object " $1 " not found" > "/dev/stderr" }
f25f8e
                      /^\t.+ => \// { print $3 }
f25f8e
-                     /^\t\// { print $1 } ' | sort -u
f25f8e
+                     /^\t\// && !/ => / { print $1 } ' | sort -u
f25f8e
 }
f25f8e
 
f25f8e
 # Provide a shell, with custom exit-prompt and history
f25f8e
diff --git a/usr/share/rear/prep/NBU/default/450_check_nbu_client_configured.sh b/usr/share/rear/prep/NBU/default/450_check_nbu_client_configured.sh
f25f8e
index e01dcdbd..3cc29777 100644
f25f8e
--- a/usr/share/rear/prep/NBU/default/450_check_nbu_client_configured.sh
f25f8e
+++ b/usr/share/rear/prep/NBU/default/450_check_nbu_client_configured.sh
f25f8e
@@ -5,5 +5,6 @@
f25f8e
 Log "Running: /usr/openv/netbackup/bin/bplist command"
f25f8e
 LANG=C /usr/openv/netbackup/bin/bplist -l -s `date -d "-5 days" \
f25f8e
 	"+%m/%d/%Y"` / >/dev/null
f25f8e
-[ $? -gt 0 ] && LogPrint "WARNING: Netbackup bplist check failed with error code $?.
f25f8e
+rc=$?
f25f8e
+[ $rc -gt 0 ] && LogPrint "WARNING: Netbackup bplist check failed with error code ${rc}.
f25f8e
 See $RUNTIME_LOGFILE for more details."