Blame SOURCES/rear-bz1652828-bz1652853.patch

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