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

Re: [PATCH] Use /dev/.oldtmp instead of /oldtmp when moving around initrd /tmp



On Tue, 2011-02-22 at 07:48 +0100, Ales Kozumplik wrote:
> Hi Will,
> 
> On 02/21/2011 08:58 PM, Will Woods wrote:
> >       /* we want our /tmp to be tmpfs, but we also want to let people hack
> >        * their initrds to add things like a ks.cfg, so this has to be a little
> >        * tricky */
> > -    rename("/tmp", "/oldtmp");
> > +    copyDirectory("/tmp", "/dev/.oldtmp", copyErrorFn, copyErrorFn);
> >       mkdir("/tmp", 0755);
> 
> Shouldn't there be step that recursively removes /tmp after you've 
> copied it, because this way the files that were in /tmp originally will 
> stay there and the mkdir below fails (or is it what you intended)?

Oh shoot, you're right. Probably there needs to be an unlink("/tmp")[1]
before the mkdir()...

...except that wouldn't make sense if / was readonly, which is part of
the goal of this patch. Hmm.

> Or we can drop this altogether and tell people who want to tweak the 
> initrds they need to put their stuff in /cantbelieveitsnottmp.

Well, one of the things my in-progress squashfs patch does is put the
extra contents of initramfs at /initramfs (which is also a tmpfs). So in
that case we could just do:

copyDirectory("/initramfs/tmp", "/tmp", copyErrorFn, copyErrorFn);
unlink("/initramfs/tmp");

*after* mount tmpfs at /tmp. This seems much cleaner to me.

So: ignore this patch for now, and we'll revisit if/when I actually post
the squashfs patchset.

-w

[1] we're already depending on the OS-specific implementation of unlink
allowing unlink("directory"), so I don't feel bad about using that here.


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