Bug 1881840

Summary: "%autosetup -a 1 -a 2" ignores the second "-a" while %setup doesn't
Product: Red Hat Enterprise Linux 8 Reporter: Tomas Tomecek <ttomecek>
Component: rpmAssignee: Packaging Maintenance Team <packaging-team-maint>
Status: CLOSED UPSTREAM QA Contact: swm-qe
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: CentOS StreamCC: bstinson, carl, jwboyer, pmatilai
Target Milestone: rc   
Target Release: 8.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-09-23 11:51:43 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Tomas Tomecek 2020-09-23 08:00:59 UTC
Description of problem:
%setup accepts multiple "-a" parameters, %autosetup doesn't - it only processes the first one


Version-Release number of selected component (if applicable):
rpm-4.14.2-37.el8.x86_64


How reproducible:
I stumbled upon this while working with gcc's spec file:

Works fine:
%setup -q -n gcc-%{version}-%{DATE} -a 1 -a 2

Only first archive is unpacked:
%autosetup -n gcc-%{version}-%{DATE} -a 1 -a 2

Actual results:
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.OBhDab                                           
+ umask 022                                                                                    
+ cd /home/tt/p/c/r/gcc/SOURCES                                                                
+ cd /home/tt/p/c/r/gcc/SOURCES                                                                
+ rm -rf gcc-8.3.1-20191121                                                                    
+ /usr/bin/xz -dc /home/tt/p/c/r/gcc/SOURCES/gcc-8.3.1-20191121.tar.xz                         
+ /usr/bin/tar -xof -                                                                          
+ STATUS=0                                                                                     
+ '[' 0 -ne 0 ']'                                                                              
+ cd gcc-8.3.1-20191121                                                                        
+ /usr/bin/xz -dc /home/tt/p/c/r/gcc/SOURCES/nvptx-newlib-aadc8eb0ec43b7cd0dd2dfb484bae63c8b05ef24.tar.xz                                                                                     
+ /usr/bin/tar -xof -                                                                          
+ STATUS=0                                                                                                                                                                                    
+ '[' 0 -ne 0 ']'                                                                              
+ /usr/bin/chmod -Rf a+rX,u+w,g-w,o-w .                                                                                                                                                       
+ echo 'Patch #0 (gcc8-hack.patch):'   

Expected results:
$ rpmbuild -bp ./SPECS/gcc.spec --nodeps --define "_topdir $PWD"                                                                                                       
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.k4ZV4S                                                                                                                                          
+ umask 022                                                                                                                                                                                   
+ cd /tmp/gcc/BUILD                                                                                                                                                                           
+ cd /tmp/gcc/BUILD                                                                                                                                                                           
+ rm -rf gcc-8.3.1-20191121                                                                                                                                                                   
+ /usr/bin/xz -dc /tmp/gcc/SOURCES/gcc-8.3.1-20191121.tar.xz                                                                                                                                  
+ /usr/bin/tar -xof -                                                                                                                                                                         
+ STATUS=0                                                                                                                                                                                    
+ '[' 0 -ne 0 ']'                                                                                                                                                                             
+ cd gcc-8.3.1-20191121                                                                                                                                                                       
+ /usr/bin/xz -dc /tmp/gcc/SOURCES/nvptx-tools-c28050f60193b3b95a18866a96f03334e874e78f.tar.xz                                                                                                
+ /usr/bin/tar -xof -                                                                                                                                                                         
+ STATUS=0
+ '[' 0 -ne 0 ']'
+ /usr/bin/xz -dc /tmp/gcc/SOURCES/nvptx-newlib-aadc8eb0ec43b7cd0dd2dfb484bae63c8b05ef24.tar.xz 
+ /usr/bin/tar -xof -
+ STATUS=0
+ '[' 0 -ne 0 ']'
+ /usr/bin/chmod -Rf a+rX,u+w,g-w,o-w .

Comment 1 Panu Matilainen 2020-09-23 08:29:42 UTC
Known limitation of the macro subsystem (see GH ticket), it doesn't support accessing information from multiple flags.
The difference comes from %autosetup being a macro but %setup being a specific C-implentation in the build code.

There's no easy fix, and I don't expect us to be able to fix it in RHEL 8 or even 9.

Comment 2 Tomas Tomecek 2020-09-23 09:14:39 UTC
Got it, thanks Panu for the explanation.

Feel free to close this as wontfix then.