Re: [PATCH] mc crashes when temporary directory cannot be created



Hi Leonard,

On Wed, 2006-11-29 at 20:59 +0100, Leonard den Ottolander wrote:
> Hello Jindrich,
> 
> On Tue, 2006-11-28 at 13:21 +0100, Jindrich Novy wrote:
> > IMO only removal of the fallback will prevent
> > the infinite loop in any case as it shouldn't call mc_mkstemps() at all.
> 
> That cure seems worse than the disease. Isn't the real problem the fact
> that mc_mkstemps() blindly concats tmpdir to the prefix instead of
> testing if mc_tmpdir() succeeded? Why not abort mc_mkstemps() if
> mc_tmpdir() returns "/dev/null/"?

I'm not quite sure I got the point. We may want to prevent infinite
loops caused by the subsequent function calls, such design is dangerous
by design. The fallback will never work without adding hacks to
mc_mktemps()/mc_tmpdir() to check for special arguments what doesn't
look too nice to me.

Considering that insufficient space in TMPDIR is very rare, I would vote
for removing the dangerous fallback completely what is done in the
previous patch. mc works fine after that even without the fallback.

> What about the attached (untested) patch?

$ TMPDIR=/dev/null mc
Cannot create temporary directory /dev/null/mc-jnovy: Not a directory
(20)
Cannot create temporary directory /dev/null/mc-jnovy: Not a directory
(20)

<snip>

Cannot create temporary directory /dev/null/mc-jnovy: Not a directory
(20)
Cannot create temporary directory /dev/null/mc-jnovy: Not a directory
(20)
Segmentation fault


> By the way, could you please add the -p option to your diffs?

Sure.

Jindrich




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]