Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

rpmbuild error: command $`\r` not found

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.

like image 686
John Perry Avatar asked Apr 12 '15 04:04

John Perry


1 Answers

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.

like image 71
John Perry Avatar answered Sep 25 '22 09:09

John Perry