delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2022/03/05/08:26:03

X-Recipient: archive-cygwin AT delorie DOT com
X-Original-To: cygwin AT cygwin DOT com
Delivered-To: cygwin AT cygwin DOT com
DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 03D843858D1E
Authentication-Results: sourceware.org;
dmarc=none (p=none dis=none) header.from=dinwoodie.org
Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=dinwoodie.org
Date: Sat, 5 Mar 2022 13:25:22 +0000
From: Adam Dinwoodie <adam AT dinwoodie DOT org>
To: cygwin AT cygwin DOT com
Subject: Re: minor error in skel/.bashrc
Message-ID: <20220305132522.uq4yfrvmnrn4szvf@lucy.dinwoodie.org>
References: <CABWfEdmHy4NtqX5MmAuWsRC0+NqgeF8W6Et9dJNc-TuWjHmcZA AT mail DOT gmail DOT com>
MIME-Version: 1.0
In-Reply-To: <CABWfEdmHy4NtqX5MmAuWsRC0+NqgeF8W6Et9dJNc-TuWjHmcZA@mail.gmail.com>
X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00, GIT_PATCH_0,
KAM_DMARC_STATUS, PDS_RDNS_DYNAMIC_FP, RDNS_DYNAMIC, SPF_HELO_PASS, SPF_PASS,
TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4
X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on
server2.sourceware.org
X-BeenThere: cygwin AT cygwin DOT com
X-Mailman-Version: 2.1.29
List-Id: General Cygwin discussions and problem reports <cygwin.cygwin.com>
List-Unsubscribe: <https://cygwin.com/mailman/options/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=unsubscribe>
List-Archive: <https://cygwin.com/pipermail/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-request AT cygwin DOT com?subject=help>
List-Subscribe: <https://cygwin.com/mailman/listinfo/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=subscribe>
Reply-To: cygwin AT cygwin DOT com
Errors-To: cygwin-bounces+archive-cygwin=delorie DOT com AT cygwin DOT com
Sender: "Cygwin" <cygwin-bounces+archive-cygwin=delorie DOT com AT cygwin DOT com>

--dcpfph6wzvqlzcv4
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

On Sat, Mar 05, 2022 at 09:26:06AM +0300, lvm wrote:
>  The identical /etc/skel/.bashrc and /etc/defaults/etc/skel/.bashrc contain
> the same line
> 
> # export HISTCONTROL=$HISTCONTROL${HISTCONTROL+,}ignoredups
> 
> But HISTCONTROL values should be colon separated, not comma separated. This
> line is commented out, but if someone like me tries to use it without much
> thinking...

Confirmed.

Achim, I've attached a patch that should fix this, based on the tip of
https://sourceware.org/git/cygwin-apps/base-files.git

HTH

Adam

--dcpfph6wzvqlzcv4
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment;
	filename="0001-Correct-HISTCONTROL-in-.bashrc.patch"

From 90bd8c6b46a467b26972f5ecac5c2f05ed321f49 Mon Sep 17 00:00:00 2001
From: Adam Dinwoodie <adam AT dinwoodie DOT org>
Date: Sat, 5 Mar 2022 13:14:42 +0000
Subject: [PATCH] Correct HISTCONTROL in .bashrc

Per bash.1, HISTCONTROL values should be colon-separated, not
comma-separated, so correct the sample line for adding "ignoredups" to
HISTCONTROL to use the correct separator.

At the same time, use the separator if and only if there is a non-null
value already set in HISTCONTROL.  The previous version of this sample
code would insert the separator if HISTCONTROL were defined as the empty
string, where it'd be exactly as unnecessary as if it weren't defined at
all.
---
 etc/defaults/etc/skel/.bashrc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/etc/defaults/etc/skel/.bashrc b/etc/defaults/etc/skel/.bashrc
index 3a4f59a..b6a48cf 100644
--- a/etc/defaults/etc/skel/.bashrc
+++ b/etc/defaults/etc/skel/.bashrc
@@ -54,7 +54,7 @@
 # History Options
 #
 # Don't put duplicate lines in the history.
-# export HISTCONTROL=$HISTCONTROL${HISTCONTROL+,}ignoredups
+# export HISTCONTROL=$HISTCONTROL${HISTCONTROL:+:}ignoredups
 #
 # Ignore some controlling instructions
 # HISTIGNORE is a colon-delimited list of patterns which should be excluded.
-- 
2.35.1


--dcpfph6wzvqlzcv4
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline


-- 
Problem reports:      https://cygwin.com/problems.html
FAQ:                  https://cygwin.com/faq/
Documentation:        https://cygwin.com/docs.html
Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple

--dcpfph6wzvqlzcv4--

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019