code to backup for tar.gz is invalid
The code here is not working (cm_cdp_cdh_log4j_jndi_removal.sh line 139)
local backupdir=${2:-/opt/cloudera/log4shell-backup}
mkdir -p "$backupdir/$(dirname $tarfile)"
targetbackup="$backupdir/$tarfile.backup"
if [ ! -f "$targetbackup" ]; then
echo "Backing up to '$targetbackup'"
cp -f "$tarfile" "$targetbackup"
fi
You do a mkdir for a path and then don't use it.
I can't see any backups for the *.tar.gz in the location of the backupdir
There is something wrong with this block of code
Also the function is always creating a new tar.gz, even if there is nothing to "patch" thus touching files which don't need to be altered - this is bad.....
Related https://github.com/cloudera/cloudera-scripts-for-log4j/issues/27
This is fixed now, it was related to data leaking due to reused variable names from function to function. I have made all variables within functions local now
@starkjs Pertaining to this issue has the script been corrected by any chance or it is still the same in cm_cdp_cdh_log4j_jndi_removal.sh.
You do a mkdir for a path and then don't use it.
I can't see any backups for the *.tar.gz in the location of the backupdir
There is something wrong with this block of code
Also the function is always creating a new tar.gz, even if there is nothing to "patch" thus touching files which don't need to be altered - this is bad.....