Bug#260446: bug fixed and acknowledgement required
Dear Daniel,
Kindly checkout this code modification in apt.diff file attached with font color green. After implementing new logic and handling outgoing qoutation marks with escape character, the mail system on shell is working fine. I believe that bug is fixed now and running efficiently on my system. Please acknowledge our effort.
Regards
Qaiser Abbas
--- /tmp/apt-0.6.25/apt-pkg/contrib/configuration.cc 2004-05-08 18:10:10.000000000 -0400
+++ apt-pkg/contrib/configuration.cc 2008-05-12 13:32:31.000000000 -0400
@@ -397,6 +397,26 @@
return Exists(Name);
}
+
+static string escape(const string &input)
+{
+ string::size_type start=0,end=input.find_first_of("\\\"");
+ string rval;
+
+ while(end!=string::npos)
+ {
+ rval += string(input, start, end-start);
+ rval += '\\';
+ finalstr += intput[end];
+
+ begin = end+1;
+ end=input.find_first_of("\\\"", start);
+ }
+
+ finalstr += string(input, start);
+
+ return rval;
+}
/*}}}*/
// Configuration::Dump - Dump the config /*{{{*/
// ---------------------------------------------------------------------
@@ -408,7 +428,7 @@
const Configuration::Item *Top = Tree(0);
for (; Top != 0;)
{
- str << Top->FullTag() << " \"" << Top->Value << "\";" << endl;
- str << Top->FullTag() << " \"" << escape(Top->Value) << "\";" << endl;
+ str << Top->FullTag() << " \\\"" << escape(Top->Value) << "\\\";" << endl;
//or the below one
+ str << Top->FullTag() << escape(Top->Value) <<";" << endl;
if (Top->Child != 0)
{
@@ -491,8 +511,21 @@
// Discard single line comments
bool InQuote = false;
+ bool BackslashEscape = false;
for (char *I = Buffer; *I != 0; I++)
{
+ if(BackslashEscape == true)
+ {
+ BackslashEscape=false;
+ continue;
+ }
+
+ if (*I == '\\')
+ {
+ BackslashEscape = true;
+ continue;
+ }
+
if (*I == '"')
InQuote = !InQuote;
if (InQuote == true)
@@ -507,8 +540,21 @@
// Look for multi line comments
InQuote = false;
+ BackslashEscape = false;
for (char *I = Buffer; *I != 0; I++)
{
+ if (BackslashEscape == true)
+ {
+ BackslashEscape = false;
+ continue;
+ }
+
+ if (*I == '\\')
+ {
+ BackslashEscape = true;
+ continue;
+ }
+
if (*I == '"')
InQuote = !InQuote;
if (InQuote == true)
@@ -541,8 +587,24 @@
// We now have a valid line fragment
InQuote = false;
+ BackslashEscape = false;
for (char *I = Buffer; *I != 0;)
{
+ if(BackslashEscape == true)
+ {
+ // Put this character into the buffer unconditionally
+ BackslashEscape=false;
+ ++I;
+ continue;
+ }
+
+ if(*I == '\\')
+ {
+ BackslashEscape = true;
+ ++I;
+ continue;
+ }
+
if (*I == '"')
InQuote = !InQuote;
--- /tmp/apt-0.6.25/apt-pkg/contrib/strutl.cc 2003-07-18 10:15:11.000000000 -0400
+++ apt-pkg/contrib/strutl.cc 2004-07-20 13:33:24.000000000 -0400
@@ -100,6 +100,8 @@
understand [] brackets.*/
bool ParseQuoteWord(const char *&String,string &Res)
{
+ cout << String << endl;
+
// Skip leading whitespace
const char *C = String;
for (;*C != 0 && *C == ' '; C++);
@@ -176,7 +178,12 @@
if (*C == '"')
{
for (C++; *C != 0 && *C != '"'; C++)
+ {
+ if(*C=='\\' && *(C+1)!=0)
+ ++C;
+
*Buf++ = *C;
+ }
if (*C == 0)
return false;
Reply to: