RPM Community Forums

Mailing List Message of <rpm-users>

Re: Spaces in filenames in a spec file???

From: Michael Lasevich <misdirected@lasevich.net>
Date: Mon 13 Jul 2009 - 01:44:51 CEST
Message-ID: <4A5A7573.4090309@lasevich.net>
Jeff Johnson wrote:
> On Jul 12, 2009, at 6:34 PM, Michael Lasevich wrote:
>> Jeff Johnson wrote:
>>> On Jul 10, 2009, at 7:07 PM, Michael Lasevich wrote:
>>>> Weirdly enough double quotes do work, but ONLY on files with spaces 
>>>> in it. Any other file in double quotes causes an error and as I was 
>>>> generating the spec file list from a script, I ended up putting 
>>>> extra code to quote only files with spaces in them. Some odd 
>>>> parsing that is, but as long as I know what it is, it works.
>>> Hmm, odd that quotes don't work for all file paths ... checking ...
>>> worksforme. So there's some other factor than quoted paths.
>> I will come up with some examples and post the results. Again, this 
>> may be something that was fixed in rpm5 so I could be wasting your 
>> time. I will post what I find.
> AFAIK all rpm behavior wrto spaces within paths is identical for years.
> But if you post a spec file with a reproducer I'll sort the issue for 
> you.
Ok, my root has these files and directories (all empty):

-rw-r--r-- 1 root root    0 Jul 12 19:18 File With Spaces
drwxr-xr-x 2 root root 4096 Jul 12 19:12 dir With Spaces
drwxr-xr-x 2 root root 4096 Jul 12 19:12 dirWithoutSpaces
-rw-r--r-- 1 root root    0 Jul 12 19:18 fileWithoutSpaces

Genrated spec file is:
Name: vj_space_tester
Version: 1.2
Release: 090712_1925
License: None
Group: None
BuildRoot: /data/yum/factory/space_tester/root
AutoReqProv: no
Summary: No Summary
BuildArch: noarch
Requires: vj_base

# Finished header


# Description done
%defattr (755,root,root)
%dir ""
%attr(644,root,root) "/fileWithoutSpaces"
%dir "/dirWithoutSpaces"
%attr(644,root,root) "/File With Spaces"
%dir "/dir With Spaces"

Relevant error output is:
Processing files: vj_space_tester-1.2-090712_1925
error: File must begin with "/":
Checking for unpackaged file(s): /usr/lib/rpm/check-files 

RPM build errors:
    File must begin with "/":

Again, I already added code to only put in quotes the files with spaces 
- which works fine for me, but I figure this is odd behavior and may be 
worth looking at from developer point of view :-)


> OK. There's two approaches, hacking in python is easiest, but a macro
> to carry persistent relocations can done if absolutely necessary.
> The easy hack is to populate your relocations in the last arg
> of rpmtsAddInstallElement(), passed to python/rpmts-py.c through
> yum directly. All that's needed is to convert a python tuple
> of [ "/old", "/new" ] relocations into a rpmRelocation array.
> The more subtle hack is to do the same with macro expansions.
> All that is hard with macros instead of python tuples is that
> macros are strings, so one has to parse out boundaries and
> invent syntax, etc etc. The code to parse dependency whiteout
> into an array of pairs in lib/depends.c can be modified to
> do what you want.
> But changing rpm-python with a keyword arument to add relocations,
> and then figgering a way to pass the keyword arg in yum, is likely
> much more maintainable.
> If none of the above makes sense, holler, and I'll whack out a patch.
> Alas, neither implementation can be put into RPM because of compatibility
> and interoperability issues.

Ok, Thanks.  I am going to need to wrap my head around that, so give me 
a day or so to digest it. Unless I am misunderstanding, either route 
requires changes to RPM code base, which is a big change to what I am 
doing as I am not currently shipping rpm, but instead relying on 
whatever is already on the system. Shipping RPM will make things 
significantly more complicated as I will need to compile it for every 
possible system. In some ways it may be easier to write something to 
replace YUM that will just handle dependencies and downloading but use 
an external tool to do installations. Anyway, I got to think about it.

Thanks so much.

Received on Mon Jul 13 01:45:11 2009
Driven by Jeff Johnson and the RPM project team.
Hosted by OpenPKG and Ralf S. Engelschall.
Powered by FreeBSD and OpenPKG.