Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to build an RPM, but the source file from the vendor has a space in the filename, and there doesn't seem to be any good way to escape the filename so that it builds.

I've tried putting a \ in front of the spaces. I've tried replacing them with %20. I tried +. I've tried putting "s around it, I've tried ' around it.

For now, I'm working around it by renaming the source file from the vendor to not have spaces, but I really prefer to leave original vendor source filenames intact whenever possible.

With no escaping or quoting, I get:

+ unzip .../Foo
unzip:  cannot find or open .../Foo, .../ or .../Foo.ZIP.

With \, the unzip works, but then:

error: Bad file: .../Foo\ No such file or directory

Here is a fully functional test.spec file (I did zip "Foo" test.spec to get a sample zipfile):

Summary: Test
Name: test
Version: 1
Release: 1
License: Whatever
Source1: Foo

Just a test of escaping stuff...

%{__install} -d -m0755 %{buildroot}/foo
cd %{buildroot}/foo
unzip %SOURCE1

%{__rm} -rf %{buildroot}


* Wed May 8 2013 Example <>
- Whatever
share|improve this question
Yes, this is software that I'm just unzipping into a directory, with no real build process. – freiheit May 8 '13 at 21:11

Turns out, that leaving the Source unescaped, and quoting it in the %install does the trick:

Source1: Foo
unzip "%SOURCE1"
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.