Re: svn commit: r284912 - head/usr.bin/units

2015-06-29 Thread Julio Merino

 On Jun 28, 2015, at 15:05 , Garrett Cooper yaneurab...@gmail.com wrote:
 
 
 On Jun 28, 2015, at 09:43, Julio Merino j...@freebsd.org wrote:
 
 Author: jmmv
 Date: Sun Jun 28 16:43:07 2015
 New Revision: 284912
 URL: https://svnweb.freebsd.org/changeset/base/284912
 
 Log:
 Only initialize libedit when necessary
 
 The code path to support units conversions from the command line
 need not initialize neither libedit nor the history.  Therefore, only do
 that when in interactive mode.
 
 This hides the issue reported in PR bin/201167 whereby running commands
 of the form 'echo $(units ft in)' would corrupt the terminal.  The real
 issue causing the corruption most likely still remains somewhere.
 
 PR:bin/201167
 Differential Revision:D2935
 Reviewed by:eadler
 
 Jenkins has been so messed up recently with timeouts and the like that it's 
 hard to tell where things went south..
 
 Can you please add your TERM and locale variables to the PR? I suspect that 
 it might be a related issue..

Details added, but I don’t think they make a difference.  Could reproduce the 
above under multiple combinations.
___
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-unsubscr...@freebsd.org

svn commit: r284912 - head/usr.bin/units

2015-06-28 Thread Julio Merino
Author: jmmv
Date: Sun Jun 28 16:43:07 2015
New Revision: 284912
URL: https://svnweb.freebsd.org/changeset/base/284912

Log:
  Only initialize libedit when necessary
  
  The code path to support units conversions from the command line
  need not initialize neither libedit nor the history.  Therefore, only do
  that when in interactive mode.
  
  This hides the issue reported in PR bin/201167 whereby running commands
  of the form 'echo $(units ft in)' would corrupt the terminal.  The real
  issue causing the corruption most likely still remains somewhere.
  
  PR:   bin/201167
  Differential Revision:D2935
  Reviewed by:  eadler

Modified:
  head/usr.bin/units/units.c

Modified: head/usr.bin/units/units.c
==
--- head/usr.bin/units/units.c  Sun Jun 28 12:52:28 2015(r284911)
+++ head/usr.bin/units/units.c  Sun Jun 28 16:43:07 2015(r284912)
@@ -802,17 +802,6 @@ main(int argc, char **argv)
if (!readfile)
readunits(NULL);
 
-   inhistory = history_init();
-   el = el_init(argv[0], stdin, stdout, stderr);
-   el_set(el, EL_PROMPT, prompt);
-   el_set(el, EL_EDITOR, emacs);
-   el_set(el, EL_SIGNAL, 1);
-   el_set(el, EL_HIST, history, inhistory);
-   el_source(el, NULL);
-   history(inhistory, ev, H_SETSIZE, 800);
-   if (inhistory == 0)
-   err(1, Could not initialize history);
-
if (cap_enter()  0  errno != ENOSYS)
err(1, unable to enter capability mode);
 
@@ -828,6 +817,17 @@ main(int argc, char **argv)
showanswer(have, want);
}
else {
+   inhistory = history_init();
+   el = el_init(argv[0], stdin, stdout, stderr);
+   el_set(el, EL_PROMPT, prompt);
+   el_set(el, EL_EDITOR, emacs);
+   el_set(el, EL_SIGNAL, 1);
+   el_set(el, EL_HIST, history, inhistory);
+   el_source(el, NULL);
+   history(inhistory, ev, H_SETSIZE, 800);
+   if (inhistory == 0)
+   err(1, Could not initialize history);
+
if (!quiet)
printf(%d units, %d prefixes\n, unitcount,
prefixcount);
@@ -858,9 +858,10 @@ main(int argc, char **argv)
completereduce(want));
showanswer(have, want);
}
+
+   history_end(inhistory);
+   el_end(el);
}
 
-   history_end(inhistory);
-   el_end(el);
return (0);
 }
___
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-unsubscr...@freebsd.org


Re: svn commit: r284912 - head/usr.bin/units

2015-06-28 Thread Garrett Cooper

 On Jun 28, 2015, at 09:43, Julio Merino j...@freebsd.org wrote:
 
 Author: jmmv
 Date: Sun Jun 28 16:43:07 2015
 New Revision: 284912
 URL: https://svnweb.freebsd.org/changeset/base/284912
 
 Log:
  Only initialize libedit when necessary
 
  The code path to support units conversions from the command line
  need not initialize neither libedit nor the history.  Therefore, only do
  that when in interactive mode.
 
  This hides the issue reported in PR bin/201167 whereby running commands
  of the form 'echo $(units ft in)' would corrupt the terminal.  The real
  issue causing the corruption most likely still remains somewhere.
 
  PR:bin/201167
  Differential Revision:D2935
  Reviewed by:eadler

Jenkins has been so messed up recently with timeouts and the like that it's 
hard to tell where things went south..

Can you please add your TERM and locale variables to the PR? I suspect that it 
might be a related issue..
___
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-unsubscr...@freebsd.org