FS#25546 - /arch/setup fails on archlinux-2011.08.12-core-x86_64
Attached to Project:
Release Engineering
Opened by Martin Schmidt (Blind) - Saturday, 13 August 2011, 03:47 GMT
Last edited by Dieter Plaetinck (Dieter_be) - Saturday, 13 August 2011, 20:18 GMT
Opened by Martin Schmidt (Blind) - Saturday, 13 August 2011, 03:47 GMT
Last edited by Dieter Plaetinck (Dieter_be) - Saturday, 13 August 2011, 20:18 GMT
|
Details
Trying out
releng.archlinux.org/isos/archlinux-2011.08.12-core-x86_64
When trying to run /arch/setup, the script fails in /usr/.../core/libs/lib-blockdevices-filesystems.sh with a syntax error on line 300. The /arch/setup script bails out with an error about sourcing the above file. It seems the develop branch github file is the one that fails. |
This task depends upon
Closed by Dieter Plaetinck (Dieter_be)
Saturday, 13 August 2011, 20:18 GMT
Reason for closing: Fixed
Additional comments about closing: fixed since 2011.08.13
Saturday, 13 August 2011, 20:18 GMT
Reason for closing: Fixed
Additional comments about closing: fixed since 2011.08.13
easily reproducable on my home system:
$ shopt -s extglob; for devpath in /dev/mapper/!(arch_*); do echo $devpath; done; shopt -u extglob
/dev/mapper/control
/dev/mapper/cryptpool-home
/dev/mapper/cryptpoolhost
/dev/mapper/cryptpool-root
/dev/mapper/cryptpool-swap
$ cat test.sh
#!/bin/bash
shopt -s extglob; for devpath in /dev/mapper/!(arch_*); do echo $devpath; done; shopt -u extglob
$ ./test.sh
./test.sh: line 2: syntax error near unexpected token `('
./test.sh: line 2: `shopt -s extglob; for devpath in /dev/mapper/!(arch_*); do echo $devpath; done; shopt -u extglob'
WTF?
$ bash --version
GNU bash, version 4.2.10(2)-release (i686-pc-linux-gnu)
(..)
> shopt -s extglob; for devpath in /dev/mapper/!(arch_*); do echo $devpath; done; shopt -u extglob
bash: !: event not found
and the same with setting nullglob (like in the script):
> shopt -s nullglob; shopt -s extglob; for devpath in /dev/mapper/!(arch_*); do echo $devpath; done; shopt -u extglob; shopt -u nullglob
bash: !: event not found
> bash --version
GNU bash, version 4.2.10(2)-release (x86_64-unknown-linux-gnu)
shopt -s extglob
printf '%s\n' /dev/mapper/!(arch_*)
shopt -u extglob
The root of the problem is that enabling extglob from within the function does not work. Any and all shopts should be declared at the top of the file that they're used in. A short proof of isolation of this problem...
#!/bin/bash
foo() {
shopt -s extglob
printf '%s\n' /dev/mapper/!(arch_*)
}
foo
------------
foo: line 5: syntax error near unexpected token `('
foo: line 5: ` printf '%s\n' /dev/mapper/!(arch_*)'
So, Dieterbe had that option already turned on in his proof above there, I gather.
First set extglob abpve function, and unset at end. In this way bash can parse the function without any issue.
Second set extglob before the command, so extglob is enabled during running flow.
shopt -s extglob
functiom() {
shopt -s extglob
command-that-needs-extglob
shopt -u extglob
}
shopt -u extglob
I'll reiterate: Any and all shopts should be declared at the top of the file that they're used in.
Try this:
---
shopt -s extglob
foo() {
shopt -s extglob
printf '%s\n' /dev/mapper/!(arch_*)
}
shopt -u extglob
foo
----