Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: PATCH: Fix leak during Y shortcircuit glob qualifier



On Sep 24,  5:38am, Mikael Magnusson wrote:
}
} % : ./*(-.Y1N); ls -l /proc/$$/fd
} 
} was my test case, so not much would happen to $PWD in that particular
} case. I tried */*/*(-.Y5N) instead now, and nothing untoward seemed to
} happen then either (without and with my patch, so no weird pwd
} changing or errors about double frees, respectively).

Glancing at scanner() in glob.c and lchdir() in utils.c, it appears that
the working directory would only be changed if the full path to the target
directory is VERY long, i.e., does not fit in a PATH_MAX buffer.  So it
probably is necessary to restore, but also probably really difficult to
construct an example actually goes through that code path.



Messages sorted by: Reverse Date, Date, Thread, Author