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:subject:to:references:from:message-id:date :mime-version:in-reply-to:content-type :content-transfer-encoding; q=dns; s=default; b=QyNv3yecz5fJdnVK AtPwn6lO0dtsco8OeELyt3o/GK+8IhlHT8qgDU6fGutFgk95iRmUkDouZgccEsMf 2PrfuVSrxizyN5gHvLVM6H7w32nfMvYd0isIDj+d8WhAxcevJquV0rUcMJUpQhq3 /Aaizqef3WsLrLHCHZAMqMRKic8= 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:subject:to:references:from:message-id:date :mime-version:in-reply-to:content-type :content-transfer-encoding; s=default; bh=ledUWXbrCy0OxR64/2pVEn 2QcMU=; b=vNdzXjpky2WYAFh8R6Aq/lu8OaCACr1Q1+8s3P/yz5PTraa+8pSZpD QWAaHNX2BrbqjW8A77kLue3TOkXkq8ERUUQ07aGi62tfIxqxMObN6ZbCyjYLE1Ay oj1cl5mnF1X08U4XSwmBgpNMAqPnMnwdzViUqJvD/edkN+1PSv0A4= 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=-0.9 required=5.0 tests=BAYES_00,KAM_LAZY_DOMAIN_SECURITY,SPF_HELO_PASS,T_RP_MATCHES_RCVD autolearn=no version=3.3.2 spammy=HContent-Transfer-Encoding:8bit X-HELO: mx1.redhat.com Subject: Re: mkshortcut fails when run from setup, postinstall/cygwin-doc.sh - not otherwise To: cygwin AT cygwin DOT com References: From: Eric Blake Message-ID: <4e5c7d98-441a-7458-3b63-0fb864bdda04@redhat.com> Date: Wed, 20 Dec 2017 10:02:48 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-IsSubscribed: yes On 12/20/2017 06:59 AM, Enrique Perez-Terron wrote: > So I have added a line "set -x" at the top in postinstall/cygwin-doc.sh, > and the relevant section becomes > >  + read target name desc >  + '[' -r ']' > > > (by the way -- this reveals another bug too: The script says "[ -r $t ] > && $mks ..." where I am sure it should be "[ -r $target ] && $mks ...") Or, rather, [ -r "$target" ] It is almost always a bug to use [ ] without quoting "$..." expansions, because if the expansion of $... is empty, it changes the number of arguments to [ and thus the test that [ performs. If your script uses #!/bin/bash, then you can use bashisms like: [[ -r $target ]] which do the right thing ('[[' is part of the shell grammar, rather than treated like an executable; as such, you can safely omit quoting in that form; but '[[' is not yet POSIX and is not supported on dash). > (and again btw, I am not sure bash should count "[ -r ]" as a true > statement) I am. POSIX requires that behavior. Any time you have exactly one argument to '[', the result is true unless that argument was the empty string. -- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org -- 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