Bug 32136

Summary: bash4 is available to be used for build (with BASHOPTS=extglob, too)
Product: Sisyphus Reporter: Ivan Zakharyaschev <imz>
Component: zfs-utilsAssignee: Nobody's working on this, feel free to take it <nobody>
Status: CLOSED WORKSFORME QA Contact: qa-sisyphus
Severity: enhancement    
Priority: P3 CC: at, glebfm, kde, rider
Version: unstable   
Hardware: all   
OS: Linux   
URL: https://lists.altlinux.org/pipermail/sisyphus/2012-August/358222.html
Bug Depends on: 32110, 31399    
Bug Blocks:    

Description Ivan Zakharyaschev 2016-05-25 20:57:50 MSK
zfs-0.6.3-alt12

Сейчас в Sisyphus есть пакет bash4.

Если у Вас скрипты на bash4 (см. http://git.altlinux.org/gears/z/zfs.git?p=zfs.git;a=blob;f=zfs.spec;h=03f60bcb725c70d10722087ac5ec46e1e66e4f21;hb=HEAD#l75 ), то в нынешней ситуации (т.е.
когда bash -- это не bash4) с rpm-4.0.4-alt100.94 можно делать так:

* в shebang написать bash4
* в .spec-е экспортировать BASHOPTS:

# For shell.req:
%global __spec_autodep_custom_pre export BASHOPTS=extglob

Я так собрал пакет --
http://git.altlinux.org/people/imz/packages/mosquito-hive.git?p=mosquito-hive.git;a=commitdiff;h=c00c2380ca0b3529833d75b1ba3d6777dcccbd01
.

+++ This bug was initially created as a clone of Bug #32110 +++

bash-3.2.57-alt1

As described in https://lists.altlinux.org/pipermail/devel/2016-May/201432.html , the following failure:

Executing: /bin/sh -e /usr/src/tmp/rpm-tmp.yxuvVs
find-requires: running scripts (cpp,debuginfo,files,lib,pam,perl,pkgconfig,pkgconfiglib,python,rpmlib,shebang,shell,static,symlinks)
/usr/src/tmp/mosquito-hive-buildroot/usr/share/mosquito-hive/rebuild-helper-one.sh: line 22: syntax error near unexpected token `('
/usr/src/tmp/mosquito-hive-buildroot/usr/share/mosquito-hive/rebuild-helper-one.sh: line 22: `	-*([0-9])) num="${1#-}"; shift;;'
shell.req: ERROR: /usr/src/tmp/mosquito-hive-buildroot/usr/share/mosquito-hive/rebuild-helper-one.sh: /bin/bash --rpm-requires failed
find-requires: ERROR: /usr/lib/rpm/shell.req failed
error: /bin/sh failed
error: Failed to find Requires


RPM build errors:
    /bin/sh failed
    Failed to find Requires

can be reproduced by running gear-hsh in mosquito-hive from http://git.altlinux.org/people/imz/public/mosquito-hive.git and is caused by code like http://git.altlinux.org/people/imz/public/mosquito-hive.git?p=mosquito-hive.git;a=blob;f=rebuild-helper-one.sh;h=e229ef04e9a03db69704de2be95773320ef2ea6f;hb=HEAD#l22 :

    shopt -s extglob

    case "$1" in
	-*([0-9])) num="${1#-}"; shift;;
    esac

(*(fooBAR) is the special form from the extended globs. I use it substantially in other places of mosquito-hive; but, anyway, a correct bash script shouldn't break this mode. )
Comment 1 Anton Farygin 2018-12-05 07:59:11 MSK
Исправится само, как только ldv соберёт bash4
Comment 2 Anton Farygin 2019-03-26 12:01:35 MSK
bash-4 по умолчанию уже в Sisyphus