Scanning directory via SMB does not properly resolve symlinks, thus allowing loops.
In reality: sources/xfsprogs-2.10.2/include/disk is a symlink to '.'.
Including that results in: [13:37:51.069] now scanning /mickg/files/Disk_Q/sources/xfsprogs-2.10.2/include/disk/disk/disk/disk/disk/xfs/xfs/disk/disk/disk/disk/disk/xfs/xfs/disk/disk/disk/xfs/disk
/mickg/files/Disk_Q is a smb-share.
Mike
Is that SMB share on a linux machine or did you use NTFS symlinks ?
As far as I know there is no protection against symlink recursion as ownCloud does not support symlinks in general. It means that the file scanner needs to be improved to be aware of possible loops.
CC @icewind1991
I don't think there is a general solution to detect symlinks loops, on linux with local filesystem we could probably use the inode number exposed by stat() but that wont work for external storages that include symlinks
Add a release note about the use of Symlinks not being supported, and the danger of infinite loops.
Wouldn't a rather simple workaround to the looping issue be to just not follow any symlinks to directories? More fine-grained handling could be added later...
Add a release note about the use of Symlinks not being supported, and the danger of infinite loops.
should be added to the documentation @carlaschroder
Wouldn't a rather simple workaround to the looping issue be to just not follow any symlinks to directories?
In case we can easily detect symlinks - this might work out - anyway moving this to OC8.1
In case we can easily detect symlinks - this might work out
http://php.net/manual/en/function.is-link.php
added to 8.0 release notes
@jvillafanez is there an easy way to prevent following symlinks ?
From the SMB point of view, and taking into account that we're moving to use the native library, the link detection in SMB is unreliable right now.
php > print_r(smbclient_stat($a, 'smb://10.0.2.6/tmp/simlink'));
Array
(
[0] => -1734054622
[1] => 1070907291
[2] => 16877
[3] => 2
[4] => 1001
[5] => 1001
[6] => 0
[7] => 0
[8] => 1474372606
[9] => 1474372606
[10] => 1474372606
[11] => 512
[12] => 0
[dev] => -1734054622
[ino] => 1070907291
[mode] => 16877
[nlink] => 2
[uid] => 1001
[gid] => 1001
[rdev] => 0
[size] => 0
[atime] => 1474372606
[mtime] => 1474372606
[ctime] => 1474372606
[blksize] => 512
[blocks] => 0
)
php > echo decoct(16877 & octdec('0170000')) . "\n";
40000
According to http://man7.org/linux/man-pages/man2/stat.2.html that would mean "simlink" is a directory, but it's in fact a link to a directory.
On the other hand, the CLI can detect this using a "stat" call, but parsing and extracting that information will be messy, and probably not a good idea if something important is going to rely on this.
I might be using an outdated library version, but I haven't seen changes in the library regarding this.
Moving this to enhancement as it's a design challenge which doesn't have a proper easy solution. And symlinks are calling for this behaviour ...