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:references:to:from:reply-to:message-id :date:mime-version:in-reply-to:content-type :content-transfer-encoding; q=dns; s=default; b=ThelrsmyzJ+Stc0p 9RvGO4d3RgIWgsfYv32ZEiO0v9jE1PYMUsfaNq0DuvePjLDY66F3Ke8lf1SSI1V6 NQD7gUtYP4o5krT5mzxzAqdRknxKTLyxdl6+wpiVMEAJmbZRCHjAdVIVDEpGR/8c B/CFxjtBmAICJxq9pXhh+eZ5AbA= 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:references:to:from:reply-to:message-id :date:mime-version:in-reply-to:content-type :content-transfer-encoding; s=default; bh=GKYCS3jewmDgiC6bZouP03 Qk7zw=; b=Pe2BgNEnxjVTZrmvOOrEugVGwqISPa79/sZYmnN1JoUj6cY9MDvDhY vJJMnVfXv7FodL1i5dqiGEjy5DlZhQK/fl/zRqc6SAibpocNy/b6siORFRQxT5HE FdfZhXT/4mg4qQhCny6FO3mJ2RaE1gNed99vqIeHNv+vEml4m+L8o= 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=1.1 required=5.0 tests=AWL,BAYES_50,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_DNSWL_LOW autolearn=no version=3.3.2 spammy=1980, Hx-spam-relays-external:shaw.ca, H*r:shaw.ca, disappeared X-HELO: smtp-out-no.shaw.ca X-Authority-Analysis: v=2.2 cv=Rv21FGuK c=1 sm=1 tr=0 a=WqCeCkldcEjBO3QZneQsCg==:117 a=WqCeCkldcEjBO3QZneQsCg==:17 a=IkcTkHD0fZMA:10 a=w5aJ8kaLLAry8Qfnm_kA:9 a=QEXdDO2ut3YA:10 Subject: Re: /bin/ gets deleted on error References: <58EFB88A DOT 5090807 AT tlinx DOT org> To: cygwin AT cygwin DOT com From: Brian Inglis Reply-To: Brian DOT Inglis AT SystematicSw DOT ab DOT ca Message-ID: Date: Thu, 13 Apr 2017 12:43:29 -0600 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-CMAE-Envelope: MS4wfC3ft7X/d9+0bGwX9nxgMtMIlpvz/h6c4O2DXsXmrzSq7nsea2ULlHqKzyQmM7HUSEcO6mmDKIasyobiHCfcrgJYTk+1Im+t/jWJ58MrohRv8FJszZ7V hADpHogvp3QxvRvDxBmVrwuIfGY+GHX6jVGqincyVlRvvcKDky8ASTpYKT6gRF9Ybc7ljm8CiL1xjA== X-IsSubscribed: yes On 2017-04-13 12:01, Dan Kegel wrote: >>> For the second time this week my /bin/ folder gets obliterated on an >>> error during normal usage. It is equivalent of doing the infamous "rm >>> -rf /bin" . > > What were you doing immediately before the directory disappeared? > > I have only had things like this happen from user error, > e.g. scripting mistakes. > > (The first time I saw somebody rm -rf / was in 1980 :-) ) BTDT a few times! Easy to do with a typo in a script variable name e.g. rm -fR $fopdir/ or running a script with a typo that leaves a variable undefined; defensive coding is your friend to avoid disasters: if [ -n "$foodir" ] && [ -d $foodir/ ]; then /bin/rm -fR -- $foodir || exit else echo "Can't find directory '$foodir'" exit 2 fi -- Take care. Thanks, Brian Inglis, Calgary, Alberta, Canada -- 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