rpmbuild error: command $`\r` not found
Asked Answered
L

1

10

I'm running an rpm spec file, and encountering the following error:

$ rpmbuild -ba gregorio.spec 
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.dDWqRV
+ umask 022
+ cd /home/cantanima/rpmbuild/BUILD
+ cd /home/cantanima/rpmbuild/BUILD
+ rm -rf gregorio-2.4.1
+ /usr/bin/tar -xf -
+ /usr/bin/gzip -dc /home/cantanima/rpmbuild/SOURCES/gregorio-2.4.1.tar.gz
+ STATUS=0
+ '[' 0 -ne 0 ']'
+ cd gregorio-2.4.1
+ /usr/bin/chmod -Rf a+rX,u+w,g-w,o-w .
+ $'\r'
/var/tmp/rpm-tmp.dDWqRV: line 39: $'\r': command not found
error: Bad exit status from /var/tmp/rpm-tmp.dDWqRV (%prep)

The script file /var/tmp/rpm-tmp.dDWqRV has the following lines in that area:

if [ $STATUS -ne 0 ]; then
  exit $STATUS
fi
cd 'gregorio-2.4.1'
/usr/bin/chmod -Rf a+rX,u+w,g-w,o-w .

autoreconf -f -i

Line 39 is the one immediately above autoreconf -f -i. It's a blank line, apparently marked by \r instead of a standard Linux carriage return. If I change that one line in a text editor, the script runs fine.

As far as I can tell, this script file is automatically generated by rpmbuild, not by the spec file, though I don't honestly know. What am I doing to cause this? I'm running Fedora 20, rpmbuild version 4.11.3.

Lackluster answered 12/4, 2015 at 4:36 Comment(0)
L
13

A little more work did it. Apparently, when I downloaded the .spec file, either my email provider or my web browser gave it a DOS encoding ('\r\n'). I opened it up in a text editor, switched it to Unix encoding ('\n') and all is fine — now rpmbuild runs happily.

Lackluster answered 12/4, 2015 at 5:15 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.