From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/14472 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: James Y Knight Newsgroups: gmane.linux.lib.musl.general Subject: Re: [PATCH] In glob(), do not require that the target of a symlink exists. Date: Tue, 30 Jul 2019 12:04:57 -0400 Message-ID: References: Reply-To: musl@lists.openwall.com Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="15388"; mail-complaints-to="usenet@blaine.gmane.org" To: musl@lists.openwall.com Original-X-From: musl-return-14488-gllmg-musl=m.gmane.org@lists.openwall.com Tue Jul 30 18:05:40 2019 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by blaine.gmane.org with smtp (Exim 4.89) (envelope-from ) id 1hsUd9-0003sh-3n for gllmg-musl@m.gmane.org; Tue, 30 Jul 2019 18:05:39 +0200 Original-Received: (qmail 25883 invoked by uid 550); 30 Jul 2019 16:05:37 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Original-Received: (qmail 25848 invoked from network); 30 Jul 2019 16:05:36 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=rcZ2sztvmjvyAbN31DLIDRlRzWM9tUPWP8A3tDwM/EM=; b=Bmc2AeJqqd9+X96h6okss80O5gPKrVlIlJ9iiTTlFkbYACQA+S18U4qwFuurK6aad+ +aUgNUzyD84N9xsHZZs7xGqkFMWGDn0i81FkWjWemVZItXDjlvsq1IDihxk2F19HxtET 2WPaQYJhjiv+pT0nX2QFtMdatkza2w8M7kSeIbQU4c9Oz0SLubPyFNWVtgOzrdhQIM7x pPtYADp9CT9aELmmij38Xk5D8dvUbtKskt0Zyu5q6sGrxUnZ3OQle1lrpXChIjgXUL/C aXx/Pxs0+6E/nsE85SXOhqkKx4DsbI7IhDYax2RIne4VmFotTix9L/wHJ7npdR9Gywhz vcCA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=rcZ2sztvmjvyAbN31DLIDRlRzWM9tUPWP8A3tDwM/EM=; b=j7DFvkqJhZTRj+8lwqCUDKM+nRsuuor4e2y9TAvxsGD/BQPeY1ecU4dfIGba+sD1iI 1vw5DjqUfJkKIX3bcF96m27hn+tWRq4qhiXcBp82B8oVCuCqx7dJJuZRDJfDY+i7zvWa HlrkRDQ7lD6vWqj5Iml8/sm3Srv0tUPiYkUsdHwyqRq5XymTRAbm/z3I0qtxMdYmCh+6 c+slNmp1Xozg1sOy8MF3wIMPzkqL1AG1UNFtYpOf4gbUyEO8oonu/4zcLF/5MmPjNKCf GLvVRDSo3kxMQZhDx8LEq6qRGz6qgfKWxcyBxiiXCkVGTp5VRlubDlfzN8ESkVgjRNPN cxJw== X-Gm-Message-State: APjAAAWSE41PYuiXKJtOAHaUNYjGRWaiEZxgTr7KqwF/dZ6zvUoDJqFE /3wIK/udWqbwUTX+ep9z5wugTSyHpkO/oU9HdJfjnLmo+n4= X-Google-Smtp-Source: APXvYqwKxU8FyKg59hIZ8bWQo1TOuDrC/oZHo8qLGo/dlM307yHvRp0MhEJ9jiqI7XQwWROhubJHnPudNnoteX4aCWU= X-Received: by 2002:ac5:ccda:: with SMTP id j26mr27005578vkn.43.1564502723451; Tue, 30 Jul 2019 09:05:23 -0700 (PDT) In-Reply-To: Xref: news.gmane.org gmane.linux.lib.musl.general:14472 Archived-At: Ping -- is this patch ok? On Mon, Jul 22, 2019 at 8:37 PM James Y Knight wrote: > > Previously, when given a trailing path component with no > metacharacters, glob would call stat to check if the provided filename > existed, which would fail on a broken symlink. When expanding a > pattern however, glob would trust the list of files returned by > readdir, and thus would return broken symlinks. > > Now, be consistent and allow broken symlinks in both cases, by using > lstat to determine file existence. > > If GLOB_MARK is specified, stat must still be used to determine > whether a given name refers to a directory or file. But if that fails, > a symlink is simply considered to be a file for marking purposes.