Bug 54683 - sh(1) redundant history
Summary: sh(1) redundant history
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 4.8-RELEASE
Hardware: Any Any
: Normal Affects Only Me
Assignee: Jilles Tjoelker
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-07-21 02:20 UTC by abc
Modified: 2010-09-01 22:54 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description abc 2003-07-21 02:20:10 UTC
sh history stores consecutive redundant lines for no reason.

Fix: 

don't enter command into history if equal to last command.
                it is a minor irritant to scroll back thru sh history stepping
                past multiple consecutive and redundant lines, and there is no
                good reason for storing multiple consecutive/redundant lines.
How-To-Repeat: enter the same command many times at a sh prompt.
Comment 1 dfilter service freebsd_committer freebsd_triage 2010-08-01 17:38:00 UTC
Author: jilles
Date: Sun Aug  1 16:37:51 2010
New Revision: 210736
URL: http://svn.freebsd.org/changeset/base/210736

Log:
  sh: Do not enter consecutive duplicates into the history.
  
  This simply sets a flag in libedit. It has a shortcoming in that it does not
  apply to multi-line commands.
  
  Note that a configuration option for this is not going to happen, but always
  having this seems better than not having it. NetBSD has done the same.
  
  PR:		bin/54683
  Obtained from:	NetBSD
  MFC after:	1 month

Modified:
  head/bin/sh/histedit.c

Modified: head/bin/sh/histedit.c
==============================================================================
--- head/bin/sh/histedit.c	Sun Aug  1 15:55:49 2010	(r210735)
+++ head/bin/sh/histedit.c	Sun Aug  1 16:37:51 2010	(r210736)
@@ -168,6 +168,7 @@ sethistsize(hs)
 		   (histsize = atoi(hs)) < 0)
 			histsize = 100;
 		history(hist, &he, H_SETSIZE, histsize);
+		history(hist, &he, H_SETUNIQUE, 1);
 	}
 }
 
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
Comment 2 Jilles Tjoelker freebsd_committer freebsd_triage 2010-08-01 17:42:43 UTC
State Changed
From-To: open->patched

Fixed in 9-CURRENT. 


Comment 3 Jilles Tjoelker freebsd_committer freebsd_triage 2010-08-01 17:42:43 UTC
Responsible Changed
From-To: freebsd-bugs->jilles

Take.
Comment 4 dfilter service freebsd_committer freebsd_triage 2010-09-01 20:49:37 UTC
Author: jilles
Date: Wed Sep  1 19:49:24 2010
New Revision: 212111
URL: http://svn.freebsd.org/changeset/base/212111

Log:
  MFC r210736: sh: Do not enter consecutive duplicates into the history.
  
  This simply sets a flag in libedit. It has a shortcoming in that it does not
  apply to multi-line commands.
  
  Note that a configuration option for this is not going to happen, but always
  having this seems better than not having it. NetBSD has done the same.
  
  PR:		bin/54683
  Obtained from:	NetBSD

Modified:
  stable/8/bin/sh/histedit.c
Directory Properties:
  stable/8/bin/sh/   (props changed)

Modified: stable/8/bin/sh/histedit.c
==============================================================================
--- stable/8/bin/sh/histedit.c	Wed Sep  1 19:36:06 2010	(r212110)
+++ stable/8/bin/sh/histedit.c	Wed Sep  1 19:49:24 2010	(r212111)
@@ -157,6 +157,7 @@ sethistsize(hs)
 		   (histsize = atoi(hs)) < 0)
 			histsize = 100;
 		history(hist, &he, H_SETSIZE, histsize);
+		history(hist, &he, H_SETUNIQUE, 1);
 	}
 }
 
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
Comment 5 Jilles Tjoelker freebsd_committer freebsd_triage 2010-09-01 22:54:48 UTC
State Changed
From-To: patched->closed

Added in 8.x/9.x, no MFC to 7.x planned.