Re: tmpfiles.d and spaces in filenames

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

 



On 06/01/11 09:37, Ian Malone wrote:
> On 1 June 2011 16:11, Corinna Vinschen<vinschen@xxxxxxxxxx>  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
>> - web style:        d /foo%20bar 0755 root root
>> - quoted style 1:   d "/foo bar" 0755 root root
>> - quoted style 2:   d '/foo bar' 0755 root root
>>
>> This results in two directories
>>
>>   /foo\040bar
>>   /foo%20bar
>>
>> and two error messages:
>>
>>   Path '"/foo' not absolute.
>>   Path ''/foo' not absolute.
>>
>> 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?"
>>
> As usual both of these might push in the direction of another way to
> solve the problem. From checking the documentation it seems packages
> are expected to define patterns here for their tmpfiles which they
> should have control over. Which I guess is not the situation you're
> dealing with. Looking at it I think the short answer is you can't as
> tmpfiles.c is just using sscanf to parse this line:
> http://cgit.freedesktop.org/systemd/tree/src/tmpfiles.c
> Line 670:
>   if (sscanf(buffer,
>                     "%c "
>                     "%ms "
>                     "%ms "
>                     "%ms "
>                     "%ms "
>                     "%ms",
>                     &i->type,
>                     &i->path,
>                     &mode,
>                     &user,
>                     &group,
>                     &age)<  2) {
>                  log_error("[%s:%u] Syntax error.", fname, line);
>                  r = -EIO;
>                  goto finish;
>          }
>
> So the long answer is you either have to modify tmpfiles.c to deal
> with this or write a similar daemon to do it.
>
Since a space is Unix's and Linux's chosen field separator,
I think having a space in filenames should be avoided. there
are many situations where spaces in filenames cause problems.
A simple example:

for i in *; do
[ -f $i ] && echo $i is a file
done

you will see that the file with spaces in it's name
will not be recognized as a file because each
space-separated member of that file name
becomes a separate argument
when * is expanded by the shell.
There are probably other more serious
problems posed by spaces in filenames.

-- 
users mailing list
users@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines

[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [EPEL Devel]     [Fedora Magazine]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Desktop]     [Fedora Fonts]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Fedora Sparc]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux