Bug 35376

Summary: Шебанг #!/usr/bin/env bash не распознается /usr/lib/rpm/shell.req
Product: Sisyphus Reporter: mikhailnov <m>
Component: rpm-buildAssignee: placeholder <placeholder>
Status: CLOSED FIXED QA Contact: qa-sisyphus
Severity: normal    
Priority: P3 CC: arseny, evg, glebfm, imz, ldv, placeholder, vt
Version: unstable   
Hardware: all   
OS: Linux   

Description mikhailnov 2018-09-10 12:02:22 MSK
/tmp/.private/user/pulsejoin-buildroot/usr/bin/pulsejoin: line 82: syntax error near unexpected token `<'
/tmp/.private/user/pulsejoin-buildroot/usr/bin/pulsejoin: line 82: `		done < <(sed -e 's/ /\'$'\n/g' -e '/^$/d' "${pa_modules_list_file}")'
shell.req: ERROR: /tmp/.private/user/pulsejoin-buildroot/usr/bin/pulsejoin: /bin/sh --rpm-requires failed

Участок кода:

pa_remove_devices(){
	if [ -f "$pa_modules_list_file" ]; then
		while read -r line
		do
			pactl unload-module "$line"
		done < <(sed -e 's/ /\'$'\n/g' -e '/^$/d' "${pa_modules_list_file}")
		rm -fv "${pa_modules_list_file}"
	fi
}

https://gitlab.com/mikhailnov/pulsejoin/blob/master/pulsejoin.sh#L82

В сизифе не пробовал.
Comment 1 mikhailnov 2018-09-10 12:04:52 MSK
$ rpmbuild --version
RPM версия 4.0.4 (это p8)

Для воспроизведения:
git clone https://gitlab.com/mikhailnov/pulsejoin
cd pulsejoin
rpmbb
Comment 2 mikhailnov 2018-09-10 12:20:35 MSK
bash --rpm-requires pulsejoin.sh - все хорошо, sh --rpm-requires pulsejoin.sh - ошибка. Шебанг #!/usr/bin/env bash
Comment 3 mikhailnov 2018-09-10 12:31:53 MSK
Замена шебанга
sed -i %{buildroot}/usr/bin/pulsejoin -e 's,#!/usr/bin/env bash,#!/bin/bash,g'
помогает.
То есть /usr/lib/rpm/shell.req вызывает sh вместо bash, не распознав /usr/bin/env bash
Comment 4 Repository Robot 2019-02-01 02:12:19 MSK
rpm-build-4.0.4-alt126 -> sisyphus:

Thu Jan 31 2019 Gleb F-Malinovskiy <glebfm@altlinux> 4.0.4-alt126
- imz@:
  + shell.req: correctly detect #!/bin/env bash (ALT#35376).
  + platform.in: completely expand %_libsuff (/usr/lib%nil was ugly).
- Fixed getopt(3) use in parameterized macros parser.