cloudera-scripts-for-log4j icon indicating copy to clipboard operation
cloudera-scripts-for-log4j copied to clipboard

Symlinks are being followed and thus backing up the wrong jar

Open starkjs opened this issue 4 years ago • 3 comments

There is a number of bit of code like

for jarfile in $targetdir/**/*.jar; do

Thus symlinks are being followed and bad things happen, espically with backup of the link name and not the actual file

consider using for jarfile in $(find ${targetdir} -type f -name "*.jar") ; do

starkjs avatar Dec 15 '21 11:12 starkjs

I agree. This can be better controlled using the find command with the -f flag.

Take a look at #14

belugabehr avatar Dec 15 '21 15:12 belugabehr

Thanks for the report. We are looking into a fix.

We may still consider using globs in the scan phase, in case (for whatever reason) symlinks point to jars outside the target folder that might still be loaded.

jtran-cloudera avatar Dec 15 '21 23:12 jtran-cloudera

Hey @jtran-cloudera, yes, no issue if there is links to file outside of the scan path, but then the script needs to run on that location separately. We can't have it just assume /opt/cloudera is the only place files will exist and follow all the symlinks and then fail to take a backup of the actual file and use the symlink in-stead by accident.

starkjs avatar Dec 19 '21 11:12 starkjs