[asterisk-bugs] [Asterisk 0016858]: asterisk command history loads as unusable garbage

Asterisk Bug Tracker noreply at bugs.digium.com
Thu Mar 4 21:14:29 CST 2010


The following issue has been CLOSED 
====================================================================== 
https://issues.asterisk.org/view.php?id=16858 
====================================================================== 
Reported By:                jw-asterisk
Assigned To:                
====================================================================== 
Project:                    Asterisk
Issue ID:                   16858
Category:                   Core/General
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     closed
Asterisk Version:           1.6.2.2 
JIRA:                       SWP-932 
Regression:                 No 
Reviewboard Link:            
SVN Branch (only for SVN checkouts, not tarball releases): N/A 
SVN Revision (number only!):  
Request Review:              
Resolution:                 open
Fixed in Version:           
====================================================================== 
Date Submitted:             2010-02-17 21:19 CST
Last Modified:              2010-03-04 21:14 CST
====================================================================== 
Summary:                    asterisk command history loads as unusable garbage
Description: 
When using asterisk interactively with command interface a history file is
created (~/.asterisk_history). Lines written to the history file are
white-space encoded (in ast_el_write_history:history:case
H_SAVE:history_save:strvis).

But when the history file is loaded it reverse (strunvis) is not
performed.  Therefore the history becomes unusable garbage.
====================================================================== 

---------------------------------------------------------------------- 
 (0118996) seanbright (manager) - 2010-03-04 21:14
 https://issues.asterisk.org/view.php?id=16858#c118996 
---------------------------------------------------------------------- 
Fair enough, thank you for your report.

For record keeping purposes:
The reporter indicates in his report that strvis() is being called on
entries that are being written to the history file.  While this is true,
the result of strvis() is being completely ignored - looking at the source
of main/editline/history.c in asterisk 1.6.2.5 (one of the versions of
asterisk the reporter mentions as being affected) reveals the following
code on lines 666 and 667 in history_save (the location mentioned by the
reporter):

666    (void) strvis(ptr, ev.str, VIS_WHITE);
667    (void) fprintf(fp, "%s\n", ev.str);

(You can see this here:
http://svnview.digium.com/svn/asterisk/tags/1.6.2.5/main/editline/history.c?view=markup)

You'll notice that the first argument to strvis - ptr - is where the
whitespace encoded string will be written.  ev.str is the source string. 
You'll also notice, unfortunately, that the fprintf on the next line uses
ev.str as well instead of the whitespace encoded string in ptr.  This means
that the string being written to the history file is not whitespace encoded
and will be the raw history command that we expect when reading the history
entries back in.  So while there maay be an underlying bug in editline, we
are not affected by it because of the way we read the history entries back
out of the file.  Of note is that this has been resolved upstream for quite
some time:

http://cvsweb.netbsd.org/bsdweb.cgi/src/lib/libedit/history.c#rev1.20

We may want to upgrade at some point, but this is not critical since we
have no open or valid reports relating to it.

All of this, coupled with the fact that no one else is able to reproduce
this leads me to believe it is a problem specific to the reporter.

Closing. 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2010-03-04 21:14 seanbright     Note Added: 0118996                          
2010-03-04 21:14 seanbright     Status                   acknowledged => closed
======================================================================




More information about the asterisk-bugs mailing list