tmpfiles.d and spaces in filenames

Corinna Vinschen vinschen at redhat.com
Wed Jun 1 18:27:36 UTC 2011


On Jun  1 09:59, JD wrote:
> On 06/01/11 09:37, Ian Malone wrote:
> > On 1 June 2011 16:11, Corinna Vinschen<vinschen at redhat.com>  wrote:
> >> Hi,
> >>
> >> How can I specify filenames with spaces in tmpfiles.d configuration
> >> files?  There's no hint in `man tmfiles.d'.  I tried
> >>
> >> - fstab style:      d /foo\040bar 0755 root root
> >> [...]
> >> So, do I have to take it that tmpfiles.d doesn't grok spaces in
> >> filenames at all?
> >>
> >> Please note, I'm not asking for the obvious answer "don't do this" and
> >> I'm also not asking for the counter question "why do you need this?"
> >>
> > [...]
> > So the long answer is you either have to modify tmpfiles.c to deal
> > with this or write a similar daemon to do it.

I guess this should be converted into a bugzilla entry then.

> Since a space is Unix's and Linux's chosen field separator,

Just because the space is a field separator doesn't mean there are
no ways to define spaces in filenames.

> I think having a space in filenames should be avoided. there

That's not always possible and you can't ask all users to rename their
files.  Filenames like "Expenses May 2011.odt" are just to be expected.
Another example is the default naming of CF or SD media formatted on
certain camera models.  Yet another exmaple are customer request.

> are many situations where spaces in filenames cause problems.
> A simple example:
> 
> for i in *; do
> [ -f $i ] && echo $i is a file
> done

Which is just an example of insufficient quoting.  If this isn't part of
a script which exactly knows that no filename will have spaces, it's
broken by design.  Spaces in filenames are perfectly valid and system
tools which may come into contact with user-defined content should be
able to deal with them.

The fact that even /etc/fstab (rather, mount(8)) deals with spaces in
mount points shows that there is a need and a way to handle them.

Having said that, using the space definition in /etc/fstab shouldn't
be too hard to do in tmpfiles.d as well.


Corinna


More information about the users mailing list