From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on sa.local.altlinux.org X-Spam-Level: X-Spam-Status: No, score=-4.3 required=5.0 tests=ALL_TRUSTED,BAYES_00, RP_MATCHES_RCVD autolearn=unavailable autolearn_force=no version=3.4.1 To: devel@lists.altlinux.org References: <202103291229.38338.asy@altlinux.org> <20210330100722.GA27387@altlinux.org> <202104121059.25933.asy@altlinux.org> From: Alexey Sheplyakov Message-ID: <851a0bc8-7ab8-43bc-fde5-574f40ebc8fe@basealt.ru> Date: Mon, 12 Apr 2021 11:48:15 +0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.1 MIME-Version: 1.0 In-Reply-To: <202104121059.25933.asy@altlinux.org> Content-Type: text/plain; charset=UTF-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Subject: Re: [devel] OpenVZ/p8, bin/tar: Too many levels of symbolic links X-BeenThere: devel@lists.altlinux.org X-Mailman-Version: 2.1.12 Precedence: list Reply-To: ALT Linux Team development discussions List-Id: ALT Linux Team development discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Apr 2021 07:48:18 -0000 Archived-At: List-Archive: List-Post: Добрый день! 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.) Работает, как задокументировано.