Hi there,
Whilst reading the study guide, specifically page 847 in Chapter 14, I noticed that the example given in Table 14.13 appears to be correct all the way up to the last line.
The next-to-last line reads as follows:
Depth | Path reached |
---|
3 | /birds/robin/allBirds/robin/pictures |
| -> /birds/robin/pictures |
This makes sense since 'allBirds' is a symlink/symbolic link to '/birds/'.
However, the next and final line in the table reads:
Depth | Path reached |
---|
3 | /birds/robin/allBirds/robin/pictures/allBirds |
| /birds/robin/allBirds |
| -> /birds |
(Bold emphasis added by me).
The issue I see is that 'allBirds' appears to be a child of 'pictures' at this point?
I think that this may be a confusion which occurred since the next-to-last line is '/birds/robin/allBirds/robin/pictures', so it may have just been copied and '/allBirds' appended to this line.
I put together a small demo to verify this with a directory structure as follows:
using the PowerShell command:
where '->' is a symlink and which when traversed using Windows' 'tree' command, results in the following output:
I named the symlink 'xallBirds' instead of 'allBirds' in order to get the code below and the 'tree' command to traverse the 'pictures' directory first (and keep the example simple).
And executed the following code over this directory structure:
Now, I am aware that the example in the book uses a breadth-first search and I am using a method which does a depth-first search. However, the issue here lies in the path given and not in search order.
Notice that I start past the first filesystem cycle (by setting the 'pathToTraverse' variable on the first line accordingly) to avoid a FileSystemLoopException before I get output similar to (but correct) the last scenario in Table 14.13:
Of course, I still get a FileSystemLoopException on the next traversal, but that's besides the point. The output above is of importance.
Is this a legitimate error in the book or am I missing something?
Thank you.