[pacman-dev] [PATCH] makepkg: save and restore shell options before and after build()

Allan McRae allan at archlinux.org
Thu Dec 4 23:48:12 EST 2008


Aaron Griffin wrote:
> On Thu, Dec 4, 2008 at 9:00 PM, Allan McRae <allan at archlinux.org> wrote:
>   
>> Dan McGee wrote:
>>     
>>> On Thu, Dec 4, 2008 at 8:48 PM, Dan McGee <dan at archlinux.org> wrote:
>>>
>>>       
>>>> Fix the issue uncovered by FS#12344. In this instance, the dotglob shopt
>>>> was
>>>> being set in the build() function but never cleared, causing issues in
>>>> the
>>>> remaining parts of the makepkg script.
>>>>
>>>> Signed-off-by: Dan McGee <dan at archlinux.org>
>>>> ---
>>>>  scripts/makepkg.sh.in |    4 ++++
>>>>  1 files changed, 4 insertions(+), 0 deletions(-)
>>>>
>>>> diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
>>>> index 4cc255c..25e4cc8 100644
>>>> --- a/scripts/makepkg.sh.in
>>>> +++ b/scripts/makepkg.sh.in
>>>> @@ -675,6 +675,8 @@ run_build() {
>>>>
>>>>       # ensure all necessary build variables are exported
>>>>       export CFLAGS CXXFLAGS MAKEFLAGS CHOST
>>>> +       # save our shell options so build() can't override what we need
>>>> +       local $shellopts=$(shopts -p)
>>>>
>>>>         
>>> I could have used this as a litmus test to see if anyone actually
>>> tried this, but assume I put "shopt" (drop the s) here instead. Fixed
>>> locally. :)
>>>
>>>
>>>       
>> Ha,  i was just trying to figure out why I had not "shopts" command !
>>
>>     
>>>>       local ret=0
>>>>       if [ "$LOGGING" = "1" ]; then
>>>> @@ -695,6 +697,8 @@ run_build() {
>>>>       else
>>>>               build 2>&1 || ret=$?
>>>>       fi
>>>> +       # reset our shell options
>>>> +       eval "$shellopts"
>>>>
>>>>       if [ $ret -gt 0 ]; then
>>>>               error "$(gettext "Build Failed.")"
>>>> --
>>>> 1.6.0.4
>>>>
>>>>
>>>>         
>> Strange problem....  Patch looks good to me.
>>     
>
> With even stranger symptoms! Thayer build a package that had 2
> .PKGINFO files in it. I didn't even know tar could do that. This
> actually caused goofy issues on gerolde when validating that the
> package's arch was the same as the repo it was going to - because the
> check basically cat's the .PKGINFO and looks for the arch setting.
> Instead of 'i686' it was getting 'i686\ni686'

It took me a while to try and duplicate this because looking at the 
package file or extracting, you only see one .PKGINFO file.  However, we 
directly read from the package file rather than extracting to disk so 
that causes the issue.  To see it by eye:

bsdtar -czvf test.tar.gz .PKGINFO .PKGINFO .PKGINFO
bsdtar -xzvf test.tar.gz






More information about the pacman-dev mailing list