Bug#2372: MH's folder stack is broken
Package: mh
Version: 6.8.3-2
The folder stacking feature in MH's folder command is broken. Folders
can be pushed onto the stack with the "-push" option, but they cannot
be subsequently popped off of the stack. Here is an example:
$ folder -list
inbox
$ folder -push +debian
debian inbox
$ folder -pop
folder: unable to find folder /home/username/Mail/ _: No such file or directory
$ folder -push
folder: unable to find folder /home/username/Mail/ _: No such file or directory
$ folder -list
debian inbox
This bug is caused by premature deallocation of the memory holding the
name of the folder at the top of the stack. It can be fixed by
postponing the erroneous calls to "free()" until after the name has
been used to change folders.
Here is how I fixed the problem on my machine:
------------------------------------------------------------------------
--- uip/folder.c.orig Tue Nov 30 23:01:36 1993
+++ uip/folder.c Mon Feb 19 17:59:00 1996
@@ -257,14 +257,15 @@
adios (NULLCP, "no other folder");
for (cp = getcpy (m_getfolder ()); *ap; ap++)
cp = add (*ap, add (" ", cp));
- free (dp);
m_replace (stack, cp);
}
- else
+ else {
m_replace (stack,
(cp = m_find (stack))
? concat (m_getfolder (), " ", cp, NULLCP)
: getcpy (m_getfolder ()));
+ dp = NULL;
+ }
}
if (popsw) {
if (argfolder)
@@ -275,7 +276,6 @@
adios (NULLCP, "folder stack empty");
for (cp = NULL; *ap; ap++)
cp = cp ? add (*ap, add (" ", cp)) : getcpy (*ap);
- free (dp);
if (cp)
m_replace (stack, cp);
else
@@ -286,6 +286,7 @@
adios (cp, "unable to find folder");
m_replace (pfolder, argfolder);
m_update ();
+ free (dp);
argfolder = NULL;
}
if (listsw) {
------------------------------------------------------------------------
--
Brian Mays
Reply to: