[devel] OpenVZ/p8, bin/tar: Too many levels of symbolic links
Alexey Sheplyakov
asheplyakov на basealt.ru
Пн Апр 12 10:48:15 MSK 2021
Добрый день!
On 12.04.2021 10:59, Sergey Afonin wrote:
> On Tuesday 30 March 2021, Dmitry V. Levin wrote:
>
>> Интересно, на каком системном вызове это происходит, и как он выглядит?
>
> Как раз подвернулся архив, на котором при распаковке вылезло:
>
> В strace это выглядит как-то так:
>
> newfstatat(AT_FDCWD, "inn/.git/hooks/pre-rebase.sample", {st_mode=S_IFREG|000, st_size=0, ...}, AT_SYMLINK_NOFOLLOW) = 0
> unlinkat(AT_FDCWD, "inn/.git/hooks/pre-rebase.sample", 0) = 0
> symlinkat("/usr/share/git-core/hooks/pre-rebase", AT_FDCWD, "inn/.git/hooks/pre-rebase.sample") = > utimensat(AT_FDCWD, "inn/.git/hooks/pre-rebase.sample", [UTIME_OMIT, {tv_sec=1618208993, tv_nsec=0} /* 2021-04-12T06:29:53+0000 */], AT_SYMLINK_NOFOLLOW) = 0
> newfstatat(AT_FDCWD, "inn/.git/hooks/pre-rebase.sample", {st_mode=S_IFLNK|0777, st_size=36, ...}, AT_SYMLINK_NOFOLLOW) = 0
> openat(AT_FDCWD, "inn/.git/hooks/pre-rebase.sample", O_RDONLY|O_NOFOLLOW|O_CLOEXEC|O_PATH) = -1 ELOOP (Too many levels of symbolic links)
Сделали симлинк inn/.git/hooks/pre-rebase.sample (на /usr/share/git-core/hooks/pre-rebase).
И тут же пытаемся открыть с флагом O_NOFOLLOW.
O_NOFOLLOW
If the trailing component (i.e., basename) of pathname is a symbolic link,
then the open fails, with the error ELOOP. Symbolic links in earlier compo‐
nents of the pathname will still be followed. (Note that the ELOOP error
that can occur in this case is indistinguishable from the case where an open
fails because there are too many symbolic links found while resolving compo‐
nents in the prefix part of the pathname.)
Работает, как задокументировано.
Подробная информация о списке рассылки Devel