ridiculous_fish wrote:
> Thanks for reporting this! Here's the relevant snippet:
> 
>         wc_str = wc_end?wcsndup(wc, wc_end-wc):wcsdup(wc);
>         if ((!new_dir) || (!wc_str))
>         {
>             DIE_MEM();
>         }
> 
> I'm afraid I don't know what could cause this, except for legitimately 
running out of memory. Do you think that's what's going on? For example, 
does top report large memory usage?

Not at all, it is below 0.2% for both running fish processes (no idea why 
running fish causes two fish processes to start...).

I have taken a look with a debugger and it is not wc_str but new_dir that is 
null. Now, directly above the block you quoted there is this code:

        /*
          The maximum length of a file element
        */
        long ln=MAX_FILE_LENGTH;
        char * narrow_dir_string = wcs2str(dir_string);

        /*
          In recursive mode, we look through the directory twice. If
          so, this rewind is needed.
        */
        rewinddir(dir);

        if (narrow_dir_string)
        {
            /*
               Find out how long the filename can be in a worst case
               scenario
            */
            ln = pathconf(narrow_dir_string, _PC_NAME_MAX);

            /*
              If not specified, use som large number as fallback
            */
            if (ln < 0)
                ln = MAX_FILE_LENGTH;
            free(narrow_dir_string);
        }
        fprintf(stderr, "malloc_arg=%lu\n", 
sizeof(wchar_t)*(base_len+ln+2));
        new_dir= (wchar_t *)malloc(sizeof(wchar_t)*(base_len+ln+2));


where I added the printf before the malloc call. This is what I get 
immediately before the crash:

ben@sarun ~> cd ctl/toonarrow_dir_string=0x7fd5140072a0
malloc_arg=1028
malloc_arg=8589934612

So you try to allocate a ridiculous amount of memory which fails of course.

This is probably due to using MAX_FILE_LENGTH as the default for 'ln'; I 
guess you want something a bit saner here... ;-)

Cheers
-- 
Ben Franksen
()  ascii ribbon campaign - against html e-mail 
/\  www.asciiribbon.org   - against proprietary attachm€nts


------------------------------------------------------------------------------
Precog is a next-generation analytics platform capable of advanced
analytics on semi-structured data. The platform includes APIs for building
apps and a phenomenal toolset for data science. Developers can use
our toolset for easy data analysis & visualization. Get a free account!
http://www2.precog.com/precogplatform/slashdotnewsletter
_______________________________________________
Fish-users mailing list
Fish-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/fish-users

Reply via email to