Hi Chris
Do you have a test case to get the alias into this state? eg.
ln -s "" xxx or some such?
It would be nice to be able to make the problem appear and disappear on
demand.
As you point out, the primary problem is that CloneString(*str) returns NULL
if str is "". I think that's the bogus value you are talking about.
By my reading that's handled properly by the patch
http://www.aleph1.co.uk/cgi-bin/viewcvs.cgi/yaffs2/yaffs_guts.c?r1=1.95&r2=1.96
at around 2258.
@@ -2253,11 +2258,12 @@
{
YCHAR *newStr = NULL;
- if (str && *str) {
- newStr = YMALLOC((yaffs_strlen(str) + 1) * sizeof(YCHAR));
- if (newStr)
- yaffs_strcpy(newStr, str);
- }
+ if (!str)
+ str = _Y("");
+
+ newStr = YMALLOC((yaffs_strlen(str) + 1) * sizeof(YCHAR));
+ if (newStr)
+ yaffs_strcpy(newStr, str);
return newStr;
Or am I missing something???
-- CHarles
On Friday 04 December 2009 06:13:39 Chris David wrote:
> Hell Charles,
>
> On Thu, Dec 03, 2009 at 12:00:07PM +0000, Charles Manning wrote:
> > Hi Chris
> >
> > (Sorry about calling you David)
>
> No worries!
>
> > I have just committed a change for the symlink hanging pointer issue you
> > raised. It is a bit more verbose than yours but I think it does the right
> > thing. I shall be testing it more and running Valgrind testing too.
> >
> > http://www.aleph1.co.uk/cgi-bin/viewcvs.cgi/yaffs2/yaffs_guts.c?r1=1.95&r
> >2=1.96
> >
> > -- Charles
>
> I just sent in two patches. I like the shortest one the best.
>
> The above patch does not handle the case where a bogus value makes it
> into a symlink on the NAND flash. Both of the patches I submitted
> handle this case. In other words, if someone's filesystem is has an
> empty alias, like the one I have, mounting will fail. But if one of
> the patches I supplied is used, then the empty alias is ignored, and
> mounting will succeed.
>
> In our case, if mounting fails bacause of a bunk deleted alias, we
> would like to simply upgrade the software, and then the existing
> filesystem mounts and everything is back as it should be.
>
> If the case where a bogus value makes it into a symlink on the NAND
> flash, then the only option is to reformat the YAFFS2 filesystem, and
> this would lose data.
>
> So anyways, my first choice would be for the patch
> yaffs_guts.c?r1=1.95&r2=1.96 to be reversed, and my short one put in
> its place.
>
> My second choice would be for you or I to add the code necessary to
> handle the case where a bogus value makes it into a symlink on the
> NAND flash on top of yaffs_guts.c?r1.96. Please let me know if you
> would like me to code this.
>
> Thanks,
>
> -Chris
>
> _______________________________________________
> yaffs mailing list
> yaffs@lists.aleph1.co.uk
> http://lists.aleph1.co.uk/cgi-bin/mailman/listinfo/yaffs