X-Recipient: archive-cygwin AT delorie DOT com DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:references:date:in-reply-to :message-id:mime-version:content-type; q=dns; s=default; b=MRWi+ RxxVgmAiZ+kzYxUlvZL2szY0J0T4X0v4+ZnTB53N+sVnZ5O/xnNX8Q6h7szBmHa/ cO3q+jZyaNwycJvhlJng6SVPJ8SG/WzIETE6uP8D++70bes941xQrrKl9AF99Vuq Rd+9OUv96567KpSCTTzUtXT14+LjrrEOEuhNBU= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:references:date:in-reply-to :message-id:mime-version:content-type; s=default; bh=hX5Yo/hJlV2 TV8OHBo9oTG101yA=; b=PyP8vJDYHmRcvLnfmOWE+qW2BIKY634ypk0ZZXVdD/O H1gzTdWgrmCAaIWLOJpgzg/hT3XaHq7dNTWUgY6QVgXc+ABC6a2YuZwCV0K2YtCI VrX4DdIJJAfbG2vREag3b1njLJ6O1a945mg7Q7lBhgqkNPNplkpKOO+5bcchGfQk = Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-6.4 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_2,SPF_PASS autolearn=ham version=3.3.2 spammy=Hx-spam-relays-external:ESMTPA X-HELO: vsmx011.vodafonemail.xion.oxcs.net From: Achim Gratz To: cygwin AT cygwin DOT com Subject: Re: [bug] coreutils: potentially dangerous: $(realpath //) != / References: <20180312232815 DOT 692b5da79fc18abf86d42ba1 AT inbox DOT ru> Date: Mon, 12 Mar 2018 21:47:09 +0100 In-Reply-To: <20180312232815.692b5da79fc18abf86d42ba1@inbox.ru> (Mikhail Usenko via cygwin's message of "Mon, 12 Mar 2018 23:28:15 +0300") Message-ID: <87efkpaunm.fsf@Rainer.invalid> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-VADE-STATUS: LEGIT Mikhail Usenko via cygwin writes: > coreutils-8.26-2 > cygwin-2.10.0-1 > > Test case 1: > ------------------- > $ realpath // > // > ------------------- > Expected output: / Adjust your expectations, a double slash at the beginning signifies a network path (as expressedly allowed for in POSIX) and can't be simplified. > Test case 2: > ------------------- > $ MYDIR=// > $ test "$(realpath -e "$MYDIR" )" != / && echo rm -rf "$MYDIR"/* > rm -rf ///bin ///cygdrive ///Cygwin.bat ///Cygwin.ico ///Cygwin-Terminal.ico ///dev ///etc ///home ///lib ///proc ///sbin ///tmp ///usr ///var > ------------------- > Expected output: no output This goes to show that you really, really, really want to understand the corner cases in this script. Regards, Achim. -- +<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+ SD adaptation for Waldorf microQ V2.22R2: http://Synth.Stromeko.net/Downloads.html#WaldorfSDada -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple