public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Adam Dinwoodie <adam@dinwoodie.org>
To: cygwin@cygwin.com
Subject: Re: minor error in skel/.bashrc
Date: Sat, 5 Mar 2022 13:25:22 +0000	[thread overview]
Message-ID: <20220305132522.uq4yfrvmnrn4szvf@lucy.dinwoodie.org> (raw)
In-Reply-To: <CABWfEdmHy4NtqX5MmAuWsRC0+NqgeF8W6Et9dJNc-TuWjHmcZA@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 533 bytes --]

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

[-- Attachment #2: 0001-Correct-HISTCONTROL-in-.bashrc.patch --]
[-- Type: text/x-diff, Size: 1276 bytes --]

From 90bd8c6b46a467b26972f5ecac5c2f05ed321f49 Mon Sep 17 00:00:00 2001
From: Adam Dinwoodie <adam@dinwoodie.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


  reply	other threads:[~2022-03-05 13:25 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-05  6:26 lvm
2022-03-05 13:25 ` Adam Dinwoodie [this message]
2022-03-08  8:28   ` Andrey Repin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220305132522.uq4yfrvmnrn4szvf@lucy.dinwoodie.org \
    --to=adam@dinwoodie.org \
    --cc=cygwin@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).