0.99.1 Linux: Searching similar files traverses symlinks to other folders some times causing infinite path recursion
Posted: Fri Sep 24, 2021 12:20 pm
XnView: MP 0.99.1 - 64 bit
OS: Ubuntu Linux 20.04 LTS - 64bit
Searching for similar files in a folder that contains symlinks to other folders results in program attempting to look in the symlinked folders some times results in infinite path recursion. Screenshot: Effect: This results in infinite path recursion (symlink loop) when there are symlinks in the traversed path pointing to a folder that is within the same traversed path. This is undesired behavior. This usually happens when there're symlinks linking to any folder on parent dir that has symlinks to current folder and any other similar cases. Same happens when trying to use "Show files in subfolder" function, resulting in enormous memory usage and subsequent system hang after some time.
To reproduce:
1. Execute commands as shown below to create a test directory structure
2. (optional) Copy images from some folder to a subdir, e.g. run commands as show below to copy 10 random files forom a folder (replace /path/to/some/dir with a path to folder of choice)
3. (optional) Copy files from first subdir as shown below or repeat above for other dirs (replace Dir1 with Dir2 or Dir3) for different files
4. Create symlinks, e.g. use commands like shown below
5. Search similar files and observe infinite path recursion as shown in screenshot above.
Actual behaviour (bug): Symlinks are traversed upon similar files search and when trying to load images from subfolder, causing infinite path recursion when traversed path contains symlinks to any folder found within the search path tree some times causing enormous momory usage and subsequent system hang
Expected behaviour: No symlinks traversed anywhere in the code, infinite path recursion caused by traversed path containing symlinks to other folders found within the search path tree should not happen.
OS: Ubuntu Linux 20.04 LTS - 64bit
Searching for similar files in a folder that contains symlinks to other folders results in program attempting to look in the symlinked folders some times results in infinite path recursion. Screenshot: Effect: This results in infinite path recursion (symlink loop) when there are symlinks in the traversed path pointing to a folder that is within the same traversed path. This is undesired behavior. This usually happens when there're symlinks linking to any folder on parent dir that has symlinks to current folder and any other similar cases. Same happens when trying to use "Show files in subfolder" function, resulting in enormous memory usage and subsequent system hang after some time.
To reproduce:
1. Execute commands as shown below to create a test directory structure
Code: Select all
mkdir -p test/{Dir1,Dir2,Dir3} && cd test
Code: Select all
find /path/to/some/dir -maxdepth 1 -type f | shuf -n 10 | xargs -I{} cp "{}" Dir1
Code: Select all
cp Dir1/*.* Dir2
cp Dir1/*.* Dir3
Code: Select all
cd Dir1
ln -s ../Dir2 Dir2
ln -s ../Dir3 Dir3
cd ../Dir2
ln -s ../Dir1 Dir1
ln -s ../Dir3 Dir3
cd ../Dir3
ln -s ../Dir1 Dir1
ln -s ../Dir2 Dir2
Actual behaviour (bug): Symlinks are traversed upon similar files search and when trying to load images from subfolder, causing infinite path recursion when traversed path contains symlinks to any folder found within the search path tree some times causing enormous momory usage and subsequent system hang

Expected behaviour: No symlinks traversed anywhere in the code, infinite path recursion caused by traversed path containing symlinks to other folders found within the search path tree should not happen.