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

[PATCH] Exclude directories from any root filesystem



On Thursday 25 October 2007, Trent W. Buck wrote:
> On Wed, Oct 24, 2007 at 04:35:56PM -0200, Otavio Salvador wrote:
> > Maarten ter Huurne <maarten at treewalker.org> writes:
> > > It treats any whitespace in the exclusion file as a separator, which
> > > means means it's impossible to exclude a file or directory that
> > > contains a space in its name. I don't think any Debian package uses
> > > spaces in file names, so I guess this is not a problem.
> >
> > To work around your problem you can use something like (untested):
> >
> > while read line
> > do
> >         ...
> > done < EXCLUDE
> >
> > It should work fine.
>
> Read() will chomp leading and trailing whitespace on each line.  To
> handle all potential cases of whitespace (you can even have newlines
> in filenames!) you'd probably need to use eval(), or #!/bin/bash or
> perl.

Chomping trailing whitespace might be better than preserving it: otherwise a 
stray space at the end of a line would have the user puzzled why the 
exclude path doesn't match the intended directory.

Using "eval" might help with the handling of spaces, but will open up many 
other potential problems with quotes, backticks and variable substitution. 
Using bash or perl might work, but the resulting code would not fit in well 
with the existing live-helper scripts.

The main reason I was interested in the whitespace in the first place is 
that a naieve implementation on an input line such as "/var/cache/apt /" 
would remove "chroot/var/cache/apt" and "/", which is especially 
problematic if the "rm -rf" would not run in the chroot env...

I don't think any Debian package has files with whitespace in their names, 
so the exact behaviour of the script on whitespace doesn't really matter, 
as long as it does something predictable. So in my opinion both the second 
and the third patch would be OK in this regard.

Is there anything I should change about the patches or could one of them be 
applied in its current form?

Bye,
		Maarten
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
Url : http://lists.alioth.debian.org/pipermail/debian-live-devel/attachments/20071025/675c2ba0/attachment.pgp 


Reply to: